backref.c (bf61c8840efe60fd8f91446860b63338fb424158) | backref.c (f172393952a8771ca8970b8fcdd332a5a6ea0f56) |
---|---|
1/* 2 * Copyright (C) 2011 STRATO. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 886 unchanged lines hidden (view full) --- 895 896 while (!list_empty(&prefs)) { 897 ref = list_first_entry(&prefs, struct __prelim_ref, list); 898 list_del(&ref->list); 899 WARN_ON(ref->count < 0); 900 if (ref->count && ref->root_id && ref->parent == 0) { 901 /* no parent == root of tree */ 902 ret = ulist_add(roots, ref->root_id, 0, GFP_NOFS); | 1/* 2 * Copyright (C) 2011 STRATO. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 886 unchanged lines hidden (view full) --- 895 896 while (!list_empty(&prefs)) { 897 ref = list_first_entry(&prefs, struct __prelim_ref, list); 898 list_del(&ref->list); 899 WARN_ON(ref->count < 0); 900 if (ref->count && ref->root_id && ref->parent == 0) { 901 /* no parent == root of tree */ 902 ret = ulist_add(roots, ref->root_id, 0, GFP_NOFS); |
903 BUG_ON(ret < 0); | 903 if (ret < 0) 904 goto out; |
904 } 905 if (ref->count && ref->parent) { 906 struct extent_inode_elem *eie = NULL; 907 if (extent_item_pos && !ref->inode_list) { 908 u32 bsz; 909 struct extent_buffer *eb; 910 bsz = btrfs_level_size(fs_info->extent_root, 911 info_level); 912 eb = read_tree_block(fs_info->extent_root, 913 ref->parent, bsz, 0); 914 BUG_ON(!eb); 915 ret = find_extent_in_eb(eb, bytenr, 916 *extent_item_pos, &eie); 917 ref->inode_list = eie; 918 free_extent_buffer(eb); 919 } 920 ret = ulist_add_merge(refs, ref->parent, 921 (uintptr_t)ref->inode_list, 922 (u64 *)&eie, GFP_NOFS); | 905 } 906 if (ref->count && ref->parent) { 907 struct extent_inode_elem *eie = NULL; 908 if (extent_item_pos && !ref->inode_list) { 909 u32 bsz; 910 struct extent_buffer *eb; 911 bsz = btrfs_level_size(fs_info->extent_root, 912 info_level); 913 eb = read_tree_block(fs_info->extent_root, 914 ref->parent, bsz, 0); 915 BUG_ON(!eb); 916 ret = find_extent_in_eb(eb, bytenr, 917 *extent_item_pos, &eie); 918 ref->inode_list = eie; 919 free_extent_buffer(eb); 920 } 921 ret = ulist_add_merge(refs, ref->parent, 922 (uintptr_t)ref->inode_list, 923 (u64 *)&eie, GFP_NOFS); |
924 if (ret < 0) 925 goto out; |
|
923 if (!ret && extent_item_pos) { 924 /* 925 * we've recorded that parent, so we must extend 926 * its inode list here 927 */ 928 BUG_ON(!eie); 929 while (eie->next) 930 eie = eie->next; 931 eie->next = ref->inode_list; 932 } | 926 if (!ret && extent_item_pos) { 927 /* 928 * we've recorded that parent, so we must extend 929 * its inode list here 930 */ 931 BUG_ON(!eie); 932 while (eie->next) 933 eie = eie->next; 934 eie->next = ref->inode_list; 935 } |
933 BUG_ON(ret < 0); | |
934 } 935 kfree(ref); 936 } 937 938out: 939 btrfs_free_path(path); 940 while (!list_empty(&prefs)) { 941 ref = list_first_entry(&prefs, struct __prelim_ref, list); --- 872 unchanged lines hidden --- | 936 } 937 kfree(ref); 938 } 939 940out: 941 btrfs_free_path(path); 942 while (!list_empty(&prefs)) { 943 ref = list_first_entry(&prefs, struct __prelim_ref, list); --- 872 unchanged lines hidden --- |