diff options
author | Lukas Czerner <lczerner@redhat.com> | 2010-11-19 21:18:35 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2010-11-19 21:18:35 -0500 |
commit | 93bb41f4f8b89ac8b4d0a734bc59634cb0a29a89 (patch) | |
tree | 16ed3163dbbdb5b46ed0f3a12d059b4c2c467e95 /fs | |
parent | 5a9ae68a349aa076bc8557ee2fcf865574459282 (diff) |
fs: Do not dispatch FITRIM through separate super_operation
There was concern that FITRIM ioctl is not common enough to be included
in core vfs ioctl, as Christoph Hellwig pointed out there's no real point
in dispatching this out to a separate vector instead of just through
->ioctl.
So this commit removes ioctl_fstrim() from vfs ioctl and trim_fs
from super_operation structure.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/super.c | 1 | ||||
-rw-r--r-- | fs/ioctl.c | 39 |
2 files changed, 0 insertions, 40 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 14ada8c50c43..e32195d6aac3 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1197,7 +1197,6 @@ static const struct super_operations ext4_sops = { | |||
1197 | .quota_write = ext4_quota_write, | 1197 | .quota_write = ext4_quota_write, |
1198 | #endif | 1198 | #endif |
1199 | .bdev_try_to_free_page = bdev_try_to_free_page, | 1199 | .bdev_try_to_free_page = bdev_try_to_free_page, |
1200 | .trim_fs = ext4_trim_fs | ||
1201 | }; | 1200 | }; |
1202 | 1201 | ||
1203 | static const struct super_operations ext4_nojournal_sops = { | 1202 | static const struct super_operations ext4_nojournal_sops = { |
diff --git a/fs/ioctl.c b/fs/ioctl.c index e92fdbb3bc3a..f855ea4fc888 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c | |||
@@ -530,41 +530,6 @@ static int ioctl_fsthaw(struct file *filp) | |||
530 | return thaw_super(sb); | 530 | return thaw_super(sb); |
531 | } | 531 | } |
532 | 532 | ||
533 | static int ioctl_fstrim(struct file *filp, void __user *argp) | ||
534 | { | ||
535 | struct super_block *sb = filp->f_path.dentry->d_inode->i_sb; | ||
536 | struct fstrim_range range; | ||
537 | int ret = 0; | ||
538 | |||
539 | if (!capable(CAP_SYS_ADMIN)) | ||
540 | return -EPERM; | ||
541 | |||
542 | /* If filesystem doesn't support trim feature, return. */ | ||
543 | if (sb->s_op->trim_fs == NULL) | ||
544 | return -EOPNOTSUPP; | ||
545 | |||
546 | /* If a blockdevice-backed filesystem isn't specified, return EINVAL. */ | ||
547 | if (sb->s_bdev == NULL) | ||
548 | return -EINVAL; | ||
549 | |||
550 | if (argp == NULL) { | ||
551 | range.start = 0; | ||
552 | range.len = ULLONG_MAX; | ||
553 | range.minlen = 0; | ||
554 | } else if (copy_from_user(&range, argp, sizeof(range))) | ||
555 | return -EFAULT; | ||
556 | |||
557 | ret = sb->s_op->trim_fs(sb, &range); | ||
558 | if (ret < 0) | ||
559 | return ret; | ||
560 | |||
561 | if ((argp != NULL) && | ||
562 | (copy_to_user(argp, &range, sizeof(range)))) | ||
563 | return -EFAULT; | ||
564 | |||
565 | return 0; | ||
566 | } | ||
567 | |||
568 | /* | 533 | /* |
569 | * When you add any new common ioctls to the switches above and below | 534 | * When you add any new common ioctls to the switches above and below |
570 | * please update compat_sys_ioctl() too. | 535 | * please update compat_sys_ioctl() too. |
@@ -615,10 +580,6 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, | |||
615 | error = ioctl_fsthaw(filp); | 580 | error = ioctl_fsthaw(filp); |
616 | break; | 581 | break; |
617 | 582 | ||
618 | case FITRIM: | ||
619 | error = ioctl_fstrim(filp, argp); | ||
620 | break; | ||
621 | |||
622 | case FS_IOC_FIEMAP: | 583 | case FS_IOC_FIEMAP: |
623 | return ioctl_fiemap(filp, arg); | 584 | return ioctl_fiemap(filp, arg); |
624 | 585 | ||