Btrfs: add inodes before dropping the extent lock in find_all_leafs
We must build up the inode list with the extent lock held after following indirect refs. This also requires an extension to ulists, which allows to modify the stored aux value in case a key already exists in the list. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
This commit is contained in:
@@ -145,12 +145,21 @@ EXPORT_SYMBOL(ulist_free);
|
||||
*/
|
||||
int ulist_add(struct ulist *ulist, u64 val, unsigned long aux,
|
||||
unsigned long gfp_mask)
|
||||
{
|
||||
return ulist_add_merge(ulist, val, aux, NULL, gfp_mask);
|
||||
}
|
||||
|
||||
int ulist_add_merge(struct ulist *ulist, u64 val, unsigned long aux,
|
||||
unsigned long *old_aux, unsigned long gfp_mask)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ulist->nnodes; ++i) {
|
||||
if (ulist->nodes[i].val == val)
|
||||
if (ulist->nodes[i].val == val) {
|
||||
if (old_aux)
|
||||
*old_aux = ulist->nodes[i].aux;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (ulist->nnodes >= ulist->nodes_alloced) {
|
||||
|
Reference in New Issue
Block a user