Commit Graph

38 Commits

Author SHA1 Message Date
Tetsuhiro Kohada
461d45b45c exfat: redefine PBR as boot_sector
Aggregate PBR related definitions and redefine as boot_sector to comply
with the exFAT specification.
And, rename variable names including 'pbr'.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-06-04 15:42:38 +09:00
Tetsuhiro Kohada
9f140e2c22 exfat: optimize dir-cache
Optimize directory access based on exfat_entry_set_cache.
 - Hold bh instead of copied d-entry.
 - Modify bh->data directly instead of the copied d-entry.
 - Write back the retained bh instead of rescanning the d-entry-set.
And
 - Remove unused cache related definitions.

Signed-off-by: Tetsuhiro Kohada <kohada.tetsuhiro@dc.mitsubishielectric.co.jp>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-06-04 15:42:34 +09:00
Namjae Jeon
c486d443f8 exfat: use renamed repo in travis script
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2020-05-31 20:48:47 +09:00
Wei Yongjun
377751a684 exfat: fix possible memory leak in exfat_find()
'es' is malloced from exfat_get_dentry_set() in exfat_find() and should
be freed before leaving from the error handling cases, otherwise it will
cause memory leak.

Fixes: 5f2aa075070c ("exfat: add inode operations")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-05-26 21:36:02 +09:00
Namjae Jeon
acb6ab8052 exfat: add missing time_offset mount option for kernel version that is lower than 5.4 version
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2020-05-26 21:32:18 +09:00
Namjae Jeon
16897b770c exfat: remove so library copy
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2020-05-04 00:15:23 +09:00
Namjae Jeon
5b0b76fb88 exfat: add fsx xfstests
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-05-03 23:58:06 +09:00
Eric Sandeen
3f985aa6d5 exfat: use iter_file_splice_write
Doing copy_file_range() on exfat with a file opened for direct IO leads
to an -EFAULT:

# xfs_io -f -d -c "truncate 32768" \
       -c "copy_range -d 16384 -l 16384 -f 0" /mnt/test/junk
copy_range: Bad address

and the reason seems to be that we go through:

default_file_splice_write
 splice_from_pipe
  __splice_from_pipe
   write_pipe_buf
    __kernel_write
     new_sync_write
      generic_file_write_iter
       generic_file_direct_write
        exfat_direct_IO
         do_blockdev_direct_IO
          iov_iter_get_pages

and land in iterate_all_kinds(), which does "return -EFAULT" for our kvec
iter.

Setting exfat's splice_write to iter_file_splice_write fixes this and lets
fsx (which originally detected the problem) run to success from the xfstests
harness.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2020-05-03 23:26:10 +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
Eric Sandeen
b0333de3ff exfat: properly set s_time_gran
The s_time_gran superblock field indicates the on-disk nanosecond
granularity of timestamps, and for exfat that seems to be 10ms, so
set s_time_gran to 10000000ns. Without this, in-memory timestamps
change when they get re-read from disk.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-04-21 10:17:21 +09:00
Jason Yan
db8bd78e86 exfat: remove the assignment of 0 to bool variable
There is no need to init 'sync' in exfat_set_vol_flags().
This also fixes the following coccicheck warning:

fs/exfat/super.c:104:6-10: WARNING: Assignment of 0/1 to bool variable

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2020-04-16 09:52:09 +09:00
Pali Rohár
d2424acd1d exfat: Remove unused functions exfat_high_surrogate() and exfat_low_surrogate()
After applying previous two patches, these functions are not used anymore.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2020-04-16 09:46:18 +09:00
Pali Rohár
233b4ba5ab exfat: Simplify exfat_utf8_d_hash() for code points above U+FFFF
Function partial_name_hash() takes long type value into which can be stored
one Unicode code point. Therefore conversion from UTF-32 to UTF-16 is not
needed.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2020-04-16 09:46:11 +09:00
Tetsuhiro Kohada
f65abe88d5 exfat: remove 'bps' mount-option
remount fails because exfat_show_options() returns unsupported option 'bps'.
> # mount -o ro,remount
> exfat: Unknown parameter 'bps'

To fix the problem, just remove 'bps' option from exfat_show_options().

Signed-off-by: Tetsuhiro Kohada <Kohada.Tetsuhiro@dc.MitsubishiElectric.co.jp>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-04-08 13:32:33 +09:00
Namjae Jeon
a4aad16ccf exfat: add create file and directory test
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-04-07 15:09:18 +09:00
Namjae Jeon
c3dd1a225a exfat: add more xfstests test in travis-CI
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-04-07 14:32:24 +09:00
Namjae Jeon
39018f1bca exfat: use truncate instead of dd command
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
2020-04-06 22:21:36 +09:00
Namjae Jeon
2ac0fc42e4 exfat: disable build exfat with linus tree
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-04-06 14:58:30 +09:00
Namjae Jeon
1f5b9538b0 exfat: fix wrong exfat_oot repo directory name
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-04-06 14:29:20 +09:00
Namjae Jeon
91a2de7e4d exfat: fix wrong format option
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-04-06 14:24:30 +09:00
Tetsuhiro Kohada
0790539add exfat: Unify access to the boot sector
Unify access to boot sector via 'sbi->pbr_bh'.
This fixes vol_flags inconsistency at read failed in fs_set_vol_flags(),
and buffer_head leak in __exfat_fill_super().

Signed-off-by: Tetsuhiro Kohada <Kohada.Tetsuhiro@dc.MitsubishiElectric.co.jp>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-04-06 14:11:45 +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
Thomas Backlund
fb5c212fe0 exfat: add missing MODULE_ALIAS_FS()
This adds the necessary MODULE_ALIAS_FS() to exfat so the module gets
automatically loaded when an exfat filesystem is mounted.

Signed-off-by: Thomas Backlund <tmb@mageia.org>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-04-06 12:32:06 +09:00
Pali Rohár
ff09ff7549 exfat: Fix discard support
Discard support was always unconditionally disabled. Now it is disabled
only in the case when blk_queue_discard() returns false.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-04-06 12:32:03 +09:00
Pali Rohár
50fb5077e8 exfat: Simplify exfat_utf8_d_cmp() for code points above U+FFFF
If two Unicode code points represented in UTF-16 are different then also
their UTF-32 representation must be different. Therefore conversion from
UTF-32 to UTF-16 is not needed.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-04-06 12:30:39 +09:00
Namjae Jeon
dafa5b3b3a exfat: linux 5.6 kernel support
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
2020-02-10 21:57:29 +09:00
Namjae Jeon
9c905ae9e7 exfat: fix typo
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
2020-02-10 21:35:58 +09:00
Namjae Jeon
55bec22898 exfat: update README file
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
2020-02-10 21:34:19 +09:00
Namjae Jeon
98de46168a exfat: enable check exfat filesystem
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
2020-02-10 21:04:14 +09:00
Namjae Jeon
b25daea91c exfat: add build test and xfstests using travis CI
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
2020-02-09 16:43:52 +09:00
Namjae Jeon
3772ef846a
Merge pull request #1 from namjaejeon/exfat-next
Exfat next
2020-02-08 19:14:21 +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
02572c91c5 exfat: add more testcases
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-02-06 08:08:50 +09:00
Namjae Jeon
f53d47cb58 exfat: linux 4.16 kernel build support
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
2020-02-04 09:18:10 +09:00
Namjae Jeon
92d4cd0cde exfat: add travis-CI build and test support
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
2020-02-03 22:43:47 +09:00
Namjae Jeon
9273f3d387 exfat: initial commit
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
2020-02-03 21:47:19 +09:00
Namjae Jeon
cbc66ddece
Initial commit 2020-01-31 09:47:20 +09:00