Skip to content

Commit 314999d

Browse files
committed
fs: compat_ioctl: move FITRIM emulation into file systems
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>
1 parent 8d09807 commit 314999d

8 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎fs/compat_ioctl.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,6 @@ static int ppp_scompress(struct file *file, unsigned int cmd,
345345
static unsigned int ioctl_pointer[] = {
346346
/* Little t */
347347
COMPATIBLE_IOCTL(TIOCOUTQ)
348-
/* 'X' - originally XFS but some now in the VFS */
349-
COMPATIBLE_IOCTL(FITRIM)
350348
#ifdef CONFIG_BLOCK
351349
/* Big S */
352350
COMPATIBLE_IOCTL(SCSI_IOCTL_GET_IDLUN)

‎fs/ecryptfs/file.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
378378
return rc;
379379

380380
switch (cmd) {
381+
case FITRIM:
381382
case FS_IOC32_GETFLAGS:
382383
case FS_IOC32_SETFLAGS:
383384
case FS_IOC32_GETVERSION:

‎fs/ext4/ioctl.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,7 @@ long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
13601360
}
13611361
case EXT4_IOC_MOVE_EXT:
13621362
case EXT4_IOC_RESIZE_FS:
1363+
case FITRIM:
13631364
case EXT4_IOC_PRECACHE_EXTENTS:
13641365
case EXT4_IOC_SET_ENCRYPTION_POLICY:
13651366
case EXT4_IOC_GET_ENCRYPTION_PWSALT:

‎fs/f2fs/file.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3403,6 +3403,7 @@ long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
34033403
case F2FS_IOC_RELEASE_VOLATILE_WRITE:
34043404
case F2FS_IOC_ABORT_VOLATILE_WRITE:
34053405
case F2FS_IOC_SHUTDOWN:
3406+
case FITRIM:
34063407
case F2FS_IOC_SET_ENCRYPTION_POLICY:
34073408
case F2FS_IOC_GET_ENCRYPTION_PWSALT:
34083409
case F2FS_IOC_GET_ENCRYPTION_POLICY:

‎fs/hpfs/dir.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,4 +325,5 @@ const struct file_operations hpfs_dir_ops =
325325
.release = hpfs_dir_release,
326326
.fsync = hpfs_file_fsync,
327327
.unlocked_ioctl = hpfs_ioctl,
328+
.compat_ioctl = compat_ptr_ioctl,
328329
};

‎fs/hpfs/file.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ const struct file_operations hpfs_file_ops =
215215
.fsync = hpfs_file_fsync,
216216
.splice_read = generic_file_splice_read,
217217
.unlocked_ioctl = hpfs_ioctl,
218+
.compat_ioctl = compat_ptr_ioctl,
218219
};
219220

220221
const struct inode_operations hpfs_file_iops =

‎fs/nilfs2/ioctl.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,6 +1354,7 @@ long nilfs_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
13541354
case NILFS_IOCTL_SYNC:
13551355
case NILFS_IOCTL_RESIZE:
13561356
case NILFS_IOCTL_SET_ALLOC_RANGE:
1357+
case FITRIM:
13571358
break;
13581359
default:
13591360
return -ENOIOCTLCMD;

‎fs/ocfs2/ioctl.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,7 @@ long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
985985
return -EFAULT;
986986

987987
return ocfs2_info_handle(inode, &info, 1);
988+
case FITRIM:
988989
case OCFS2_IOC_MOVE_EXT:
989990
break;
990991
default:

0 commit comments

Comments
 (0)