diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-11-24 10:21:08 +0300 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-11-24 10:21:08 +0300 |
commit | 540565257101f7c52b6fc5a57651f7505f8d20fe (patch) | |
tree | 7adee0bc65a02fead0dd9cae4f2d4632b227ac56 /fs/ext4/ioctl.c | |
parent | 4d048435e9864998f6a6ad16422393d42322716d (diff) | |
parent | 421b446abeec55bed1251fab80cb5c12be58b773 (diff) | |
download | linux-540565257101f7c52b6fc5a57651f7505f8d20fe.tar.xz |
Merge branch 'rmobile/fsi-despair' into rmobile-fixes-for-linus
Diffstat (limited to 'fs/ext4/ioctl.c')
-rw-r--r-- | fs/ext4/ioctl.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index bf5ae883b1bd..eb3bc2fe647e 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -331,6 +331,30 @@ mext_out: return err; } + case FITRIM: + { + struct super_block *sb = inode->i_sb; + struct fstrim_range range; + int ret = 0; + + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + + if (copy_from_user(&range, (struct fstrim_range *)arg, + sizeof(range))) + return -EFAULT; + + ret = ext4_trim_fs(sb, &range); + if (ret < 0) + return ret; + + if (copy_to_user((struct fstrim_range *)arg, &range, + sizeof(range))) + return -EFAULT; + + return 0; + } + default: return -ENOTTY; } |