diff options
Diffstat (limited to 'fs/ioctl.c')
-rw-r--r-- | fs/ioctl.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/fs/ioctl.c b/fs/ioctl.c index 4f46752ce4f9..d6cc16476620 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c | |||
@@ -529,41 +529,6 @@ static int ioctl_fsthaw(struct file *filp) | |||
529 | return thaw_super(sb); | 529 | return thaw_super(sb); |
530 | } | 530 | } |
531 | 531 | ||
532 | static int ioctl_fstrim(struct file *filp, void __user *argp) | ||
533 | { | ||
534 | struct super_block *sb = filp->f_path.dentry->d_inode->i_sb; | ||
535 | struct fstrim_range range; | ||
536 | int ret = 0; | ||
537 | |||
538 | if (!capable(CAP_SYS_ADMIN)) | ||
539 | return -EPERM; | ||
540 | |||
541 | /* If filesystem doesn't support trim feature, return. */ | ||
542 | if (sb->s_op->trim_fs == NULL) | ||
543 | return -EOPNOTSUPP; | ||
544 | |||
545 | /* If a blockdevice-backed filesystem isn't specified, return EINVAL. */ | ||
546 | if (sb->s_bdev == NULL) | ||
547 | return -EINVAL; | ||
548 | |||
549 | if (argp == NULL) { | ||
550 | range.start = 0; | ||
551 | range.len = ULLONG_MAX; | ||
552 | range.minlen = 0; | ||
553 | } else if (copy_from_user(&range, argp, sizeof(range))) | ||
554 | return -EFAULT; | ||
555 | |||
556 | ret = sb->s_op->trim_fs(sb, &range); | ||
557 | if (ret < 0) | ||
558 | return ret; | ||
559 | |||
560 | if ((argp != NULL) && | ||
561 | (copy_to_user(argp, &range, sizeof(range)))) | ||
562 | return -EFAULT; | ||
563 | |||
564 | return 0; | ||
565 | } | ||
566 | |||
567 | /* | 532 | /* |
568 | * When you add any new common ioctls to the switches above and below | 533 | * When you add any new common ioctls to the switches above and below |
569 | * please update compat_sys_ioctl() too. | 534 | * please update compat_sys_ioctl() too. |
@@ -614,10 +579,6 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, | |||
614 | error = ioctl_fsthaw(filp); | 579 | error = ioctl_fsthaw(filp); |
615 | break; | 580 | break; |
616 | 581 | ||
617 | case FITRIM: | ||
618 | error = ioctl_fstrim(filp, argp); | ||
619 | break; | ||
620 | |||
621 | case FS_IOC_FIEMAP: | 582 | case FS_IOC_FIEMAP: |
622 | return ioctl_fiemap(filp, arg); | 583 | return ioctl_fiemap(filp, arg); |
623 | 584 | ||