Skip to content

Commit cdd4dc3

Browse files
committed
Merge tag 'ntfs-for-7.1-rc1-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/ntfs
Pull ntfs resurrection from Namjae Jeon: "Ever since Kari Argillander’s 2022 report [1] regarding the state of the ntfs3 driver, I have spent the last 4 years working to provide full write support and current trends (iomap, no buffer head, folio), enhanced performance, stable maintenance, utility support including fsck for NTFS in Linux. This new implementation is built upon the clean foundation of the original read-only NTFS driver, adding: - Write support: Implemented full write support based on the classic read-only NTFS driver. Added delayed allocation to improve write performance through multi-cluster allocation and reduced fragmentation of the cluster bitmap. - iomap conversion: Switched buffered IO (reads/writes), direct IO, file extent mapping, readpages, and writepages to use iomap. - Remove buffer_head: Completely removed buffer_head usage by converting to folios. As a result, the dependency on CONFIG_BUFFER_HEAD has been removed from Kconfig. - Stability improvements: The new ntfs driver passes 326 xfstests, compared to 273 for ntfs3. All tests passed by ntfs3 are a complete subset of the tests passed by this implementation. Added support for fallocate, idmapped mounts, permissions, and more. xfstests Results report: Total tests run: 787 Passed : 326 Failed : 38 Skipped : 423 Failed tests breakdown: - 34 tests require metadata journaling - 4 other tests: 094: No unwritten extent concept in NTFS on-disk format 563: cgroup v2 aware writeback accounting not supported 631: RENAME_WHITEOUT support required 787: NFS delegation test" Link: https://lore.kernel.org/all/da20d32b-5185-f40b-48b8-2986922d8b25@stargateuniverse.net/ [1] [ Let's see if this undead filesystem ends up being of the "Easter miracle" kind, or the "Nosferatu of filesystems" kind... ] * tag 'ntfs-for-7.1-rc1-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/ntfs: (46 commits) ntfs: remove redundant out-of-bound checks ntfs: add bound checking to ntfs_external_attr_find ntfs: add bound checking to ntfs_attr_find ntfs: fix ignoring unreachable code warnings ntfs: fix inconsistent indenting warnings ntfs: fix variable dereferenced before check warnings ntfs: prefer IS_ERR_OR_NULL() over manual NULL check ntfs: harden ntfs_listxattr against EA entries ntfs: harden ntfs_ea_lookup against malformed EA entries ntfs: check $EA query-length in ntfs_ea_get ntfs: validate WSL EA payload sizes ntfs: fix WSL ea restore condition ntfs: add missing newlines to pr_err() messages ntfs: fix pointer/integer casting warnings ntfs: use ->mft_no instead of ->i_ino in prints ntfs: change mft_no type to u64 ntfs: select FS_IOMAP in Kconfig ntfs: add MODULE_ALIAS_FS ntfs: reduce stack usage in ntfs_write_mft_block() ntfs: fix sysctl table registration and path ...
2 parents eb0d6d9 + 14f0a13 commit cdd4dc3

65 files changed

Lines changed: 36331 additions & 118 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CREDITS

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,6 @@ D: dosfs, LILO, some fd features, ATM, various other hacks here and there
7171
S: Buenos Aires
7272
S: Argentina
7373

74-
NTFS FILESYSTEM
75-
N: Anton Altaparmakov
76-
E: anton@tuxera.com
77-
D: NTFS filesystem
78-
7974
N: Tim Alpaerts
8075
E: tim_alpaerts@toyota-motor-europe.com
8176
D: 802.2 class II logical link control layer,
@@ -85,8 +80,8 @@ S: B-2610 Wilrijk-Antwerpen
8580
S: Belgium
8681

8782
N: Anton Altaparmakov
88-
E: aia21@cantab.net
89-
W: http://www-stu.christs.cam.ac.uk/~aia21/
83+
E: anton@tuxera.com
84+
W: http://www.tuxera.com/
9085
D: Author of new NTFS driver, various other kernel hacks.
9186
S: Christ's College
9287
S: Cambridge CB2 3BU

Documentation/filesystems/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ Documentation for filesystem implementations.
9999
isofs
100100
nilfs2
101101
nfs/index
102+
ntfs
102103
ntfs3
103104
ocfs2
104105
ocfs2-online-filecheck

Documentation/filesystems/ntfs.rst

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
=================================
4+
The Linux NTFS filesystem driver
5+
=================================
6+
7+
8+
.. Table of contents
9+
10+
- Overview
11+
- Utilities support
12+
- Supported mount options
13+
14+
15+
Overview
16+
========
17+
18+
NTFS is a Linux kernel filesystem driver that provides full read and write
19+
support for NTFS volumes. It is designed for high performance, modern
20+
kernel infrastructure (iomap, folio), and stable long-term maintenance.
21+
22+
23+
Utilities support
24+
=================
25+
26+
The NTFS utilities project, called ntfsprogs-plus, provides mkfs.ntfs,
27+
fsck.ntfs, and other related tools (e.g., ntfsinfo, ntfsclone, etc.) for
28+
creating, checking, and managing NTFS volumes. These utilities can be used
29+
for filesystem testing with xfstests as well as for recovering corrupted
30+
NTFS devices.
31+
32+
The project is available at:
33+
34+
https://github.com/ntfsprogs-plus/ntfsprogs-plus
35+
36+
37+
Supported mount options
38+
=======================
39+
40+
The NTFS driver supports the following mount options:
41+
42+
======================= ====================================================
43+
iocharset=name Character set to use for converting between
44+
the encoding is used for user visible filename and
45+
16 bit Unicode characters.
46+
47+
nls=name Deprecated option. Still supported but please use
48+
iocharset=name in the future.
49+
50+
uid=
51+
gid=
52+
umask= Provide default owner, group, and access mode mask.
53+
These options work as documented in mount(8). By
54+
default, the files/directories are owned by root
55+
and he/she has read and write permissions, as well
56+
as browse permission for directories. No one else
57+
has any access permissions. I.e. the mode on all
58+
files is by default rw------- and
59+
for directories rwx------, a consequence of
60+
the default fmask=0177 and dmask=0077.
61+
Using a umask of zero will grant all permissions to
62+
everyone, i.e. all files and directories will have
63+
mode rwxrwxrwx.
64+
65+
fmask=
66+
dmask= Instead of specifying umask which applies both to
67+
files and directories, fmask applies only to files
68+
and dmask only to directories.
69+
70+
showmeta=<BOOL>
71+
show_sys_files=<BOOL> If show_sys_files is specified, show the system
72+
files in directory listings. Otherwise the default
73+
behaviour is to hide the system files.
74+
Note that even when show_sys_files is specified,
75+
"$MFT" will not be visible due to bugs/mis-features
76+
in glibc. Further, note that irrespective of
77+
show_sys_files, all files are accessible by name,
78+
i.e. you can always do "ls -l \$UpCase" for example
79+
to specifically show the system file containing
80+
the Unicode upcase table.
81+
82+
case_sensitive=<BOOL> If case_sensitive is specified, treat all filenames
83+
as case sensitive and create file names in
84+
the POSIX namespace (default behavior). Note,
85+
the Linux NTFS driver will never create short
86+
filenames and will remove them on rename/delete of
87+
the corresponding long file name. Note that files
88+
remain accessible via their short file name, if it
89+
exists.
90+
91+
nocase=<BOOL> If nocase is specified, treat filenames
92+
case-insensitively.
93+
94+
disable_sparse=<BOOL> If disable_sparse is specified, creation of sparse
95+
regions, i.e. holes, inside files is disabled for
96+
the volume (for the duration of this mount only).
97+
By default, creation of sparse regions is enabled,
98+
which is consistent with the behaviour of
99+
traditional Unix filesystems.
100+
101+
errors=opt Specify NTFS behavior on critical errors: panic,
102+
remount the partition in read-only mode or
103+
continue without doing anything (default behavior).
104+
105+
mft_zone_multiplier= Set the MFT zone multiplier for the volume (this
106+
setting is not persistent across mounts and can be
107+
changed from mount to mount but cannot be changed
108+
on remount). Values of 1 to 4 are allowed, 1 being
109+
the default. The MFT zone multiplier determines
110+
how much space is reserved for the MFT on the
111+
volume. If all other space is used up, then the
112+
MFT zone will be shrunk dynamically, so this has no
113+
impact on the amount of free space. However, it
114+
can have an impact on performance by affecting
115+
fragmentation of the MFT. In general use the
116+
default. If you have a lot of small files then use
117+
a higher value. The values have the following
118+
meaning:
119+
120+
===== =================================
121+
Value MFT zone size (% of volume size)
122+
===== =================================
123+
1 12.5%
124+
2 25%
125+
3 37.5%
126+
4 50%
127+
===== =================================
128+
129+
Note this option is irrelevant for read-only mount.
130+
131+
preallocated_size= Set preallocated size to optimize runlist merge
132+
overhead with small chunck size.(64KB size by
133+
default)
134+
135+
acl=<BOOL> Enable POSIX ACL support. When specified, POSIX
136+
ACLs stored in extended attributes are enforced.
137+
Default is off. Requires kernel config
138+
NTFS_FS_POSIX_ACL enabled.
139+
140+
sys_immutable=<BOOL> Make NTFS system files (e.g. $MFT, $LogFile,
141+
$Bitmap, $UpCase, etc.) immutable to user initiated
142+
modifications for extra safety. Default is off.
143+
144+
nohidden=<BOOL> Hide files and directories marked with the Windows
145+
"hidden" attribute. By default hidden items are
146+
shown.
147+
148+
hide_dot_files=<BOOL> Hide names beginning with a dot ("."). By default
149+
dot files are shown. When enabled, files and
150+
directories created with a leading '.' will be
151+
hidden from directory listings.
152+
153+
windows_names=<BOOL> Refuse creation/rename of files with characters or
154+
reserved device names disallowed on Windows (e.g.
155+
CON, NUL, AUX, COM1, LPT1, etc.). Default is off.
156+
discard=<BOOL> Issue block device discard for clusters freed on
157+
file deletion/truncation to inform underlying
158+
storage.
159+
======================= ====================================================

MAINTAINERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18997,6 +18997,15 @@ W: https://github.com/davejiang/linux/wiki
1899718997
T: git https://github.com/davejiang/linux.git
1899818998
F: drivers/ntb/hw/intel/
1899918999

19000+
NTFS FILESYSTEM
19001+
M: Namjae Jeon <linkinjeon@kernel.org>
19002+
M: Hyunchul Lee <hyc.lee@gmail.com>
19003+
L: linux-fsdevel@vger.kernel.org
19004+
S: Maintained
19005+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/ntfs.git
19006+
F: Documentation/filesystems/ntfs.rst
19007+
F: fs/ntfs/
19008+
1900019009
NTFS3 FILESYSTEM
1900119010
M: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
1900219011
L: ntfs3@lists.linux.dev

fs/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ menu "DOS/FAT/EXFAT/NT Filesystems"
152152

153153
source "fs/fat/Kconfig"
154154
source "fs/exfat/Kconfig"
155+
source "fs/ntfs/Kconfig"
155156
source "fs/ntfs3/Kconfig"
156157

157158
endmenu

fs/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ obj-$(CONFIG_NLS) += nls/
9090
obj-y += unicode/
9191
obj-$(CONFIG_SMBFS) += smb/
9292
obj-$(CONFIG_HPFS_FS) += hpfs/
93+
obj-$(CONFIG_NTFS_FS) += ntfs/
9394
obj-$(CONFIG_NTFS3_FS) += ntfs3/
9495
obj-$(CONFIG_UFS_FS) += ufs/
9596
obj-$(CONFIG_EFS_FS) += efs/

fs/ntfs/Kconfig

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
config NTFS_FS
3+
tristate "NTFS file system support"
4+
select NLS
5+
select FS_IOMAP
6+
help
7+
NTFS is the file system of Microsoft Windows NT, 2000, XP and 2003.
8+
This allows you to mount devices formatted with the ntfs file system.
9+
10+
To compile this as a module, choose M here: the module will be called
11+
ntfs.
12+
13+
config NTFS_DEBUG
14+
bool "NTFS debugging support"
15+
depends on NTFS_FS
16+
help
17+
If you are experiencing any problems with the NTFS file system, say
18+
Y here. This will result in additional consistency checks to be
19+
performed by the driver as well as additional debugging messages to
20+
be written to the system log. Note that debugging messages are
21+
disabled by default. To enable them, supply the option debug_msgs=1
22+
at the kernel command line when booting the kernel or as an option
23+
to insmod when loading the ntfs module. Once the driver is active,
24+
you can enable debugging messages by doing (as root):
25+
echo 1 > /proc/sys/fs/ntfs-debug
26+
Replacing the "1" with "0" would disable debug messages.
27+
28+
If you leave debugging messages disabled, this results in little
29+
overhead, but enabling debug messages results in very significant
30+
slowdown of the system.
31+
32+
When reporting bugs, please try to have available a full dump of
33+
debugging messages while the misbehaviour was occurring.
34+
35+
config NTFS_FS_POSIX_ACL
36+
bool "NTFS POSIX Access Control Lists"
37+
depends on NTFS_FS
38+
select FS_POSIX_ACL
39+
help
40+
POSIX Access Control Lists (ACLs) support additional access rights
41+
for users and groups beyond the standard owner/group/world scheme.
42+
43+
This option enables ACL support for ntfs, providing functional parity
44+
with ntfs3 drivier.
45+
46+
NOTE: this is linux only feature. Windows will ignore these ACLs.
47+
48+
If you don't know what Access Control Lists are, say N.

fs/ntfs/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
3+
obj-$(CONFIG_NTFS_FS) += ntfs.o
4+
5+
ntfs-y := aops.o attrib.o collate.o dir.o file.o index.o inode.o \
6+
mft.o mst.o namei.o runlist.o super.o unistr.o attrlist.o ea.o \
7+
upcase.o bitmap.o lcnalloc.o logfile.o reparse.o compress.o \
8+
iomap.o debug.o sysctl.o quota.o object_id.o bdev-io.o
9+
10+
ccflags-$(CONFIG_NTFS_DEBUG) += -DDEBUG

0 commit comments

Comments
 (0)