aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2016-05-27 13:01:08 -0400
committerDavid Sterba <dsterba@suse.com>2016-07-07 12:45:53 -0400
commit40acc3eededbe16f6104a32776e541f223d00b5e (patch)
treeab03dacb02052d46a6f33ca1ced68cc9686bde42 /fs/btrfs
parentae2e4728816510ae4e8ed2b732b34ea0aba05a34 (diff)
Btrfs: always use trans->block_rsv for orphans
This is the case all the time anyway except for relocation which could be doing a reloc root for a non ref counted root, in which case we'd end up with some random block rsv rather than the one we have our reservation in. If there isn't enough space in the block rsv we are trying to steal from we'll BUG() because we expect there to be space for the orphan to make its reservation. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/extent-tree.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 7c644f810816..f3de211173ad 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -5744,7 +5744,13 @@ int btrfs_orphan_reserve_metadata(struct btrfs_trans_handle *trans,
5744 struct inode *inode) 5744 struct inode *inode)
5745{ 5745{
5746 struct btrfs_root *root = BTRFS_I(inode)->root; 5746 struct btrfs_root *root = BTRFS_I(inode)->root;
5747 struct btrfs_block_rsv *src_rsv = get_block_rsv(trans, root); 5747 /*
5748 * We always use trans->block_rsv here as we will have reserved space
5749 * for our orphan when starting the transaction, using get_block_rsv()
5750 * here will sometimes make us choose the wrong block rsv as we could be
5751 * doing a reloc inode for a non refcounted root.
5752 */
5753 struct btrfs_block_rsv *src_rsv = trans->block_rsv;
5748 struct btrfs_block_rsv *dst_rsv = root->orphan_block_rsv; 5754 struct btrfs_block_rsv *dst_rsv = root->orphan_block_rsv;
5749 5755
5750 /* 5756 /*