Skip to content

Commit 9079b56

Browse files
committed
backports: exfat: from: linux.git
Reference: 1657f11 Signed-off-by: Robert Nelson <[email protected]>
1 parent a76e3c4 commit 9079b56

File tree

10 files changed

+1300
-3789
lines changed

10 files changed

+1300
-3789
lines changed

drivers/staging/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ obj-$(CONFIG_KPC2000) += kpc2000/
5151
obj-$(CONFIG_ISDN_CAPI) += isdn/
5252
obj-$(CONFIG_UWB) += uwb/
5353
obj-$(CONFIG_USB_WUSB) += wusbcore/
54-
obj-$(CONFIG_EXFAT_FS) += exfat/
54+
obj-$(CONFIG_STAGING_EXFAT_FS) += exfat/
5555
obj-$(CONFIG_QLGE) += qlge/

drivers/staging/exfat/Kconfig

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,41 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
config EXFAT_FS
2+
config STAGING_EXFAT_FS
33
tristate "exFAT fs support"
44
depends on BLOCK
55
select NLS
66
help
77
This adds support for the exFAT file system.
88

9-
config EXFAT_DONT_MOUNT_VFAT
10-
bool "Prohibit mounting of fat/vfat filesystems by exFAT"
11-
depends on EXFAT_FS
12-
default y
13-
help
14-
By default, the exFAT driver will only mount exFAT filesystems, and refuse
15-
to mount fat/vfat filesystems. Set this to 'n' to allow the exFAT driver
16-
to mount these filesystems.
17-
18-
config EXFAT_DISCARD
9+
config STAGING_EXFAT_DISCARD
1910
bool "enable discard support"
20-
depends on EXFAT_FS
11+
depends on STAGING_EXFAT_FS
2112
default y
2213

23-
config EXFAT_DELAYED_SYNC
14+
config STAGING_EXFAT_DELAYED_SYNC
2415
bool "enable delayed sync"
25-
depends on EXFAT_FS
16+
depends on STAGING_EXFAT_FS
2617
default n
2718

28-
config EXFAT_KERNEL_DEBUG
19+
config STAGING_EXFAT_KERNEL_DEBUG
2920
bool "enable kernel debug features via ioctl"
30-
depends on EXFAT_FS
21+
depends on STAGING_EXFAT_FS
3122
default n
3223

33-
config EXFAT_DEBUG_MSG
24+
config STAGING_EXFAT_DEBUG_MSG
3425
bool "print debug messages"
35-
depends on EXFAT_FS
26+
depends on STAGING_EXFAT_FS
3627
default n
3728

38-
config EXFAT_DEFAULT_CODEPAGE
29+
config STAGING_EXFAT_DEFAULT_CODEPAGE
3930
int "Default codepage for exFAT"
4031
default 437
41-
depends on EXFAT_FS
32+
depends on STAGING_EXFAT_FS
4233
help
4334
This option should be set to the codepage of your exFAT filesystems.
4435

45-
config EXFAT_DEFAULT_IOCHARSET
36+
config STAGING_EXFAT_DEFAULT_IOCHARSET
4637
string "Default iocharset for exFAT"
4738
default "utf8"
48-
depends on EXFAT_FS
39+
depends on STAGING_EXFAT_FS
4940
help
5041
Set this to the default input/output character set you'd like exFAT to use.

drivers/staging/exfat/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0-or-later
22

3-
obj-$(CONFIG_EXFAT_FS) += exfat.o
3+
obj-$(CONFIG_STAGING_EXFAT_FS) += exfat.o
44

55
exfat-y := exfat_core.o \
66
exfat_super.o \

drivers/staging/exfat/TODO

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,69 @@
1+
A laundry list of things that need looking at, most of which will
2+
require more work than the average checkpatch cleanup...
3+
4+
Note that some of these entries may not be bugs - they're things
5+
that need to be looked at, and *possibly* fixed.
6+
7+
Clean up the ffsCamelCase function names.
8+
9+
Fix (thing)->flags to not use magic numbers - multiple offenders
10+
11+
Sort out all the s32/u32/u8 nonsense - most of these should be plain int.
12+
113
exfat_core.c - ffsReadFile - the goto err_out seem to leak a brelse().
214
same for ffsWriteFile.
315

4-
exfat_core.c - fs_sync(sb,0) all over the place looks fishy as hell.
5-
There's only one place that calls it with a non-zero argument.
16+
All the calls to fs_sync() need to be looked at, particularly in the
17+
context of EXFAT_DELAYED_SYNC. Currently, if that's defined, we only
18+
flush to disk when sync() gets called. We should be doing at least
19+
metadata flushes at appropriate times.
620

721
ffsTruncateFile - if (old_size <= new_size) {
822
That doesn't look right. How did it ever work? Are they relying on lazy
923
block allocation when actual writes happen? If nothing else, it never
1024
does the 'fid->size = new_size' and do the inode update....
1125

1226
ffsSetAttr() is just dangling in the breeze, not wired up at all...
27+
28+
Convert global mutexes to a per-superblock mutex.
29+
30+
Right now, we load exactly one UTF-8 table. Check to see
31+
if that plays nice with different codepage and iocharset values
32+
for simultanous mounts of different devices
33+
34+
exfat_rmdir() checks for -EBUSY but ffsRemoveDir() doesn't return it.
35+
In fact, there's a complete lack of -EBUSY testing anywhere.
36+
37+
There's probably a few missing checks for -EEXIST
38+
39+
check return codes of sync_dirty_buffer()
40+
41+
Why is remove_file doing a num_entries++??
42+
43+
Double check a lot of can't-happen parameter checks (for null pointers for
44+
things that have only one call site and can't pass a null, etc).
45+
46+
All the DEBUG stuff can probably be tossed, including the ioctl(). Either
47+
that, or convert to a proper fault-injection system.
48+
49+
exfat_remount does exactly one thing. Fix to actually deal with remount
50+
options, particularly handling R/O correctly. For that matter, allow
51+
R/O mounts in the first place.
52+
53+
Figure out why the VFAT code used multi_sector_(read|write) but the
54+
exfat code doesn't use it. The difference matters on SSDs with wear leveling.
55+
56+
exfat_fat_sync(), exfat_buf_sync(), and sync_alloc_bitmap()
57+
aren't called anyplace....
58+
59+
Create helper function for exfat_set_entry_time() and exfat_set_entry_type()
60+
because it's sort of ugly to be calling the same functionn directly and
61+
other code calling through the fs_func struc ponters...
62+
63+
clean up the remaining vol_type checks, which are of two types:
64+
some are ?: operators with magic numbers, and the rest are places
65+
where we're doing stuff with '.' and '..'.
66+
67+
Patches to:
68+
Greg Kroah-Hartman <[email protected]>
69+
Valdis Kletnieks <[email protected]>

0 commit comments

Comments
 (0)