backref.c (b629685803bc0cefbbd29240ea28d57d8a17bcbc) | backref.c (56f5c19920d09bbf91efcf80e6ba301923400f4c) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2011 STRATO. All rights reserved. 4 */ 5 6#include <linux/mm.h> 7#include <linux/rbtree.h> 8#include <trace/events/btrfs.h> --- 1205 unchanged lines hidden (view full) --- 1214 struct rb_node *node; 1215 struct extent_inode_elem *eie = NULL; 1216 struct preftrees preftrees = { 1217 .direct = PREFTREE_INIT, 1218 .indirect = PREFTREE_INIT, 1219 .indirect_missing_keys = PREFTREE_INIT 1220 }; 1221 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2011 STRATO. All rights reserved. 4 */ 5 6#include <linux/mm.h> 7#include <linux/rbtree.h> 8#include <trace/events/btrfs.h> --- 1205 unchanged lines hidden (view full) --- 1214 struct rb_node *node; 1215 struct extent_inode_elem *eie = NULL; 1216 struct preftrees preftrees = { 1217 .direct = PREFTREE_INIT, 1218 .indirect = PREFTREE_INIT, 1219 .indirect_missing_keys = PREFTREE_INIT 1220 }; 1221 |
1222 /* Roots ulist is not needed when using a sharedness check context. */ 1223 if (sc) 1224 ASSERT(roots == NULL); 1225 |
|
1222 key.objectid = bytenr; 1223 key.offset = (u64)-1; 1224 if (btrfs_fs_incompat(fs_info, SKINNY_METADATA)) 1225 key.type = BTRFS_METADATA_ITEM_KEY; 1226 else 1227 key.type = BTRFS_EXTENT_ITEM_KEY; 1228 1229 path = btrfs_alloc_path(); --- 75 unchanged lines hidden (view full) --- 1305 goto out; 1306 ret = add_keyed_refs(root, path, bytenr, info_level, 1307 &preftrees, sc); 1308 if (ret) 1309 goto out; 1310 } 1311 } 1312 | 1226 key.objectid = bytenr; 1227 key.offset = (u64)-1; 1228 if (btrfs_fs_incompat(fs_info, SKINNY_METADATA)) 1229 key.type = BTRFS_METADATA_ITEM_KEY; 1230 else 1231 key.type = BTRFS_EXTENT_ITEM_KEY; 1232 1233 path = btrfs_alloc_path(); --- 75 unchanged lines hidden (view full) --- 1309 goto out; 1310 ret = add_keyed_refs(root, path, bytenr, info_level, 1311 &preftrees, sc); 1312 if (ret) 1313 goto out; 1314 } 1315 } 1316 |
1317 /* 1318 * If we have a share context and we reached here, it means the extent 1319 * is not directly shared (no multiple reference items for it), 1320 * otherwise we would have exited earlier with a return value of 1321 * BACKREF_FOUND_SHARED after processing delayed references or while 1322 * processing inline or keyed references from the extent tree. 1323 * The extent may however be indirectly shared through shared subtrees 1324 * as a result from creating snapshots, so we determine below what is 1325 * its parent node, in case we are dealing with a metadata extent, or 1326 * what's the leaf (or leaves), from a fs tree, that has a file extent 1327 * item pointing to it in case we are dealing with a data extent. 1328 */ 1329 ASSERT(extent_is_shared(sc) == 0); 1330 |
|
1313 btrfs_release_path(path); 1314 1315 ret = add_missing_keys(fs_info, &preftrees, path->skip_locking == 0); 1316 if (ret) 1317 goto out; 1318 1319 WARN_ON(!RB_EMPTY_ROOT(&preftrees.indirect_missing_keys.root.rb_root)); 1320 --- 21 unchanged lines hidden (view full) --- 1342 * prelim_ref_insert() relies on this when merging 1343 * identical refs to keep the overall count correct. 1344 * prelim_ref_insert() will merge only those refs 1345 * which compare identically. Any refs having 1346 * e.g. different offsets would not be merged, 1347 * and would retain their original ref->count < 0. 1348 */ 1349 if (roots && ref->count && ref->root_id && ref->parent == 0) { | 1331 btrfs_release_path(path); 1332 1333 ret = add_missing_keys(fs_info, &preftrees, path->skip_locking == 0); 1334 if (ret) 1335 goto out; 1336 1337 WARN_ON(!RB_EMPTY_ROOT(&preftrees.indirect_missing_keys.root.rb_root)); 1338 --- 21 unchanged lines hidden (view full) --- 1360 * prelim_ref_insert() relies on this when merging 1361 * identical refs to keep the overall count correct. 1362 * prelim_ref_insert() will merge only those refs 1363 * which compare identically. Any refs having 1364 * e.g. different offsets would not be merged, 1365 * and would retain their original ref->count < 0. 1366 */ 1367 if (roots && ref->count && ref->root_id && ref->parent == 0) { |
1350 if (sc && ref->root_id != sc->root_objectid) { 1351 ret = BACKREF_FOUND_SHARED; 1352 goto out; 1353 } 1354 | |
1355 /* no parent == root of tree */ 1356 ret = ulist_add(roots, ref->root_id, 0, GFP_NOFS); 1357 if (ret < 0) 1358 goto out; 1359 } 1360 if (ref->count && ref->parent) { 1361 if (extent_item_pos && !ref->inode_list && 1362 ref->level == 0) { --- 2004 unchanged lines hidden --- | 1368 /* no parent == root of tree */ 1369 ret = ulist_add(roots, ref->root_id, 0, GFP_NOFS); 1370 if (ret < 0) 1371 goto out; 1372 } 1373 if (ref->count && ref->parent) { 1374 if (extent_item_pos && !ref->inode_list && 1375 ref->level == 0) { --- 2004 unchanged lines hidden --- |