diff options
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 5441ff1480f..0c55f8f3809 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -276,14 +276,13 @@ static int btrfs_ioctl_getversion(struct file *file, int __user *arg) | |||
276 | 276 | ||
277 | static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg) | 277 | static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg) |
278 | { | 278 | { |
279 | struct btrfs_root *root = fdentry(file)->d_sb->s_fs_info; | 279 | struct btrfs_fs_info *fs_info = btrfs_sb(fdentry(file)->d_sb); |
280 | struct btrfs_fs_info *fs_info = root->fs_info; | ||
281 | struct btrfs_device *device; | 280 | struct btrfs_device *device; |
282 | struct request_queue *q; | 281 | struct request_queue *q; |
283 | struct fstrim_range range; | 282 | struct fstrim_range range; |
284 | u64 minlen = ULLONG_MAX; | 283 | u64 minlen = ULLONG_MAX; |
285 | u64 num_devices = 0; | 284 | u64 num_devices = 0; |
286 | u64 total_bytes = btrfs_super_total_bytes(root->fs_info->super_copy); | 285 | u64 total_bytes = btrfs_super_total_bytes(fs_info->super_copy); |
287 | int ret; | 286 | int ret; |
288 | 287 | ||
289 | if (!capable(CAP_SYS_ADMIN)) | 288 | if (!capable(CAP_SYS_ADMIN)) |
@@ -312,7 +311,7 @@ static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg) | |||
312 | 311 | ||
313 | range.len = min(range.len, total_bytes - range.start); | 312 | range.len = min(range.len, total_bytes - range.start); |
314 | range.minlen = max(range.minlen, minlen); | 313 | range.minlen = max(range.minlen, minlen); |
315 | ret = btrfs_trim_fs(root, &range); | 314 | ret = btrfs_trim_fs(fs_info->tree_root, &range); |
316 | if (ret < 0) | 315 | if (ret < 0) |
317 | return ret; | 316 | return ret; |
318 | 317 | ||