diff options
author | Yan, Zheng <zheng.yan@oracle.com> | 2010-05-16 10:49:58 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-05-25 10:34:52 -0400 |
commit | 8929ecfa50f266163832eeacfbc3642ed5eb83b6 (patch) | |
tree | e0177748af36d49d5f652cff0e421a8268cf7194 /fs/btrfs/ioctl.c | |
parent | 0ca1f7ceb1991099ed5273885ebcf4323948c72e (diff) |
Btrfs: Introduce global metadata reservation
Reserve metadata space for extent tree, checksum tree and root tree
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 6a706e691377..a0686658a3f6 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -1341,8 +1341,10 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp) | |||
1341 | ret = -EPERM; | 1341 | ret = -EPERM; |
1342 | goto out; | 1342 | goto out; |
1343 | } | 1343 | } |
1344 | btrfs_defrag_root(root, 0); | 1344 | ret = btrfs_defrag_root(root, 0); |
1345 | btrfs_defrag_root(root->fs_info->extent_root, 0); | 1345 | if (ret) |
1346 | goto out; | ||
1347 | ret = btrfs_defrag_root(root->fs_info->extent_root, 0); | ||
1346 | break; | 1348 | break; |
1347 | case S_IFREG: | 1349 | case S_IFREG: |
1348 | if (!(file->f_mode & FMODE_WRITE)) { | 1350 | if (!(file->f_mode & FMODE_WRITE)) { |
@@ -1372,9 +1374,11 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp) | |||
1372 | /* the rest are all set to zero by kzalloc */ | 1374 | /* the rest are all set to zero by kzalloc */ |
1373 | range->len = (u64)-1; | 1375 | range->len = (u64)-1; |
1374 | } | 1376 | } |
1375 | btrfs_defrag_file(file, range); | 1377 | ret = btrfs_defrag_file(file, range); |
1376 | kfree(range); | 1378 | kfree(range); |
1377 | break; | 1379 | break; |
1380 | default: | ||
1381 | ret = -EINVAL; | ||
1378 | } | 1382 | } |
1379 | out: | 1383 | out: |
1380 | mnt_drop_write(file->f_path.mnt); | 1384 | mnt_drop_write(file->f_path.mnt); |