Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ntfs3: remove legacy ntfs driver support

Reverts the following commits that introduced legacy ntfs
driver alias and related support code:

74871791ffa9 ntfs3: serve as alias for the legacy ntfs driver
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

The legacy ntfs driver has been remade as a new implementation, so the
alias and related codes in ntfs3 are no longer needed.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>

+5 -111
-9
fs/ntfs3/Kconfig
··· 46 46 NOTE: this is linux only feature. Windows will ignore these ACLs. 47 47 48 48 If you don't know what Access Control Lists are, say N. 49 - 50 - config NTFS_FS 51 - tristate "NTFS file system support" 52 - select NTFS3_FS 53 - select BUFFER_HEAD 54 - select NLS 55 - help 56 - This config option is here only for backward compatibility. NTFS 57 - filesystem is now handled by the NTFS3 driver.
-10
fs/ntfs3/dir.c
··· 676 676 #endif 677 677 .setlease = generic_setlease, 678 678 }; 679 - 680 - #if IS_ENABLED(CONFIG_NTFS_FS) 681 - const struct file_operations ntfs_legacy_dir_operations = { 682 - .llseek = generic_file_llseek, 683 - .read = generic_read_dir, 684 - .iterate_shared = ntfs_readdir, 685 - .open = ntfs_file_open, 686 - .setlease = generic_setlease, 687 - }; 688 - #endif 689 679 // clang-format on
-11
fs/ntfs3/file.c
··· 1569 1569 .release = ntfs_file_release, 1570 1570 .setlease = generic_setlease, 1571 1571 }; 1572 - 1573 - #if IS_ENABLED(CONFIG_NTFS_FS) 1574 - const struct file_operations ntfs_legacy_file_operations = { 1575 - .llseek = generic_file_llseek, 1576 - .read_iter = ntfs_file_read_iter, 1577 - .splice_read = ntfs_file_splice_read, 1578 - .open = ntfs_file_open, 1579 - .release = ntfs_file_release, 1580 - .setlease = generic_setlease, 1581 - }; 1582 - #endif 1583 1572 // clang-format on
+4 -12
fs/ntfs3/inode.c
··· 443 443 * Usually a hard links to directories are disabled. 444 444 */ 445 445 inode->i_op = &ntfs_dir_inode_operations; 446 - inode->i_fop = unlikely(is_legacy_ntfs(sb)) ? 447 - &ntfs_legacy_dir_operations : 448 - &ntfs_dir_operations; 446 + inode->i_fop = &ntfs_dir_operations; 449 447 ni->i_valid = 0; 450 448 } else if (S_ISLNK(mode)) { 451 449 ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY; ··· 453 455 } else if (S_ISREG(mode)) { 454 456 ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY; 455 457 inode->i_op = &ntfs_file_inode_operations; 456 - inode->i_fop = unlikely(is_legacy_ntfs(sb)) ? 457 - &ntfs_legacy_file_operations : 458 - &ntfs_file_operations; 458 + inode->i_fop = &ntfs_file_operations; 459 459 inode->i_mapping->a_ops = is_compressed(ni) ? &ntfs_aops_cmpr : 460 460 &ntfs_aops; 461 461 if (ino != MFT_REC_MFT) ··· 1642 1646 1643 1647 if (S_ISDIR(mode)) { 1644 1648 inode->i_op = &ntfs_dir_inode_operations; 1645 - inode->i_fop = unlikely(is_legacy_ntfs(sb)) ? 1646 - &ntfs_legacy_dir_operations : 1647 - &ntfs_dir_operations; 1649 + inode->i_fop = &ntfs_dir_operations; 1648 1650 } else if (S_ISLNK(mode)) { 1649 1651 inode->i_op = &ntfs_link_inode_operations; 1650 1652 inode->i_fop = NULL; ··· 1651 1657 inode_nohighmem(inode); 1652 1658 } else if (S_ISREG(mode)) { 1653 1659 inode->i_op = &ntfs_file_inode_operations; 1654 - inode->i_fop = unlikely(is_legacy_ntfs(sb)) ? 1655 - &ntfs_legacy_file_operations : 1656 - &ntfs_file_operations; 1660 + inode->i_fop = &ntfs_file_operations; 1657 1661 inode->i_mapping->a_ops = is_compressed(ni) ? &ntfs_aops_cmpr : 1658 1662 &ntfs_aops; 1659 1663 init_rwsem(&ni->file.run_lock);
-11
fs/ntfs3/ntfs_fs.h
··· 530 530 struct ntfs_fnd *fnd); 531 531 bool dir_is_empty(struct inode *dir); 532 532 extern const struct file_operations ntfs_dir_operations; 533 - extern const struct file_operations ntfs_legacy_dir_operations; 534 533 535 534 /* Globals from file.c */ 536 535 int ntfs_getattr(struct mnt_idmap *idmap, const struct path *path, ··· 545 546 extern const struct inode_operations ntfs_special_inode_operations; 546 547 extern const struct inode_operations ntfs_file_inode_operations; 547 548 extern const struct file_operations ntfs_file_operations; 548 - extern const struct file_operations ntfs_legacy_file_operations; 549 549 550 550 /* Globals from frecord.c */ 551 551 void ni_remove_mi(struct ntfs_inode *ni, struct mft_inode *mi); ··· 1247 1249 { 1248 1250 *var = cpu_to_le64(le64_to_cpu(*var) - val); 1249 1251 } 1250 - 1251 - #if IS_ENABLED(CONFIG_NTFS_FS) 1252 - bool is_legacy_ntfs(struct super_block *sb); 1253 - #else 1254 - static inline bool is_legacy_ntfs(struct super_block *sb) 1255 - { 1256 - return false; 1257 - } 1258 - #endif 1259 1252 1260 1253 #endif /* _LINUX_NTFS3_NTFS_FS_H */
+1 -58
fs/ntfs3/super.c
··· 434 434 struct ntfs_mount_options *new_opts = fc->fs_private; 435 435 int ro_rw; 436 436 437 - /* If ntfs3 is used as legacy ntfs enforce read-only mode. */ 438 - if (is_legacy_ntfs(sb)) { 439 - fc->sb_flags |= SB_RDONLY; 440 - goto out; 441 - } 442 - 443 437 ro_rw = sb_rdonly(sb) && !(fc->sb_flags & SB_RDONLY); 444 438 if (ro_rw && (sbi->flags & NTFS_FLAGS_NEED_REPLAY)) { 445 439 errorf(fc, ··· 460 466 return -EINVAL; 461 467 } 462 468 463 - out: 464 469 sync_filesystem(sb); 465 470 swap(sbi->options, fc->fs_private); 466 471 ··· 1692 1699 1693 1700 ntfs_create_procdir(sb); 1694 1701 1695 - if (is_legacy_ntfs(sb)) 1696 - sb->s_flags |= SB_RDONLY; 1697 1702 return 0; 1698 1703 1699 1704 put_inode_out: ··· 1814 1823 * This will called when mount/remount. We will first initialize 1815 1824 * options so that if remount we can use just that. 1816 1825 */ 1817 - static int __ntfs_init_fs_context(struct fs_context *fc) 1826 + static int ntfs_init_fs_context(struct fs_context *fc) 1818 1827 { 1819 1828 struct ntfs_mount_options *opts; 1820 1829 struct ntfs_sb_info *sbi; ··· 1868 1877 return -ENOMEM; 1869 1878 } 1870 1879 1871 - static int ntfs_init_fs_context(struct fs_context *fc) 1872 - { 1873 - return __ntfs_init_fs_context(fc); 1874 - } 1875 - 1876 1880 static void ntfs3_kill_sb(struct super_block *sb) 1877 1881 { 1878 1882 struct ntfs_sb_info *sbi = sb->s_fs_info; ··· 1888 1902 .kill_sb = ntfs3_kill_sb, 1889 1903 .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, 1890 1904 }; 1891 - 1892 - #if IS_ENABLED(CONFIG_NTFS_FS) 1893 - static int ntfs_legacy_init_fs_context(struct fs_context *fc) 1894 - { 1895 - int ret; 1896 - 1897 - ret = __ntfs_init_fs_context(fc); 1898 - /* If ntfs3 is used as legacy ntfs enforce read-only mode. */ 1899 - fc->sb_flags |= SB_RDONLY; 1900 - return ret; 1901 - } 1902 - 1903 - static struct file_system_type ntfs_legacy_fs_type = { 1904 - .owner = THIS_MODULE, 1905 - .name = "ntfs", 1906 - .init_fs_context = ntfs_legacy_init_fs_context, 1907 - .parameters = ntfs_fs_parameters, 1908 - .kill_sb = ntfs3_kill_sb, 1909 - .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, 1910 - }; 1911 - MODULE_ALIAS_FS("ntfs"); 1912 - 1913 - static inline void register_as_ntfs_legacy(void) 1914 - { 1915 - int err = register_filesystem(&ntfs_legacy_fs_type); 1916 - if (err) 1917 - pr_warn("ntfs3: Failed to register legacy ntfs filesystem driver: %d\n", err); 1918 - } 1919 - 1920 - static inline void unregister_as_ntfs_legacy(void) 1921 - { 1922 - unregister_filesystem(&ntfs_legacy_fs_type); 1923 - } 1924 - bool is_legacy_ntfs(struct super_block *sb) 1925 - { 1926 - return sb->s_type == &ntfs_legacy_fs_type; 1927 - } 1928 - #else 1929 - static inline void register_as_ntfs_legacy(void) {} 1930 - static inline void unregister_as_ntfs_legacy(void) {} 1931 - #endif 1932 1905 1933 1906 // clang-format on 1934 1907 ··· 1917 1972 goto out1; 1918 1973 } 1919 1974 1920 - register_as_ntfs_legacy(); 1921 1975 err = register_filesystem(&ntfs_fs_type); 1922 1976 if (err) 1923 1977 goto out; ··· 1936 1992 rcu_barrier(); 1937 1993 kmem_cache_destroy(ntfs_inode_cachep); 1938 1994 unregister_filesystem(&ntfs_fs_type); 1939 - unregister_as_ntfs_legacy(); 1940 1995 ntfs3_exit_bitmap(); 1941 1996 ntfs_remove_proc_root(); 1942 1997 }