Skip to content

Commit

Permalink
fs: compat_ioctl: move FITRIM emulation into file systems
Browse files Browse the repository at this point in the history
Remove the special case for FITRIM, and make file systems
handle that like all other ioctl commands with their own
handlers.

Cc: [email protected]
Cc: [email protected]
Cc: Mikulas Patocka <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Arnd Bergmann <[email protected]>
  • Loading branch information
arndb committed Oct 23, 2019
1 parent 8d09807 commit 314999d
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 2 deletions.
2 changes: 0 additions & 2 deletions fs/compat_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions fs/ecryptfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions fs/ext4/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions fs/f2fs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions fs/hpfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
1 change: 1 addition & 0 deletions fs/hpfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
1 change: 1 addition & 0 deletions fs/nilfs2/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions fs/ocfs2/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 314999d

Please sign in to comment.