From ee0a1ba08f1d04328e2440301071248f062424e0 Mon Sep 17 00:00:00 2001 From: Chris Mason Date: Wed, 4 Feb 2009 09:12:46 -0500 Subject: [PATCH] --- yaml --- r: 131066 b: refs/heads/master c: 7b78c170dc4f538cc7ee66f47b3aac3f3974a36c h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/btrfs/ctree.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 251b9d44d365..f28bae876840 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 12f4daccfc3732280debba8f9ba49720372de831 +refs/heads/master: 7b78c170dc4f538cc7ee66f47b3aac3f3974a36c diff --git a/trunk/fs/btrfs/ctree.c b/trunk/fs/btrfs/ctree.c index 0d1e3b91e7bd..551177c0011a 100644 --- a/trunk/fs/btrfs/ctree.c +++ b/trunk/fs/btrfs/ctree.c @@ -1518,18 +1518,19 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root */ if (prealloc_block.objectid && prealloc_block.offset != b->len) { - btrfs_set_path_blocking(p); + btrfs_release_path(root, p); btrfs_free_reserved_extent(root, prealloc_block.objectid, prealloc_block.offset); prealloc_block.objectid = 0; + goto again; } /* * for higher level blocks, try not to allocate blocks * with the block and the parent locks held. */ - if (level > 1 && !prealloc_block.objectid && + if (level > 0 && !prealloc_block.objectid && btrfs_path_lock_waiting(p, level)) { u32 size = b->len; u64 hint = b->start; @@ -1614,7 +1615,9 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root } b = p->nodes[level]; slot = p->slots[level]; - } else if (ins_len < 0) { + } else if (ins_len < 0 && + btrfs_header_nritems(b) < + BTRFS_NODEPTRS_PER_BLOCK(root) / 4) { int sret; sret = reada_for_balance(root, p, level);