diff options
author | Yan, Zheng <zheng.yan@oracle.com> | 2010-05-16 10:48:46 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-05-25 10:34:50 -0400 |
commit | a22285a6a32390195235171b89d157ed1a1fe932 (patch) | |
tree | 3fabc88a029e1af4f2fdcc708e7b62ef3cf3703a /fs/btrfs/disk-io.c | |
parent | f0486c68e4bd9a06a5904d3eeb3a0d73a83befb8 (diff) |
Btrfs: Integrate metadata reservation with start_transaction
Besides simplify the code, this change makes sure all metadata
reservation for normal metadata operations are released after
committing transaction.
Changes since V1:
Add code that check if unlink and rmdir will free space.
Add ENOSPC handling for clone ioctl.
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 574594cf6b51..054b4475c757 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1522,7 +1522,7 @@ static int transaction_kthread(void *arg) | |||
1522 | goto sleep; | 1522 | goto sleep; |
1523 | } | 1523 | } |
1524 | mutex_unlock(&root->fs_info->trans_mutex); | 1524 | mutex_unlock(&root->fs_info->trans_mutex); |
1525 | trans = btrfs_start_transaction(root, 1); | 1525 | trans = btrfs_join_transaction(root, 1); |
1526 | ret = btrfs_commit_transaction(trans, root); | 1526 | ret = btrfs_commit_transaction(trans, root); |
1527 | 1527 | ||
1528 | sleep: | 1528 | sleep: |
@@ -2409,11 +2409,11 @@ int btrfs_commit_super(struct btrfs_root *root) | |||
2409 | down_write(&root->fs_info->cleanup_work_sem); | 2409 | down_write(&root->fs_info->cleanup_work_sem); |
2410 | up_write(&root->fs_info->cleanup_work_sem); | 2410 | up_write(&root->fs_info->cleanup_work_sem); |
2411 | 2411 | ||
2412 | trans = btrfs_start_transaction(root, 1); | 2412 | trans = btrfs_join_transaction(root, 1); |
2413 | ret = btrfs_commit_transaction(trans, root); | 2413 | ret = btrfs_commit_transaction(trans, root); |
2414 | BUG_ON(ret); | 2414 | BUG_ON(ret); |
2415 | /* run commit again to drop the original snapshot */ | 2415 | /* run commit again to drop the original snapshot */ |
2416 | trans = btrfs_start_transaction(root, 1); | 2416 | trans = btrfs_join_transaction(root, 1); |
2417 | btrfs_commit_transaction(trans, root); | 2417 | btrfs_commit_transaction(trans, root); |
2418 | ret = btrfs_write_and_wait_transaction(NULL, root); | 2418 | ret = btrfs_write_and_wait_transaction(NULL, root); |
2419 | BUG_ON(ret); | 2419 | BUG_ON(ret); |