aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hpfs/super.c
diff options
context:
space:
mode:
authorMikulas Patocka <mikulas@twibright.com>2015-06-28 09:16:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-07-09 16:35:30 -0400
commita27b5b97d6fe91f55058ad8ac28a8768700201ab (patch)
tree84272380472c484455a662d17b0b544421a26fe2 /fs/hpfs/super.c
parent9abea2d64ce93b6909de7f83a7f681f572369708 (diff)
hpfs: add fstrim support
This patch adds support for fstrim to the HPFS filesystem. Signed-off-by: Mikulas Patocka <mikulas@twibright.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hpfs/super.c')
-rw-r--r--fs/hpfs/super.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index 7cd00d3a7c9b..037e3e597ff4 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -196,6 +196,33 @@ static int hpfs_statfs(struct dentry *dentry, struct kstatfs *buf)
196 return 0; 196 return 0;
197} 197}
198 198
199
200long hpfs_ioctl(struct file *file, unsigned cmd, unsigned long arg)
201{
202 switch (cmd) {
203 case FITRIM: {
204 struct fstrim_range range;
205 secno n_trimmed;
206 int r;
207 if (!capable(CAP_SYS_ADMIN))
208 return -EPERM;
209 if (copy_from_user(&range, (struct fstrim_range __user *)arg, sizeof(range)))
210 return -EFAULT;
211 r = hpfs_trim_fs(file_inode(file)->i_sb, range.start >> 9, (range.start + range.len) >> 9, (range.minlen + 511) >> 9, &n_trimmed);
212 if (r)
213 return r;
214 range.len = (u64)n_trimmed << 9;
215 if (copy_to_user((struct fstrim_range __user *)arg, &range, sizeof(range)))
216 return -EFAULT;
217 return 0;
218 }
219 default: {
220 return -ENOIOCTLCMD;
221 }
222 }
223}
224
225
199static struct kmem_cache * hpfs_inode_cachep; 226static struct kmem_cache * hpfs_inode_cachep;
200 227
201static struct inode *hpfs_alloc_inode(struct super_block *sb) 228static struct inode *hpfs_alloc_inode(struct super_block *sb)