Commit 93bb41f4f8b89ac8b4d0a734bc59634cb0a29a89
Committed by
Theodore Ts'o
1 parent
5a9ae68a34
Exists in
master
and in
7 other branches
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>
Showing 3 changed files with 0 additions and 41 deletions Side-by-side Diff
fs/ext4/super.c
fs/ioctl.c
... | ... | @@ -530,41 +530,6 @@ |
530 | 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 | 534 | * When you add any new common ioctls to the switches above and below |
570 | 535 | * please update compat_sys_ioctl() too. |
... | ... | @@ -613,10 +578,6 @@ |
613 | 578 | |
614 | 579 | case FITHAW: |
615 | 580 | error = ioctl_fsthaw(filp); |
616 | - break; | |
617 | - | |
618 | - case FITRIM: | |
619 | - error = ioctl_fstrim(filp, argp); | |
620 | 581 | break; |
621 | 582 | |
622 | 583 | case FS_IOC_FIEMAP: |
include/linux/fs.h
... | ... | @@ -1612,7 +1612,6 @@ |
1612 | 1612 | ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); |
1613 | 1613 | #endif |
1614 | 1614 | int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); |
1615 | - int (*trim_fs) (struct super_block *, struct fstrim_range *); | |
1616 | 1615 | }; |
1617 | 1616 | |
1618 | 1617 | /* |