Skip to content

Commit a8b29ef

Browse files
committed
btrfs-search-metadata: use FileSystem block_groups
Now that we have a helper for looking up Block Groups, let's use it, so that it can deal with Block Groups in either Extent or Block Group Tree automagically.
1 parent b57046e commit a8b29ef

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

bin/btrfs-search-metadata

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,7 @@ def get_chunks(fs, **kwargs):
3737

3838

3939
def get_block_groups(fs, **kwargs):
40-
for chunk in fs.chunks():
41-
try:
42-
yield fs.block_group(chunk.vaddr, chunk.length)
43-
except btrfs.ctree.ItemNotFoundError:
44-
# This is simply to prevent the program from aborting when a block
45-
# group is removed in between doing the chunks lookup and the block
46-
# group item lookup.
47-
pass
40+
return fs.block_groups()
4841

4942

5043
def get_dev_extents(fs, **kwargs):

0 commit comments

Comments
 (0)