diff options
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/ioctl.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index 88974814783a..fc080dd561f7 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c | |||
@@ -276,7 +276,29 @@ group_add_out: | |||
276 | mnt_drop_write(filp->f_path.mnt); | 276 | mnt_drop_write(filp->f_path.mnt); |
277 | return err; | 277 | return err; |
278 | } | 278 | } |
279 | case FITRIM: { | ||
279 | 280 | ||
281 | struct super_block *sb = inode->i_sb; | ||
282 | struct fstrim_range range; | ||
283 | int ret = 0; | ||
284 | |||
285 | if (!capable(CAP_SYS_ADMIN)) | ||
286 | return -EPERM; | ||
287 | |||
288 | if (copy_from_user(&range, (struct fstrim_range *)arg, | ||
289 | sizeof(range))) | ||
290 | return -EFAULT; | ||
291 | |||
292 | ret = ext3_trim_fs(sb, &range); | ||
293 | if (ret < 0) | ||
294 | return ret; | ||
295 | |||
296 | if (copy_to_user((struct fstrim_range *)arg, &range, | ||
297 | sizeof(range))) | ||
298 | return -EFAULT; | ||
299 | |||
300 | return 0; | ||
301 | } | ||
280 | 302 | ||
281 | default: | 303 | default: |
282 | return -ENOTTY; | 304 | return -ENOTTY; |