diff options
-rw-r--r-- | fs/ext4/super.c | 1 | ||||
-rw-r--r-- | fs/ioctl.c | 39 | ||||
-rw-r--r-- | include/linux/fs.h | 1 |
3 files changed, 0 insertions, 41 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 | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index 334d68a17108..eedc00b7b1ee 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1612,7 +1612,6 @@ struct super_operations { | |||
1612 | ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); | 1612 | ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); |
1613 | #endif | 1613 | #endif |
1614 | int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); | 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 | /* |