[PATCH v3 12/14] Revert: ntfs3: serve as alias for the legacy ntfs driver

Namjae Jeon posted 12 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH v3 12/14] Revert: ntfs3: serve as alias for the legacy ntfs driver
Posted by Namjae Jeon 1 month, 1 week ago
ntfs filesystem has been remade and is returning as a new implementation.
ntfs3 no longer needs to be an alias for ntfs.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
 fs/ntfs3/Kconfig   |  9 --------
 fs/ntfs3/dir.c     |  9 --------
 fs/ntfs3/file.c    | 10 ---------
 fs/ntfs3/inode.c   | 16 ++++----------
 fs/ntfs3/ntfs_fs.h | 11 ----------
 fs/ntfs3/super.c   | 52 ----------------------------------------------
 6 files changed, 4 insertions(+), 103 deletions(-)

diff --git a/fs/ntfs3/Kconfig b/fs/ntfs3/Kconfig
index 7bc31d69f680..cdfdf51e55d7 100644
--- a/fs/ntfs3/Kconfig
+++ b/fs/ntfs3/Kconfig
@@ -46,12 +46,3 @@ config NTFS3_FS_POSIX_ACL
 	  NOTE: this is linux only feature. Windows will ignore these ACLs.
 
 	  If you don't know what Access Control Lists are, say N.
-
-config NTFS_FS
-	tristate "NTFS file system support"
-	select NTFS3_FS
-	select BUFFER_HEAD
-	select NLS
-	help
-	  This config option is here only for backward compatibility. NTFS
-	  filesystem is now handled by the NTFS3 driver.
diff --git a/fs/ntfs3/dir.c b/fs/ntfs3/dir.c
index b98e95d6b4d9..fc39e7330365 100644
--- a/fs/ntfs3/dir.c
+++ b/fs/ntfs3/dir.c
@@ -631,13 +631,4 @@ const struct file_operations ntfs_dir_operations = {
 	.compat_ioctl   = ntfs_compat_ioctl,
 #endif
 };
-
-#if IS_ENABLED(CONFIG_NTFS_FS)
-const struct file_operations ntfs_legacy_dir_operations = {
-	.llseek		= generic_file_llseek,
-	.read		= generic_read_dir,
-	.iterate_shared	= ntfs_readdir,
-	.open		= ntfs_file_open,
-};
-#endif
 // clang-format on
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index 2e7b2e566ebe..0faa856fc470 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -1478,14 +1478,4 @@ const struct file_operations ntfs_file_operations = {
 	.fallocate	= ntfs_fallocate,
 	.release	= ntfs_file_release,
 };
-
-#if IS_ENABLED(CONFIG_NTFS_FS)
-const struct file_operations ntfs_legacy_file_operations = {
-	.llseek		= generic_file_llseek,
-	.read_iter	= ntfs_file_read_iter,
-	.splice_read	= ntfs_file_splice_read,
-	.open		= ntfs_file_open,
-	.release	= ntfs_file_release,
-};
-#endif
 // clang-format on
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index 0a9ac5efeb67..826840c257d3 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -444,9 +444,7 @@ static struct inode *ntfs_read_mft(struct inode *inode,
 		 * Usually a hard links to directories are disabled.
 		 */
 		inode->i_op = &ntfs_dir_inode_operations;
-		inode->i_fop = unlikely(is_legacy_ntfs(sb)) ?
-				       &ntfs_legacy_dir_operations :
-				       &ntfs_dir_operations;
+		inode->i_fop = &ntfs_dir_operations;
 		ni->i_valid = 0;
 	} else if (S_ISLNK(mode)) {
 		ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY;
@@ -456,9 +454,7 @@ static struct inode *ntfs_read_mft(struct inode *inode,
 	} else if (S_ISREG(mode)) {
 		ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY;
 		inode->i_op = &ntfs_file_inode_operations;
-		inode->i_fop = unlikely(is_legacy_ntfs(sb)) ?
-				       &ntfs_legacy_file_operations :
-				       &ntfs_file_operations;
+		inode->i_fop = &ntfs_file_operations;
 		inode->i_mapping->a_ops = is_compressed(ni) ? &ntfs_aops_cmpr :
 							      &ntfs_aops;
 		if (ino != MFT_REC_MFT)
@@ -1590,9 +1586,7 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
 
 	if (S_ISDIR(mode)) {
 		inode->i_op = &ntfs_dir_inode_operations;
-		inode->i_fop = unlikely(is_legacy_ntfs(sb)) ?
-				       &ntfs_legacy_dir_operations :
-				       &ntfs_dir_operations;
+		inode->i_fop = &ntfs_dir_operations;
 	} else if (S_ISLNK(mode)) {
 		inode->i_op = &ntfs_link_inode_operations;
 		inode->i_fop = NULL;
@@ -1601,9 +1595,7 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
 		inode_nohighmem(inode);
 	} else if (S_ISREG(mode)) {
 		inode->i_op = &ntfs_file_inode_operations;
-		inode->i_fop = unlikely(is_legacy_ntfs(sb)) ?
-				       &ntfs_legacy_file_operations :
-				       &ntfs_file_operations;
+		inode->i_fop = &ntfs_file_operations;
 		inode->i_mapping->a_ops = is_compressed(ni) ? &ntfs_aops_cmpr :
 							      &ntfs_aops;
 		init_rwsem(&ni->file.run_lock);
diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
index a4559c9f64e6..326644d23110 100644
--- a/fs/ntfs3/ntfs_fs.h
+++ b/fs/ntfs3/ntfs_fs.h
@@ -501,7 +501,6 @@ struct inode *dir_search_u(struct inode *dir, const struct cpu_str *uni,
 			   struct ntfs_fnd *fnd);
 bool dir_is_empty(struct inode *dir);
 extern const struct file_operations ntfs_dir_operations;
-extern const struct file_operations ntfs_legacy_dir_operations;
 
 /* Globals from file.c */
 int ntfs_getattr(struct mnt_idmap *idmap, const struct path *path,
@@ -516,7 +515,6 @@ long ntfs_compat_ioctl(struct file *filp, u32 cmd, unsigned long arg);
 extern const struct inode_operations ntfs_special_inode_operations;
 extern const struct inode_operations ntfs_file_inode_operations;
 extern const struct file_operations ntfs_file_operations;
-extern const struct file_operations ntfs_legacy_file_operations;
 
 /* Globals from frecord.c */
 void ni_remove_mi(struct ntfs_inode *ni, struct mft_inode *mi);
@@ -1160,13 +1158,4 @@ static inline void le64_sub_cpu(__le64 *var, u64 val)
 	*var = cpu_to_le64(le64_to_cpu(*var) - val);
 }
 
-#if IS_ENABLED(CONFIG_NTFS_FS)
-bool is_legacy_ntfs(struct super_block *sb);
-#else
-static inline bool is_legacy_ntfs(struct super_block *sb)
-{
-	return false;
-}
-#endif
-
 #endif /* _LINUX_NTFS3_NTFS_FS_H */
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 8b0cf0ed4f72..d6fd14c191a9 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -415,12 +415,6 @@ static int ntfs_fs_reconfigure(struct fs_context *fc)
 	struct ntfs_mount_options *new_opts = fc->fs_private;
 	int ro_rw;
 
-	/* If ntfs3 is used as legacy ntfs enforce read-only mode. */
-	if (is_legacy_ntfs(sb)) {
-		fc->sb_flags |= SB_RDONLY;
-		goto out;
-	}
-
 	ro_rw = sb_rdonly(sb) && !(fc->sb_flags & SB_RDONLY);
 	if (ro_rw && (sbi->flags & NTFS_FLAGS_NEED_REPLAY)) {
 		errorf(fc,
@@ -447,7 +441,6 @@ static int ntfs_fs_reconfigure(struct fs_context *fc)
 		return -EINVAL;
 	}
 
-out:
 	sync_filesystem(sb);
 	swap(sbi->options, fc->fs_private);
 
@@ -1670,8 +1663,6 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
 
 	ntfs_create_procdir(sb);
 
-	if (is_legacy_ntfs(sb))
-		sb->s_flags |= SB_RDONLY;
 	return 0;
 
 put_inode_out:
@@ -1876,47 +1867,6 @@ static struct file_system_type ntfs_fs_type = {
 	.fs_flags		= FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
 };
 
-#if IS_ENABLED(CONFIG_NTFS_FS)
-static int ntfs_legacy_init_fs_context(struct fs_context *fc)
-{
-	int ret;
-
-	ret = __ntfs_init_fs_context(fc);
-	/* If ntfs3 is used as legacy ntfs enforce read-only mode. */
-	fc->sb_flags |= SB_RDONLY;
-	return ret;
-}
-
-static struct file_system_type ntfs_legacy_fs_type = {
-	.owner			= THIS_MODULE,
-	.name			= "ntfs",
-	.init_fs_context	= ntfs_legacy_init_fs_context,
-	.parameters		= ntfs_fs_parameters,
-	.kill_sb		= ntfs3_kill_sb,
-	.fs_flags		= FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
-};
-MODULE_ALIAS_FS("ntfs");
-
-static inline void register_as_ntfs_legacy(void)
-{
-	int err = register_filesystem(&ntfs_legacy_fs_type);
-	if (err)
-		pr_warn("ntfs3: Failed to register legacy ntfs filesystem driver: %d\n", err);
-}
-
-static inline void unregister_as_ntfs_legacy(void)
-{
-	unregister_filesystem(&ntfs_legacy_fs_type);
-}
-bool is_legacy_ntfs(struct super_block *sb)
-{
-	return sb->s_type == &ntfs_legacy_fs_type;
-}
-#else
-static inline void register_as_ntfs_legacy(void) {}
-static inline void unregister_as_ntfs_legacy(void) {}
-#endif
-
 // clang-format on
 
 static int __init init_ntfs_fs(void)
@@ -1945,7 +1895,6 @@ static int __init init_ntfs_fs(void)
 		goto out1;
 	}
 
-	register_as_ntfs_legacy();
 	err = register_filesystem(&ntfs_fs_type);
 	if (err)
 		goto out;
@@ -1965,7 +1914,6 @@ static void __exit exit_ntfs_fs(void)
 	rcu_barrier();
 	kmem_cache_destroy(ntfs_inode_cachep);
 	unregister_filesystem(&ntfs_fs_type);
-	unregister_as_ntfs_legacy();
 	ntfs3_exit_bitmap();
 	ntfs_remove_proc_root();
 }
-- 
2.25.1
Re: [PATCH v3 12/14] Revert: ntfs3: serve as alias for the legacy ntfs driver
Posted by Matthew Wilcox 1 month, 1 week ago
On Mon, Dec 29, 2025 at 07:59:30PM +0900, Namjae Jeon wrote:
> ntfs filesystem has been remade and is returning as a new implementation.
> ntfs3 no longer needs to be an alias for ntfs.

I don't think this is right.  If one has selected ntfs3 as built-in
then one still needs pieces of this to handle classic ntfs
configurations, no?
Re: [PATCH v3 12/14] Revert: ntfs3: serve as alias for the legacy ntfs driver
Posted by Namjae Jeon 1 month, 1 week ago
On Tue, Dec 30, 2025 at 1:41 AM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Mon, Dec 29, 2025 at 07:59:30PM +0900, Namjae Jeon wrote:
> > ntfs filesystem has been remade and is returning as a new implementation.
> > ntfs3 no longer needs to be an alias for ntfs.
>
> I don't think this is right.  If one has selected ntfs3 as built-in
> then one still needs pieces of this to handle classic ntfs
> configurations, no?
ntfsplus has been renamed to ntfs as you requested. Wouldn't it be
confusing for users if they probably expect the new read-write
implementation to be used, but instead the read-only path from ntfs3
could be triggered ?
Re: [PATCH v3 12/14] Revert: ntfs3: serve as alias for the legacy ntfs driver
Posted by Namjae Jeon 1 month, 1 week ago
On Tue, Dec 30, 2025 at 9:03 AM Namjae Jeon <linkinjeon@kernel.org> wrote:
>
> On Tue, Dec 30, 2025 at 1:41 AM Matthew Wilcox <willy@infradead.org> wrote:
> >
> > On Mon, Dec 29, 2025 at 07:59:30PM +0900, Namjae Jeon wrote:
> > > ntfs filesystem has been remade and is returning as a new implementation.
> > > ntfs3 no longer needs to be an alias for ntfs.
> >
> > I don't think this is right.  If one has selected ntfs3 as built-in
> > then one still needs pieces of this to handle classic ntfs
> > configurations, no?
> ntfsplus has been renamed to ntfs as you requested. Wouldn't it be
> confusing for users if they probably expect the new read-write
> implementation to be used, but instead the read-only path from ntfs3
> could be triggered ?
And, if ntfs3 is built-in or already insmoded, they can not be used
simultaneously because ntfs.ko cannot be insmoded.
Re: [PATCH v3 12/14] Revert: ntfs3: serve as alias for the legacy ntfs driver
Posted by Amir Goldstein 1 month, 1 week ago
On Mon, Dec 29, 2025 at 1:02 PM Namjae Jeon <linkinjeon@kernel.org> wrote:
>
> ntfs filesystem has been remade and is returning as a new implementation.
> ntfs3 no longer needs to be an alias for ntfs.

This is not a clear revert of
74871791ffa95 ntfs3: serve as alias for the legacy ntfs driver

So what is it? please include the description in the commit message.

Thanks,
Amir.

>
> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
> ---
>  fs/ntfs3/Kconfig   |  9 --------
>  fs/ntfs3/dir.c     |  9 --------
>  fs/ntfs3/file.c    | 10 ---------
>  fs/ntfs3/inode.c   | 16 ++++----------
>  fs/ntfs3/ntfs_fs.h | 11 ----------
>  fs/ntfs3/super.c   | 52 ----------------------------------------------
>  6 files changed, 4 insertions(+), 103 deletions(-)
>
> diff --git a/fs/ntfs3/Kconfig b/fs/ntfs3/Kconfig
> index 7bc31d69f680..cdfdf51e55d7 100644
> --- a/fs/ntfs3/Kconfig
> +++ b/fs/ntfs3/Kconfig
> @@ -46,12 +46,3 @@ config NTFS3_FS_POSIX_ACL
>           NOTE: this is linux only feature. Windows will ignore these ACLs.
>
>           If you don't know what Access Control Lists are, say N.
> -
> -config NTFS_FS
> -       tristate "NTFS file system support"
> -       select NTFS3_FS
> -       select BUFFER_HEAD
> -       select NLS
> -       help
> -         This config option is here only for backward compatibility. NTFS
> -         filesystem is now handled by the NTFS3 driver.
> diff --git a/fs/ntfs3/dir.c b/fs/ntfs3/dir.c
> index b98e95d6b4d9..fc39e7330365 100644
> --- a/fs/ntfs3/dir.c
> +++ b/fs/ntfs3/dir.c
> @@ -631,13 +631,4 @@ const struct file_operations ntfs_dir_operations = {
>         .compat_ioctl   = ntfs_compat_ioctl,
>  #endif
>  };
> -
> -#if IS_ENABLED(CONFIG_NTFS_FS)
> -const struct file_operations ntfs_legacy_dir_operations = {
> -       .llseek         = generic_file_llseek,
> -       .read           = generic_read_dir,
> -       .iterate_shared = ntfs_readdir,
> -       .open           = ntfs_file_open,
> -};
> -#endif
>  // clang-format on
> diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
> index 2e7b2e566ebe..0faa856fc470 100644
> --- a/fs/ntfs3/file.c
> +++ b/fs/ntfs3/file.c
> @@ -1478,14 +1478,4 @@ const struct file_operations ntfs_file_operations = {
>         .fallocate      = ntfs_fallocate,
>         .release        = ntfs_file_release,
>  };
> -
> -#if IS_ENABLED(CONFIG_NTFS_FS)
> -const struct file_operations ntfs_legacy_file_operations = {
> -       .llseek         = generic_file_llseek,
> -       .read_iter      = ntfs_file_read_iter,
> -       .splice_read    = ntfs_file_splice_read,
> -       .open           = ntfs_file_open,
> -       .release        = ntfs_file_release,
> -};
> -#endif
>  // clang-format on
> diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
> index 0a9ac5efeb67..826840c257d3 100644
> --- a/fs/ntfs3/inode.c
> +++ b/fs/ntfs3/inode.c
> @@ -444,9 +444,7 @@ static struct inode *ntfs_read_mft(struct inode *inode,
>                  * Usually a hard links to directories are disabled.
>                  */
>                 inode->i_op = &ntfs_dir_inode_operations;
> -               inode->i_fop = unlikely(is_legacy_ntfs(sb)) ?
> -                                      &ntfs_legacy_dir_operations :
> -                                      &ntfs_dir_operations;
> +               inode->i_fop = &ntfs_dir_operations;
>                 ni->i_valid = 0;
>         } else if (S_ISLNK(mode)) {
>                 ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY;
> @@ -456,9 +454,7 @@ static struct inode *ntfs_read_mft(struct inode *inode,
>         } else if (S_ISREG(mode)) {
>                 ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY;
>                 inode->i_op = &ntfs_file_inode_operations;
> -               inode->i_fop = unlikely(is_legacy_ntfs(sb)) ?
> -                                      &ntfs_legacy_file_operations :
> -                                      &ntfs_file_operations;
> +               inode->i_fop = &ntfs_file_operations;
>                 inode->i_mapping->a_ops = is_compressed(ni) ? &ntfs_aops_cmpr :
>                                                               &ntfs_aops;
>                 if (ino != MFT_REC_MFT)
> @@ -1590,9 +1586,7 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
>
>         if (S_ISDIR(mode)) {
>                 inode->i_op = &ntfs_dir_inode_operations;
> -               inode->i_fop = unlikely(is_legacy_ntfs(sb)) ?
> -                                      &ntfs_legacy_dir_operations :
> -                                      &ntfs_dir_operations;
> +               inode->i_fop = &ntfs_dir_operations;
>         } else if (S_ISLNK(mode)) {
>                 inode->i_op = &ntfs_link_inode_operations;
>                 inode->i_fop = NULL;
> @@ -1601,9 +1595,7 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
>                 inode_nohighmem(inode);
>         } else if (S_ISREG(mode)) {
>                 inode->i_op = &ntfs_file_inode_operations;
> -               inode->i_fop = unlikely(is_legacy_ntfs(sb)) ?
> -                                      &ntfs_legacy_file_operations :
> -                                      &ntfs_file_operations;
> +               inode->i_fop = &ntfs_file_operations;
>                 inode->i_mapping->a_ops = is_compressed(ni) ? &ntfs_aops_cmpr :
>                                                               &ntfs_aops;
>                 init_rwsem(&ni->file.run_lock);
> diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
> index a4559c9f64e6..326644d23110 100644
> --- a/fs/ntfs3/ntfs_fs.h
> +++ b/fs/ntfs3/ntfs_fs.h
> @@ -501,7 +501,6 @@ struct inode *dir_search_u(struct inode *dir, const struct cpu_str *uni,
>                            struct ntfs_fnd *fnd);
>  bool dir_is_empty(struct inode *dir);
>  extern const struct file_operations ntfs_dir_operations;
> -extern const struct file_operations ntfs_legacy_dir_operations;
>
>  /* Globals from file.c */
>  int ntfs_getattr(struct mnt_idmap *idmap, const struct path *path,
> @@ -516,7 +515,6 @@ long ntfs_compat_ioctl(struct file *filp, u32 cmd, unsigned long arg);
>  extern const struct inode_operations ntfs_special_inode_operations;
>  extern const struct inode_operations ntfs_file_inode_operations;
>  extern const struct file_operations ntfs_file_operations;
> -extern const struct file_operations ntfs_legacy_file_operations;
>
>  /* Globals from frecord.c */
>  void ni_remove_mi(struct ntfs_inode *ni, struct mft_inode *mi);
> @@ -1160,13 +1158,4 @@ static inline void le64_sub_cpu(__le64 *var, u64 val)
>         *var = cpu_to_le64(le64_to_cpu(*var) - val);
>  }
>
> -#if IS_ENABLED(CONFIG_NTFS_FS)
> -bool is_legacy_ntfs(struct super_block *sb);
> -#else
> -static inline bool is_legacy_ntfs(struct super_block *sb)
> -{
> -       return false;
> -}
> -#endif
> -
>  #endif /* _LINUX_NTFS3_NTFS_FS_H */
> diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
> index 8b0cf0ed4f72..d6fd14c191a9 100644
> --- a/fs/ntfs3/super.c
> +++ b/fs/ntfs3/super.c
> @@ -415,12 +415,6 @@ static int ntfs_fs_reconfigure(struct fs_context *fc)
>         struct ntfs_mount_options *new_opts = fc->fs_private;
>         int ro_rw;
>
> -       /* If ntfs3 is used as legacy ntfs enforce read-only mode. */
> -       if (is_legacy_ntfs(sb)) {
> -               fc->sb_flags |= SB_RDONLY;
> -               goto out;
> -       }
> -
>         ro_rw = sb_rdonly(sb) && !(fc->sb_flags & SB_RDONLY);
>         if (ro_rw && (sbi->flags & NTFS_FLAGS_NEED_REPLAY)) {
>                 errorf(fc,
> @@ -447,7 +441,6 @@ static int ntfs_fs_reconfigure(struct fs_context *fc)
>                 return -EINVAL;
>         }
>
> -out:
>         sync_filesystem(sb);
>         swap(sbi->options, fc->fs_private);
>
> @@ -1670,8 +1663,6 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
>
>         ntfs_create_procdir(sb);
>
> -       if (is_legacy_ntfs(sb))
> -               sb->s_flags |= SB_RDONLY;
>         return 0;
>
>  put_inode_out:
> @@ -1876,47 +1867,6 @@ static struct file_system_type ntfs_fs_type = {
>         .fs_flags               = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
>  };
>
> -#if IS_ENABLED(CONFIG_NTFS_FS)
> -static int ntfs_legacy_init_fs_context(struct fs_context *fc)
> -{
> -       int ret;
> -
> -       ret = __ntfs_init_fs_context(fc);
> -       /* If ntfs3 is used as legacy ntfs enforce read-only mode. */
> -       fc->sb_flags |= SB_RDONLY;
> -       return ret;
> -}
> -
> -static struct file_system_type ntfs_legacy_fs_type = {
> -       .owner                  = THIS_MODULE,
> -       .name                   = "ntfs",
> -       .init_fs_context        = ntfs_legacy_init_fs_context,
> -       .parameters             = ntfs_fs_parameters,
> -       .kill_sb                = ntfs3_kill_sb,
> -       .fs_flags               = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
> -};
> -MODULE_ALIAS_FS("ntfs");
> -
> -static inline void register_as_ntfs_legacy(void)
> -{
> -       int err = register_filesystem(&ntfs_legacy_fs_type);
> -       if (err)
> -               pr_warn("ntfs3: Failed to register legacy ntfs filesystem driver: %d\n", err);
> -}
> -
> -static inline void unregister_as_ntfs_legacy(void)
> -{
> -       unregister_filesystem(&ntfs_legacy_fs_type);
> -}
> -bool is_legacy_ntfs(struct super_block *sb)
> -{
> -       return sb->s_type == &ntfs_legacy_fs_type;
> -}
> -#else
> -static inline void register_as_ntfs_legacy(void) {}
> -static inline void unregister_as_ntfs_legacy(void) {}
> -#endif
> -
>  // clang-format on
>
>  static int __init init_ntfs_fs(void)
> @@ -1945,7 +1895,6 @@ static int __init init_ntfs_fs(void)
>                 goto out1;
>         }
>
> -       register_as_ntfs_legacy();
>         err = register_filesystem(&ntfs_fs_type);
>         if (err)
>                 goto out;
> @@ -1965,7 +1914,6 @@ static void __exit exit_ntfs_fs(void)
>         rcu_barrier();
>         kmem_cache_destroy(ntfs_inode_cachep);
>         unregister_filesystem(&ntfs_fs_type);
> -       unregister_as_ntfs_legacy();
>         ntfs3_exit_bitmap();
>         ntfs_remove_proc_root();
>  }
> --
> 2.25.1
>
Re: [PATCH v3 12/14] Revert: ntfs3: serve as alias for the legacy ntfs driver
Posted by Namjae Jeon 1 month, 1 week ago
On Tue, Dec 30, 2025 at 12:55 AM Amir Goldstein <amir73il@gmail.com> wrote:
>
> On Mon, Dec 29, 2025 at 1:02 PM Namjae Jeon <linkinjeon@kernel.org> wrote:
> >
> > ntfs filesystem has been remade and is returning as a new implementation.
> > ntfs3 no longer needs to be an alias for ntfs.
>
> This is not a clear revert of
> 74871791ffa95 ntfs3: serve as alias for the legacy ntfs driver
Three other ntfs-related patches also needed to be reverted.

1ff2e956608c fs/ntfs3: Redesign legacy ntfs support
9b872cc50daa ntfs3: add legacy ntfs file operations
d55f90e9b243 ntfs3: enforce read-only when used as legacy ntfs driver

I wanted to remove ntfs legacy codes all at once.
>
> So what is it? please include the description in the commit message.
Okay, I will do that.
Thanks!
>
> Thanks,
> Amir.
>
> >
> > Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
> > ---
> >  fs/ntfs3/Kconfig   |  9 --------
> >  fs/ntfs3/dir.c     |  9 --------
> >  fs/ntfs3/file.c    | 10 ---------
> >  fs/ntfs3/inode.c   | 16 ++++----------
> >  fs/ntfs3/ntfs_fs.h | 11 ----------
> >  fs/ntfs3/super.c   | 52 ----------------------------------------------
> >  6 files changed, 4 insertions(+), 103 deletions(-)
> >
> > diff --git a/fs/ntfs3/Kconfig b/fs/ntfs3/Kconfig
> > index 7bc31d69f680..cdfdf51e55d7 100644
> > --- a/fs/ntfs3/Kconfig
> > +++ b/fs/ntfs3/Kconfig
> > @@ -46,12 +46,3 @@ config NTFS3_FS_POSIX_ACL
> >           NOTE: this is linux only feature. Windows will ignore these ACLs.
> >
> >           If you don't know what Access Control Lists are, say N.
> > -
> > -config NTFS_FS
> > -       tristate "NTFS file system support"
> > -       select NTFS3_FS
> > -       select BUFFER_HEAD
> > -       select NLS
> > -       help
> > -         This config option is here only for backward compatibility. NTFS
> > -         filesystem is now handled by the NTFS3 driver.
> > diff --git a/fs/ntfs3/dir.c b/fs/ntfs3/dir.c
> > index b98e95d6b4d9..fc39e7330365 100644
> > --- a/fs/ntfs3/dir.c
> > +++ b/fs/ntfs3/dir.c
> > @@ -631,13 +631,4 @@ const struct file_operations ntfs_dir_operations = {
> >         .compat_ioctl   = ntfs_compat_ioctl,
> >  #endif
> >  };
> > -
> > -#if IS_ENABLED(CONFIG_NTFS_FS)
> > -const struct file_operations ntfs_legacy_dir_operations = {
> > -       .llseek         = generic_file_llseek,
> > -       .read           = generic_read_dir,
> > -       .iterate_shared = ntfs_readdir,
> > -       .open           = ntfs_file_open,
> > -};
> > -#endif
> >  // clang-format on
> > diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
> > index 2e7b2e566ebe..0faa856fc470 100644
> > --- a/fs/ntfs3/file.c
> > +++ b/fs/ntfs3/file.c
> > @@ -1478,14 +1478,4 @@ const struct file_operations ntfs_file_operations = {
> >         .fallocate      = ntfs_fallocate,
> >         .release        = ntfs_file_release,
> >  };
> > -
> > -#if IS_ENABLED(CONFIG_NTFS_FS)
> > -const struct file_operations ntfs_legacy_file_operations = {
> > -       .llseek         = generic_file_llseek,
> > -       .read_iter      = ntfs_file_read_iter,
> > -       .splice_read    = ntfs_file_splice_read,
> > -       .open           = ntfs_file_open,
> > -       .release        = ntfs_file_release,
> > -};
> > -#endif
> >  // clang-format on
> > diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
> > index 0a9ac5efeb67..826840c257d3 100644
> > --- a/fs/ntfs3/inode.c
> > +++ b/fs/ntfs3/inode.c
> > @@ -444,9 +444,7 @@ static struct inode *ntfs_read_mft(struct inode *inode,
> >                  * Usually a hard links to directories are disabled.
> >                  */
> >                 inode->i_op = &ntfs_dir_inode_operations;
> > -               inode->i_fop = unlikely(is_legacy_ntfs(sb)) ?
> > -                                      &ntfs_legacy_dir_operations :
> > -                                      &ntfs_dir_operations;
> > +               inode->i_fop = &ntfs_dir_operations;
> >                 ni->i_valid = 0;
> >         } else if (S_ISLNK(mode)) {
> >                 ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY;
> > @@ -456,9 +454,7 @@ static struct inode *ntfs_read_mft(struct inode *inode,
> >         } else if (S_ISREG(mode)) {
> >                 ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY;
> >                 inode->i_op = &ntfs_file_inode_operations;
> > -               inode->i_fop = unlikely(is_legacy_ntfs(sb)) ?
> > -                                      &ntfs_legacy_file_operations :
> > -                                      &ntfs_file_operations;
> > +               inode->i_fop = &ntfs_file_operations;
> >                 inode->i_mapping->a_ops = is_compressed(ni) ? &ntfs_aops_cmpr :
> >                                                               &ntfs_aops;
> >                 if (ino != MFT_REC_MFT)
> > @@ -1590,9 +1586,7 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
> >
> >         if (S_ISDIR(mode)) {
> >                 inode->i_op = &ntfs_dir_inode_operations;
> > -               inode->i_fop = unlikely(is_legacy_ntfs(sb)) ?
> > -                                      &ntfs_legacy_dir_operations :
> > -                                      &ntfs_dir_operations;
> > +               inode->i_fop = &ntfs_dir_operations;
> >         } else if (S_ISLNK(mode)) {
> >                 inode->i_op = &ntfs_link_inode_operations;
> >                 inode->i_fop = NULL;
> > @@ -1601,9 +1595,7 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
> >                 inode_nohighmem(inode);
> >         } else if (S_ISREG(mode)) {
> >                 inode->i_op = &ntfs_file_inode_operations;
> > -               inode->i_fop = unlikely(is_legacy_ntfs(sb)) ?
> > -                                      &ntfs_legacy_file_operations :
> > -                                      &ntfs_file_operations;
> > +               inode->i_fop = &ntfs_file_operations;
> >                 inode->i_mapping->a_ops = is_compressed(ni) ? &ntfs_aops_cmpr :
> >                                                               &ntfs_aops;
> >                 init_rwsem(&ni->file.run_lock);
> > diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
> > index a4559c9f64e6..326644d23110 100644
> > --- a/fs/ntfs3/ntfs_fs.h
> > +++ b/fs/ntfs3/ntfs_fs.h
> > @@ -501,7 +501,6 @@ struct inode *dir_search_u(struct inode *dir, const struct cpu_str *uni,
> >                            struct ntfs_fnd *fnd);
> >  bool dir_is_empty(struct inode *dir);
> >  extern const struct file_operations ntfs_dir_operations;
> > -extern const struct file_operations ntfs_legacy_dir_operations;
> >
> >  /* Globals from file.c */
> >  int ntfs_getattr(struct mnt_idmap *idmap, const struct path *path,
> > @@ -516,7 +515,6 @@ long ntfs_compat_ioctl(struct file *filp, u32 cmd, unsigned long arg);
> >  extern const struct inode_operations ntfs_special_inode_operations;
> >  extern const struct inode_operations ntfs_file_inode_operations;
> >  extern const struct file_operations ntfs_file_operations;
> > -extern const struct file_operations ntfs_legacy_file_operations;
> >
> >  /* Globals from frecord.c */
> >  void ni_remove_mi(struct ntfs_inode *ni, struct mft_inode *mi);
> > @@ -1160,13 +1158,4 @@ static inline void le64_sub_cpu(__le64 *var, u64 val)
> >         *var = cpu_to_le64(le64_to_cpu(*var) - val);
> >  }
> >
> > -#if IS_ENABLED(CONFIG_NTFS_FS)
> > -bool is_legacy_ntfs(struct super_block *sb);
> > -#else
> > -static inline bool is_legacy_ntfs(struct super_block *sb)
> > -{
> > -       return false;
> > -}
> > -#endif
> > -
> >  #endif /* _LINUX_NTFS3_NTFS_FS_H */
> > diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
> > index 8b0cf0ed4f72..d6fd14c191a9 100644
> > --- a/fs/ntfs3/super.c
> > +++ b/fs/ntfs3/super.c
> > @@ -415,12 +415,6 @@ static int ntfs_fs_reconfigure(struct fs_context *fc)
> >         struct ntfs_mount_options *new_opts = fc->fs_private;
> >         int ro_rw;
> >
> > -       /* If ntfs3 is used as legacy ntfs enforce read-only mode. */
> > -       if (is_legacy_ntfs(sb)) {
> > -               fc->sb_flags |= SB_RDONLY;
> > -               goto out;
> > -       }
> > -
> >         ro_rw = sb_rdonly(sb) && !(fc->sb_flags & SB_RDONLY);
> >         if (ro_rw && (sbi->flags & NTFS_FLAGS_NEED_REPLAY)) {
> >                 errorf(fc,
> > @@ -447,7 +441,6 @@ static int ntfs_fs_reconfigure(struct fs_context *fc)
> >                 return -EINVAL;
> >         }
> >
> > -out:
> >         sync_filesystem(sb);
> >         swap(sbi->options, fc->fs_private);
> >
> > @@ -1670,8 +1663,6 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
> >
> >         ntfs_create_procdir(sb);
> >
> > -       if (is_legacy_ntfs(sb))
> > -               sb->s_flags |= SB_RDONLY;
> >         return 0;
> >
> >  put_inode_out:
> > @@ -1876,47 +1867,6 @@ static struct file_system_type ntfs_fs_type = {
> >         .fs_flags               = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
> >  };
> >
> > -#if IS_ENABLED(CONFIG_NTFS_FS)
> > -static int ntfs_legacy_init_fs_context(struct fs_context *fc)
> > -{
> > -       int ret;
> > -
> > -       ret = __ntfs_init_fs_context(fc);
> > -       /* If ntfs3 is used as legacy ntfs enforce read-only mode. */
> > -       fc->sb_flags |= SB_RDONLY;
> > -       return ret;
> > -}
> > -
> > -static struct file_system_type ntfs_legacy_fs_type = {
> > -       .owner                  = THIS_MODULE,
> > -       .name                   = "ntfs",
> > -       .init_fs_context        = ntfs_legacy_init_fs_context,
> > -       .parameters             = ntfs_fs_parameters,
> > -       .kill_sb                = ntfs3_kill_sb,
> > -       .fs_flags               = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
> > -};
> > -MODULE_ALIAS_FS("ntfs");
> > -
> > -static inline void register_as_ntfs_legacy(void)
> > -{
> > -       int err = register_filesystem(&ntfs_legacy_fs_type);
> > -       if (err)
> > -               pr_warn("ntfs3: Failed to register legacy ntfs filesystem driver: %d\n", err);
> > -}
> > -
> > -static inline void unregister_as_ntfs_legacy(void)
> > -{
> > -       unregister_filesystem(&ntfs_legacy_fs_type);
> > -}
> > -bool is_legacy_ntfs(struct super_block *sb)
> > -{
> > -       return sb->s_type == &ntfs_legacy_fs_type;
> > -}
> > -#else
> > -static inline void register_as_ntfs_legacy(void) {}
> > -static inline void unregister_as_ntfs_legacy(void) {}
> > -#endif
> > -
> >  // clang-format on
> >
> >  static int __init init_ntfs_fs(void)
> > @@ -1945,7 +1895,6 @@ static int __init init_ntfs_fs(void)
> >                 goto out1;
> >         }
> >
> > -       register_as_ntfs_legacy();
> >         err = register_filesystem(&ntfs_fs_type);
> >         if (err)
> >                 goto out;
> > @@ -1965,7 +1914,6 @@ static void __exit exit_ntfs_fs(void)
> >         rcu_barrier();
> >         kmem_cache_destroy(ntfs_inode_cachep);
> >         unregister_filesystem(&ntfs_fs_type);
> > -       unregister_as_ntfs_legacy();
> >         ntfs3_exit_bitmap();
> >         ntfs_remove_proc_root();
> >  }
> > --
> > 2.25.1
> >