提交 de6e8200 编写于 作者: L Liu Bo 提交者: Chris Mason

Btrfs: release subvolume's block_rsv before transaction commit

We don't have to keep subvolume's block_rsv during transaction commit,
and within transaction commit, we may also need the free space reclaimed
from this block_rsv to process delayed refs.
Signed-off-by: NLiu Bo <bo.li.liu@oracle.com>
Signed-off-by: NJosef Bacik <jbacik@fb.com>
Signed-off-by: NChris Mason <clm@fb.com>
上级 f1de9683
......@@ -436,7 +436,9 @@ static noinline int create_subvol(struct inode *dir,
trans = btrfs_start_transaction(root, 0);
if (IS_ERR(trans)) {
ret = PTR_ERR(trans);
goto out;
btrfs_subvolume_release_metadata(root, &block_rsv,
qgroup_reserved);
return ret;
}
trans->block_rsv = &block_rsv;
trans->bytes_reserved = block_rsv.size;
......@@ -561,6 +563,8 @@ static noinline int create_subvol(struct inode *dir,
fail:
trans->block_rsv = NULL;
trans->bytes_reserved = 0;
btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved);
if (async_transid) {
*async_transid = trans->transid;
err = btrfs_commit_transaction_async(trans, root, 1);
......@@ -574,14 +578,10 @@ static noinline int create_subvol(struct inode *dir,
if (!ret) {
inode = btrfs_lookup_dentry(dir, dentry);
if (IS_ERR(inode)) {
ret = PTR_ERR(inode);
goto out;
}
if (IS_ERR(inode))
return PTR_ERR(inode);
d_instantiate(dentry, inode);
}
out:
btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册