aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ioctl.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-11-19 22:46:45 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-11-19 22:46:45 -0500
commitb86db4744230c94e480de56f1b7f31117edbf193 (patch)
treee94240a428f525c11c8758ebdd50398cec95e7be /fs/ioctl.c
parent76db8ac45fc738f7d7664fe9b56d15c594a45228 (diff)
parente681c047e47c0abe67bf95857f23814372793cb0 (diff)
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: ext4: Add EXT4_IOC_TRIM ioctl to handle batched discard fs: Do not dispatch FITRIM through separate super_operation ext4: ext4_fill_super shouldn't return 0 on corruption jbd2: fix /proc/fs/jbd2/<dev> when using an external journal ext4: missing unlock in ext4_clear_request_list() ext4: fix setting random pages PageUptodate
Diffstat (limited to 'fs/ioctl.c')
-rw-r--r--fs/ioctl.c39
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
532static 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