Commit graph

16 commits

Author SHA1 Message Date
Takashi Iwai
0d2005c28d exfat: Expand exfat_err() and co directly to pr_*() macro
Currently the error and info messages handled by exfat_err() and co
are tossed to exfat_msg() function that does nothing but passes the
strings with printk() invocation.  Not only that this is more overhead
by the indirect calls, but also this makes harder to extend for the
debug print usage; because of the direct printk() call, you cannot
make it for dynamic debug or without debug like the standard helpers
such as pr_debug() or dev_dbg().

For addressing the problem, this patch replaces exfat_*() macro to
expand to pr_*() directly.  Along with it, add the new exfat_debug()
macro that is expanded to pr_debug() (which output can be gracefully
suppressed via dyndbg).

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2022-07-29 17:26:04 +09:00
Namjae Jeon
fa4f895f67 exfat: fix write failure on kernels prior to 4.8.
rw flags agrument in write_dirty_buffer() and __sync_dirty_buffer() was
changed since linux 4.8 kernels.

Reported-by: kuehnelth <kuehnelth@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2022-05-14 08:27:13 +09:00
Chung-Chiang Cheng
8dbffe2044 exfat: introduce mount option 'sys_tz'
EXFAT_TZ_VALID bit in {create,modify,access}_tz is corresponding to
OffsetValid field in exfat specification [1]. When this bit isn't
set, timestamps should be treated as having the same UTC offset as
the current local time.

Currently, there is an option 'time_offset' for users to specify the
UTC offset for this issue. This patch introduces a new mount option
'sys_tz' to use system timezone as time offset.

Link: [1] https://docs.microsoft.com/en-us/windows/win32/fileio/exfat-specification#74102-offsetvalid-field

Signed-off-by: Chung-Chiang Cheng <cccheng@synology.com>
Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2022-04-08 22:02:12 +09:00
Yuezhang.Mo
1c014cbe6a exfat: fix missing REQ_SYNC in exfat_update_bhs()
If 'dirsync' is enabled, all directory updates within the
filesystem should be done synchronously. exfat_update_bh()
does as this, but exfat_update_bhs() does not.

Reviewed-by: Andy.Wu <Andy.Wu@sony.com>
Reviewed-by: Aoyama, Wataru <wataru.aoyama@sony.com>
Reviewed-by: Kobayashi, Kento <Kento.A.Kobayashi@sony.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Yuezhang.Mo <Yuezhang.Mo@sony.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2021-12-21 21:47:07 +09:00
Matthieu CASTET
2314f3c08f exfat: fix build on old 32 bits system
For kernel less than 4.19.0, the max supported date is 2038 for 32/64 bits.

This should fix :
In file included from fs/exfat/misc.c:14:
fs/exfat/misc.c: In function 'exfat_set_entry_time':
fs/exfat/exfat_raw.h:166:37: error: overflow in conversion from 'long long int' to '__kernel_time_t' {aka 'long int'} changes value from '4354819199' to '59851903' [-Werror=overflow]
166 | #define EXFAT_MAX_TIMESTAMP_SECS 4354819199LL
| ^~~~~~~~~~~~
fs/exfat/misc.c:135:16: note: in expansion of macro 'EXFAT_MAX_TIMESTAMP_SECS'
135 | ts->tv_sec = EXFAT_MAX_TIMESTAMP_SECS;
| ^~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
scripts/Makefile.build:258: recipe for target 'fs/exfat/misc.o' failed

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2021-06-09 11:10:16 +09:00
Matthieu CASTET
10e5987db7 exfat: Fix date for year < 1980 and > 2108
Change-Id: Ifcc1be945bda1cd0e0dc7ae71a26c939135e51f0

Signed-off-by: Matthieu Castet <matthieu.castet@parrot.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2021-03-25 08:10:47 +09:00
Namjae Jeon
6b09f3cef3 exfat: fix build error on 32bit & 4.19 lower kernel version
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-07-03 12:40:25 +09:00
Tetsuhiro Kohada
773256e416 exfat: write multiple sectors at once
Write multiple sectors at once when updating dir-entries.
Add exfat_update_bhs() for that. It wait for write completion once
instead of sector by sector.
It's only effective if sync enabled.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-07-03 12:40:14 +09:00
Tetsuhiro Kohada
117088f39d exfat: remove EXFAT_SB_DIRTY flag
This flag is set/reset in exfat_put_super()/exfat_sync_fs()
to avoid sync_blockdev().
- exfat_put_super():
Before calling this, the VFS has already called sync_filesystem(),
so sync is never performed here.
- exfat_sync_fs():
After calling this, the VFS calls sync_blockdev(), so, it is meaningless
to check EXFAT_SB_DIRTY or to bypass sync_blockdev() here.

Remove the EXFAT_SB_DIRTY check to ensure synchronization.
And remove the code related to the flag.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-06-17 22:08:32 +09:00
Tetsuhiro Kohada
149ef0460e exfat: standardize checksum calculation
To clarify that it is a 16-bit checksum, the parts related to the 16-bit
checksum are renamed and change type to u16.
Furthermore, replace checksum calculation in exfat_load_upcase_table()
with exfat_calc_checksum32().

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-06-04 15:42:47 +09:00
Tetsuhiro Kohada
af08f9af6f exfat: add boot region verification
Add Boot-Regions verification specified in exFAT specification.
Note that the checksum type is strongly related to the raw structure,
so the'u32 'type is used to clarify the number of bits.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-06-04 15:42:44 +09:00
Tetsuhiro Kohada
9772742131 exfat: replace 'time_ms' with 'time_cs'
Replace time_ms  with time_cs in the file directory entry structure
and related functions.

The unit of create_time_ms/modify_time_ms in File Directory Entry are not
'milli-second', but 'centi-second'.
The exfat specification uses the term '10ms', but instead use 'cs' as in
msdos_fs.h.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2020-05-03 23:11:32 +09:00
Eric Sandeen
09241c144b exfat: truncate atimes to 2s granularity
exfat atimes are restricted to only 2s granularity so after
we set an atime, round it down to the nearest 2s and set the
sub-second component of the timestamp to 0.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-04-21 10:17:24 +09:00
Joe Perches
e08ed90147 exfat: Use a more common logging style
Remove the direct use of KERN_<LEVEL> in functions by creating
separate exfat_<level> macros.

Miscellanea:

o Remove several unnecessary terminating newlines in formats
o Realign arguments and fit to 80 columns where appropriate

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-04-06 12:50:48 +09:00
Namjae Jeon
4e3295fb51 exfat: fix build support from 4.1 to liunx 5.5 kernel
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
2020-02-08 19:13:34 +09:00
Namjae Jeon
9273f3d387 exfat: initial commit
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
2020-02-03 21:47:19 +09:00