aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2013-02-21 23:33:36 -0500
committerJosef Bacik <jbacik@fusionio.com>2013-02-26 11:00:52 -0500
commit2382c5cc7ed0396b61a359765bf5ee125b0a2f46 (patch)
tree2ab34c510bd3603c8ad00315ea5521351824f1a8 /fs/btrfs
parenta81cb9a2d939676dee6911993a37fa7e818ab72e (diff)
Btrfs: use reserved space for creating a snapshot
While inserting dir index and updating inode for a snapshot, we'd add delayed items which consume trans->block_rsv, if we don't have any space reserved in this trans handle, we either just return or reserve space again. But before creating pending snapshots during committing transaction, we've done a release on this trans handle, so we don't have space reserved in it at this stage. What we're using is block_rsv of pending snapshots which has already reserved well enough space for both inserting dir index and updating inode, so we need to set trans handle to indicate that we have space now. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/transaction.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index a83d486cc70c..4330433b7b4f 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1123,6 +1123,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1123 1123
1124 rsv = trans->block_rsv; 1124 rsv = trans->block_rsv;
1125 trans->block_rsv = &pending->block_rsv; 1125 trans->block_rsv = &pending->block_rsv;
1126 trans->bytes_reserved = trans->block_rsv->reserved;
1126 1127
1127 dentry = pending->dentry; 1128 dentry = pending->dentry;
1128 parent = dget_parent(dentry); 1129 parent = dget_parent(dentry);
@@ -1276,6 +1277,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1276fail: 1277fail:
1277 dput(parent); 1278 dput(parent);
1278 trans->block_rsv = rsv; 1279 trans->block_rsv = rsv;
1280 trans->bytes_reserved = 0;
1279no_free_objectid: 1281no_free_objectid:
1280 kfree(new_root_item); 1282 kfree(new_root_item);
1281root_item_alloc_fail: 1283root_item_alloc_fail: