Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 229085
b: refs/heads/master
c: 9c52749
h: refs/heads/master
i:
  229083: 7796800
v: v3
  • Loading branch information
Lukas Czerner authored and Jan Kara committed Jan 10, 2011
1 parent cb5b9c6 commit e5dfb06
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b853b96b1dbdc05fc8eae141a595366d8172962b
refs/heads/master: 9c52749232b5cef506877ac633ea14083bd17e02
22 changes: 22 additions & 0 deletions trunk/fs/ext3/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,29 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
mnt_drop_write(filp->f_path.mnt);
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 = ext3_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;
Expand Down

0 comments on commit e5dfb06

Please sign in to comment.