fs: compat_ioctl: move FITRIM emulation into file systems
authorArnd Bergmann <arnd@arndb.de>
Mon, 3 Jun 2019 11:51:58 +0000 (13:51 +0200)
committerArnd Bergmann <arnd@arndb.de>
Wed, 23 Oct 2019 15:23:46 +0000 (17:23 +0200)
Remove the special case for FITRIM, and make file systems
handle that like all other ioctl commands with their own
handlers.

Cc: linux-ext4@vger.kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net
Cc: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Cc: linux-nilfs@vger.kernel.org
Cc: ocfs2-devel@oss.oracle.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
fs/compat_ioctl.c
fs/ecryptfs/file.c
fs/ext4/ioctl.c
fs/f2fs/file.c
fs/hpfs/dir.c
fs/hpfs/file.c
fs/nilfs2/ioctl.c
fs/ocfs2/ioctl.c

index 1e740f4406d30a30f77a5afa15847ce2b023dd9a..b20228c19ccd50d9a939ae11b167028607ff63fd 100644 (file)
@@ -345,8 +345,6 @@ static int ppp_scompress(struct file *file, unsigned int cmd,
 static unsigned int ioctl_pointer[] = {
 /* Little t */
 COMPATIBLE_IOCTL(TIOCOUTQ)
-/* 'X' - originally XFS but some now in the VFS */
-COMPATIBLE_IOCTL(FITRIM)
 #ifdef CONFIG_BLOCK
 /* Big S */
 COMPATIBLE_IOCTL(SCSI_IOCTL_GET_IDLUN)
index feecb57defa7509d4f4ba6765203396a5e8be4ed..5fb45d865ce5117bd700973d14664e4190b41a78 100644 (file)
@@ -378,6 +378,7 @@ ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                return rc;
 
        switch (cmd) {
+       case FITRIM:
        case FS_IOC32_GETFLAGS:
        case FS_IOC32_SETFLAGS:
        case FS_IOC32_GETVERSION:
index 0b7f316fd30f41391f9587487dbc41e204d5efae..e8870fff8224fb902efaea24b7c4d27769643d3d 100644 (file)
@@ -1360,6 +1360,7 @@ long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        }
        case EXT4_IOC_MOVE_EXT:
        case EXT4_IOC_RESIZE_FS:
+       case FITRIM:
        case EXT4_IOC_PRECACHE_EXTENTS:
        case EXT4_IOC_SET_ENCRYPTION_POLICY:
        case EXT4_IOC_GET_ENCRYPTION_PWSALT:
index 29bc0a542759a279f994862fe6eb3c8f97eac39d..57d82f2d2ebd509ba4e942e574d7d21d9759ed72 100644 (file)
@@ -3403,6 +3403,7 @@ long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        case F2FS_IOC_RELEASE_VOLATILE_WRITE:
        case F2FS_IOC_ABORT_VOLATILE_WRITE:
        case F2FS_IOC_SHUTDOWN:
+       case FITRIM:
        case F2FS_IOC_SET_ENCRYPTION_POLICY:
        case F2FS_IOC_GET_ENCRYPTION_PWSALT:
        case F2FS_IOC_GET_ENCRYPTION_POLICY:
index d85230c84ef296049bfa63f20a0e58314d820f4d..f32f15669996540f98ab32430df900ce52eff656 100644 (file)
@@ -325,4 +325,5 @@ const struct file_operations hpfs_dir_ops =
        .release        = hpfs_dir_release,
        .fsync          = hpfs_file_fsync,
        .unlocked_ioctl = hpfs_ioctl,
+       .compat_ioctl   = compat_ptr_ioctl,
 };
index 1ecec124e76f17866ce8b8450a71291bae7534c8..b36abf9cb345a513bf79d8765fda2a44dae1c91a 100644 (file)
@@ -215,6 +215,7 @@ const struct file_operations hpfs_file_ops =
        .fsync          = hpfs_file_fsync,
        .splice_read    = generic_file_splice_read,
        .unlocked_ioctl = hpfs_ioctl,
+       .compat_ioctl   = compat_ptr_ioctl,
 };
 
 const struct inode_operations hpfs_file_iops =
index 91b9dac6b2cc0d792696407c4aad29ceefc55cce..4ba73dbf3e8d6e5bc56eb3ffcffa6e1fe188d299 100644 (file)
@@ -1354,6 +1354,7 @@ long nilfs_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
        case NILFS_IOCTL_SYNC:
        case NILFS_IOCTL_RESIZE:
        case NILFS_IOCTL_SET_ALLOC_RANGE:
+       case FITRIM:
                break;
        default:
                return -ENOIOCTLCMD;
index d6f7b299eb236d4b176e653babdb4f1261cb9584..2d517b5ec6acced6ecb21051779ab684c4a744fc 100644 (file)
@@ -985,6 +985,7 @@ long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
                        return -EFAULT;
 
                return ocfs2_info_handle(inode, &info, 1);
+       case FITRIM:
        case OCFS2_IOC_MOVE_EXT:
                break;
        default: