From 1c382dc5dbc52576ac2300fee0498af8af44e7b4 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 14 Jun 2023 15:21:15 +0100 Subject: Revert "gentoo auto-resync : 14:06:2023 - 15:13:45" This reverts commit b9e8f3cc44aed3b6da71c7510c6287bf7bbbc66b. --- dev-python/btrfs/Manifest | 9 -- dev-python/btrfs/btrfs-13.ebuild | 39 ------ ...001-docs-do-not-monkey-patch-for-sphinx-4.patch | 146 --------------------- ...-002-show_file_csum-fix-vaddr-computation.patch | 27 ---- ...l-fix-documentation-error-in-FeatureFlags.patch | 21 --- .../btrfs/files/13-004-add-Block-Group-Tree.patch | 110 ---------------- ...tree-FileSystem-add-block_groups-function.patch | 58 -------- ...arch-metadata-use-FileSystem-block_groups.patch | 30 ----- dev-python/btrfs/metadata.xml | 16 --- 9 files changed, 456 deletions(-) delete mode 100644 dev-python/btrfs/Manifest delete mode 100644 dev-python/btrfs/btrfs-13.ebuild delete mode 100644 dev-python/btrfs/files/13-001-docs-do-not-monkey-patch-for-sphinx-4.patch delete mode 100644 dev-python/btrfs/files/13-002-show_file_csum-fix-vaddr-computation.patch delete mode 100644 dev-python/btrfs/files/13-003-ioctl-fix-documentation-error-in-FeatureFlags.patch delete mode 100644 dev-python/btrfs/files/13-004-add-Block-Group-Tree.patch delete mode 100644 dev-python/btrfs/files/13-005-ctree-FileSystem-add-block_groups-function.patch delete mode 100644 dev-python/btrfs/files/13-006-btrfs-search-metadata-use-FileSystem-block_groups.patch delete mode 100644 dev-python/btrfs/metadata.xml (limited to 'dev-python/btrfs') diff --git a/dev-python/btrfs/Manifest b/dev-python/btrfs/Manifest deleted file mode 100644 index c95e1dd0bfa2..000000000000 --- a/dev-python/btrfs/Manifest +++ /dev/null @@ -1,9 +0,0 @@ -AUX 13-001-docs-do-not-monkey-patch-for-sphinx-4.patch 6013 BLAKE2B d7a7417aac3a4f1fbcc912f364677db4c1ee9d6d2796a115cfafb09f6442847375d2bd85316828c6cd50b7e6337c9ca93f30d99e59c2068bcc7223f794fd157f SHA512 62341e810f10794d3fd9ac1b6ce790d18dfde9b97f83b44af1d1c5392bc6159ada273917f713037c994f5ee9bf1fbc009369e59a20d7b255652dc210b86ba3a6 -AUX 13-002-show_file_csum-fix-vaddr-computation.patch 1350 BLAKE2B 3bd4de4ca86e0b3cef8ce0d9df6acc2577f596c8424945c64a948ee4eed3a039c7bf44bc4c869056dc985049e3e0ba9e789df90b45a07cf9acde745098f744a5 SHA512 ae3d1a08da45ffbb9cb0ce8052708a7190706ff77413fbd39ab45ddffc4476fed278de29acef8e0ad830e9d4951482e699d0275afa0305277bd878dcf0da3566 -AUX 13-003-ioctl-fix-documentation-error-in-FeatureFlags.patch 854 BLAKE2B 5a9c6e6daa265e62cf28cb0ffe6dc2ecd07ce1ce374cfc0ea0c1c23d081b8260b7c35b4b980d913eb014a1b392a27fac03dea0b8fdf3a022bb15533329093d6e SHA512 9a6a51a6d56a15ed1664ce201acbf3cc2726dbba0b3ac10b1cc57e49586bcf32b89b524861a8af78a863d6ec82af03495785bbdb70715420f7363180786febd2 -AUX 13-004-add-Block-Group-Tree.patch 4651 BLAKE2B 252ffe525a631e5c389bbe35c584f20e5ad3a36a1edc7e9c285419b4df02b4d5f5d3a171d1635a35585d9957bae1a1ceb6830295ec7787c8b92c547a4ae76e5c SHA512 0d0a9fd972d5fbda9f73f123b37420425d35e5b8bbf46949be55d95a340f142154c1fd976e4285b0718fc1a5f75d7885d1ed39e5c0160dac3b3ff031d7f37ad2 -AUX 13-005-ctree-FileSystem-add-block_groups-function.patch 2932 BLAKE2B dc339882fb5a915fdbff9059068851505e52c5e713eba6da7b080684dbcea1ef7e18f0041c8c3af71d3a28088c4cb29b7105c8edc3016ec8a726837b09e1c6fe SHA512 2cbea237bc903cd5a5df3b2a50e7fedb07cd6f5dfdc6fea9fb70a4d13bf2aeff683d08a354b21fbf36239a2a8ac7bdb90575c17b932d33370daf2ab046213ad2 -AUX 13-006-btrfs-search-metadata-use-FileSystem-block_groups.patch 1074 BLAKE2B 4d3f138cc303dc3ab95d48e5af3e531be09648fcdb969b39f59cd58e631544449f6cc870218973f730141cfc4383d1e0964b9010ade354c9d832b899486e676b SHA512 806709ecda13f40865f2155a2535bd08ab463fcef7cc4c7f5e416a7ee4bbe63f5a28d5f6520f5cbe66d4bcb8907a360758c166df1dd533f137d2b79214f89c0b -DIST btrfs-13.gh.tar.gz 93110 BLAKE2B 286e5d1d9aa66ce5072f2fe144b2da6bbcde65dd90eb21efe1eb69b9aaa3230d76e8b8baffcfd269ce5d53e1004b5fc6c5546125bc1a5c26413ba8abc66f068a SHA512 5117b9c6542fe191eccbed56a15bb5d8eadc2d3c0edd986a3e1a33d0b63f58c3db5e7f6d234c43a83d1cc74eea3e106c5882a92926c3087601edc36e6672721f -EBUILD btrfs-13.ebuild 1085 BLAKE2B 9ac0baa6267fd1d75e49f5d4e15ccbe4407b8a29875722c035239225ba20364ee83d9e097f3c5cacac4e9a838c31b75dcae2c006b431f67401fb423020eecff5 SHA512 9158cbee95b98a4c26df82b81a54b5e4d8276eb58fc3fb12d693e7c0c9019c6b2242c48e3ab68afce8d42f61b6964ef6789451f7759bbfd649dc1bf103c5d679 -MISC metadata.xml 539 BLAKE2B acb8e113ac621f8fe2a27ee1b0295f23f722cfd6b2bd84492cb35c28fe5a6f96598f7fdd9f64beaea802c3087aa2011dbc4b50697cd5ab0b164b0d2631bbd3e7 SHA512 862b5cfbe0b6536d6cc6b1c344703e0420224baef68b81b62541f757f3a9d92c873a00b3e14d1f8379c7e3fd1c14d0dd65a252d6cdbe5d0dff7d562f50adf9ef diff --git a/dev-python/btrfs/btrfs-13.ebuild b/dev-python/btrfs/btrfs-13.ebuild deleted file mode 100644 index 4d688620e0b6..000000000000 --- a/dev-python/btrfs/btrfs-13.ebuild +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{10..12} ) - -inherit distutils-r1 - -DESCRIPTION="Python module to inspect btrfs filesystems" -HOMEPAGE="https://github.com/knorrie/python-btrfs" -SRC_URI="https://github.com/knorrie/python-${PN}/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz" - -LICENSE="LGPL-3" -SLOT="0" -KEYWORDS="~amd64" -IUSE="examples" - -S="${WORKDIR}/python-${P}" - -PATCHES=( - "${FILESDIR}"/${PV}-001-docs-do-not-monkey-patch-for-sphinx-4.patch - "${FILESDIR}"/${PV}-002-show_file_csum-fix-vaddr-computation.patch - "${FILESDIR}"/${PV}-003-ioctl-fix-documentation-error-in-FeatureFlags.patch - "${FILESDIR}"/${PV}-004-add-Block-Group-Tree.patch - "${FILESDIR}"/${PV}-005-ctree-FileSystem-add-block_groups-function.patch - "${FILESDIR}"/${PV}-006-btrfs-search-metadata-use-FileSystem-block_groups.patch -) - -python_install_all() { - if use examples; then - # skip symlink meant for development - rm examples/btrfs - dodoc -r examples - fi - - distutils-r1_python_install_all -} diff --git a/dev-python/btrfs/files/13-001-docs-do-not-monkey-patch-for-sphinx-4.patch b/dev-python/btrfs/files/13-001-docs-do-not-monkey-patch-for-sphinx-4.patch deleted file mode 100644 index f74d1502aa66..000000000000 --- a/dev-python/btrfs/files/13-001-docs-do-not-monkey-patch-for-sphinx-4.patch +++ /dev/null @@ -1,146 +0,0 @@ - -Patch from: -https://github.com/knorrie/python-btrfs/commit/892bc3d8882d62bf91df5de9a11569b6cffec3cd - -From 892bc3d8882d62bf91df5de9a11569b6cffec3cd Mon Sep 17 00:00:00 2001 -From: Hans van Kranenburg -Date: Sun, 8 Aug 2021 16:40:41 +0200 -Subject: [PATCH] docs: don't monkey patch for sphinx >= 4 - -There's a really long existing bug in sphinx that causes it to generate -cross references in places where it really should not: - https://github.com/sphinx-doc/sphinx/issues/2549 - -In docs/source/conf.py there's a monkey patch for this, from line 363 -and further. - -It looks like a fix for this was implemented in v4: - https://github.com/sphinx-doc/sphinx/pull/8638/commits - - -$ git tag --contains 918086b5590763663c1627578085e528f1358384 - v4.0.0 - [...] - -The function that is replaced while applying the workaround has been -changed recently, causing breakage (TypeError: patched_make_field() got -an unexpected keyword argument 'inliner'). - - -$ git tag --contains 4534d2d1a5755c8cbc9ef4327eab7e34a85a7de8 - v4.1.0 - [...] - -So, combining this information, it seems that when the major version -number of the sphinx lib being used is >= 4, the monkey patch part -should be skipped. - -Fixes: https://github.com/knorrie/python-btrfs/issues/31 ---- a/docs/source/conf.py -+++ b/docs/source/conf.py -@@ -359,54 +359,56 @@ def get_version(): - - autodoc_member_order = 'bysource' - -- --from docutils import nodes --from sphinx.util.docfields import TypedField --from sphinx import addnodes -- -- --def patched_make_field(self, -- types, # type: Dict[unicode, List[nodes.Node]] -- domain, # type: unicode -- items, # type: Tuple -- env=None, # type: BuildEnvironment -- ): -- # type: (...) -> nodes.field -- def handle_item(fieldarg, content): -- # type: (unicode, unicode) -> nodes.paragraph -- par = nodes.paragraph() -- # Adding the next line, and taking out the one after should prevent -- # ivars from getting incorrect cross-references. -- par += addnodes.literal_strong('', fieldarg) -- #par.extend(self.make_xrefs(self.rolename, domain, fieldarg, -- # addnodes.literal_strong, env=env)) -- if fieldarg in types: -- par += nodes.Text(' (') -- # NOTE: using .pop() here to prevent a single type node to be -- # inserted twice into the doctree, which leads to -- # inconsistencies later when references are resolved -- fieldtype = types.pop(fieldarg) -- if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text): -- typename = u''.join(n.astext() for n in fieldtype) -- par.extend(self.make_xrefs(self.typerolename, domain, typename, -- addnodes.literal_emphasis, env=env)) -- else: -- par += fieldtype -- par += nodes.Text(')') -- par += nodes.Text(' -- ') -- par += content -- return par -- -- fieldname = nodes.field_name('', self.label) -- if len(items) == 1 and self.can_collapse: -- fieldarg, content = items[0] -- bodynode = handle_item(fieldarg, content) -- else: -- bodynode = self.list_type() -- for fieldarg, content in items: -- bodynode += nodes.list_item('', handle_item(fieldarg, content)) -- fieldbody = nodes.field_body('', bodynode) -- return nodes.field('', fieldname, fieldbody) -- -- --TypedField.make_field = patched_make_field -+import sphinx -+ -+if int(sphinx.__version__.split('.')[0]) < 4: -+ from docutils import nodes -+ from sphinx.util.docfields import TypedField -+ from sphinx import addnodes -+ -+ -+ def patched_make_field(self, -+ types, # type: Dict[unicode, List[nodes.Node]] -+ domain, # type: unicode -+ items, # type: Tuple -+ env=None, # type: BuildEnvironment -+ ): -+ # type: (...) -> nodes.field -+ def handle_item(fieldarg, content): -+ # type: (unicode, unicode) -> nodes.paragraph -+ par = nodes.paragraph() -+ # Adding the next line, and taking out the one after should prevent -+ # ivars from getting incorrect cross-references. -+ par += addnodes.literal_strong('', fieldarg) -+ #par.extend(self.make_xrefs(self.rolename, domain, fieldarg, -+ # addnodes.literal_strong, env=env)) -+ if fieldarg in types: -+ par += nodes.Text(' (') -+ # NOTE: using .pop() here to prevent a single type node to be -+ # inserted twice into the doctree, which leads to -+ # inconsistencies later when references are resolved -+ fieldtype = types.pop(fieldarg) -+ if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text): -+ typename = u''.join(n.astext() for n in fieldtype) -+ par.extend(self.make_xrefs(self.typerolename, domain, typename, -+ addnodes.literal_emphasis, env=env)) -+ else: -+ par += fieldtype -+ par += nodes.Text(')') -+ par += nodes.Text(' -- ') -+ par += content -+ return par -+ -+ fieldname = nodes.field_name('', self.label) -+ if len(items) == 1 and self.can_collapse: -+ fieldarg, content = items[0] -+ bodynode = handle_item(fieldarg, content) -+ else: -+ bodynode = self.list_type() -+ for fieldarg, content in items: -+ bodynode += nodes.list_item('', handle_item(fieldarg, content)) -+ fieldbody = nodes.field_body('', bodynode) -+ return nodes.field('', fieldname, fieldbody) -+ -+ -+ TypedField.make_field = patched_make_field diff --git a/dev-python/btrfs/files/13-002-show_file_csum-fix-vaddr-computation.patch b/dev-python/btrfs/files/13-002-show_file_csum-fix-vaddr-computation.patch deleted file mode 100644 index dcf81c7566de..000000000000 --- a/dev-python/btrfs/files/13-002-show_file_csum-fix-vaddr-computation.patch +++ /dev/null @@ -1,27 +0,0 @@ - -Patch from: -https://github.com/knorrie/python-btrfs/commit/8ebe99f77b5e4da38d8e9322bb5a7c4688c98b4a - -From 8ebe99f77b5e4da38d8e9322bb5a7c4688c98b4a Mon Sep 17 00:00:00 2001 -From: Cebtenzzre -Date: Sun, 28 Nov 2021 14:46:39 -0500 -Subject: [PATCH] examples/show_file_csum: Fix vaddr computation - -extent.logical_offset is relative to the start of the file, whereas -extent.offset is relative to the start of the extent data on disk. ---- a/examples/show_file_csum.py -+++ b/examples/show_file_csum.py -@@ -90,11 +90,11 @@ def first_regular_file_extent(inum, tree): - "inside a data extent at vaddr {}.".format( - extent.logical_offset, extent.num_bytes, extent.offset, extent.disk_bytenr)) - --vaddr = extent.disk_bytenr + extent.logical_offset -+vaddr = extent.disk_bytenr + extent.offset - - wraprint("Now, we first look up the checksum value for one block ({} bytes) " - "of data at vaddr {} ({} + {}).".format( -- fs.sectorsize, vaddr, extent.disk_bytenr, extent.logical_offset)) -+ fs.sectorsize, vaddr, extent.disk_bytenr, extent.offset)) - wraprint("If we're lucky, the checksum tree has a key at {}. " - "If not, we have to try searching back a bit to find the csum object that " - "holds information about our data block. Searching back is done in a very clumsy " diff --git a/dev-python/btrfs/files/13-003-ioctl-fix-documentation-error-in-FeatureFlags.patch b/dev-python/btrfs/files/13-003-ioctl-fix-documentation-error-in-FeatureFlags.patch deleted file mode 100644 index 24403089bd70..000000000000 --- a/dev-python/btrfs/files/13-003-ioctl-fix-documentation-error-in-FeatureFlags.patch +++ /dev/null @@ -1,21 +0,0 @@ - -Patch from: -https://github.com/knorrie/python-btrfs/commit/9f1698ce16b6ae15bf7b3f9f414e9f08dd052b79 - -From 9f1698ce16b6ae15bf7b3f9f414e9f08dd052b79 Mon Sep 17 00:00:00 2001 -From: Hans van Kranenburg -Date: Sun, 21 May 2023 17:44:15 +0200 -Subject: [PATCH] ioctl: Fix documentation error in FeatureFlags - -The free_space_tree flag is located in compat_ro_flags. ---- a/btrfs/ioctl.py -+++ b/btrfs/ioctl.py -@@ -1410,7 +1410,7 @@ class FeatureFlags(object): - incompat_flags: mixed_backref|default_subvol|compress_lzo|big_metadata|extended_iref - >>> features.incompat_flags & btrfs.ioctl.FEATURE_INCOMPAT_MIXED_GROUPS - 0 -- >>> features.incompat_flags & btrfs.ioctl.FEATURE_COMPAT_RO_FREE_SPACE_TREE -+ >>> features.compat_ro_flags & btrfs.ioctl.FEATURE_COMPAT_RO_FREE_SPACE_TREE - 1 - - .. note:: diff --git a/dev-python/btrfs/files/13-004-add-Block-Group-Tree.patch b/dev-python/btrfs/files/13-004-add-Block-Group-Tree.patch deleted file mode 100644 index 8e21581237bc..000000000000 --- a/dev-python/btrfs/files/13-004-add-Block-Group-Tree.patch +++ /dev/null @@ -1,110 +0,0 @@ - -Patch from: -https://github.com/knorrie/python-btrfs/commit/7d8dca5bf1211843d8fd5c02b118afddaa53bee8 - -From 7d8dca5bf1211843d8fd5c02b118afddaa53bee8 Mon Sep 17 00:00:00 2001 -From: Hans van Kranenburg -Date: Sun, 21 May 2023 17:46:06 +0200 -Subject: [PATCH] WIP ctree,ioctl,utils: Add Block Group Tree - -When the block_group_tree feature is enabled on a filesystem, we have to -look up Block Group metadata items in the new Block Group Tree, instead -of the Extent Tree, where they always were located before. - -WIP: We don't want to call the get_features ioctl *every* time we look -up 1 block group object, but we also cannot just cache the result of it, -since some feature flags can change while the fs is mounted. - -So, this needs some extra work in the features department first to make -this more nice. ---- a/btrfs/ctree.py -+++ b/btrfs/ctree.py -@@ -91,6 +91,7 @@ def _struct_format(s): - QUOTA_TREE_OBJECTID = 8 #: Quota tree - UUID_TREE_OBJECTID = 9 #: Subvolume UUID tree - FREE_SPACE_TREE_OBJECTID = 10 #: Free space tree -+BLOCK_GROUP_TREE_OBJECTID = 11 #: Block group tree - - DEV_STATS_OBJECTID = 0 #: Object ID of device statistics in the Device tree. - BALANCE_OBJECTID = ULL(-4) #: Object ID to store balance status. (-4) -@@ -346,6 +347,7 @@ def _qgroup_objectid(level, subvid): - QUOTA_TREE_OBJECTID: 'QUOTA_TREE', - UUID_TREE_OBJECTID: 'UUID_TREE', - FREE_SPACE_TREE_OBJECTID: 'FREE_SPACE_TREE', -+ BLOCK_GROUP_TREE_OBJECTID: 'BLOCK_GROUP_TREE', - BALANCE_OBJECTID: 'BALANCE', - ORPHAN_OBJECTID: 'ORPHAN', - TREE_LOG_OBJECTID: 'TREE_LOG', -@@ -765,6 +767,11 @@ def __init__(self, path): - self.fsid = _fs_info.fsid - self.nodesize = _fs_info.nodesize - self.sectorsize = _fs_info.sectorsize -+ # TEMP cached feature flag for block_group_tree TEMP -+ _features = self.features() -+ self._block_group_tree = self.features().compat_ro_flags & \ -+ btrfs.ioctl.FEATURE_COMPAT_RO_BLOCK_GROUP_TREE != 0 -+ # TEMP cached feature flag for block_group_tree TEMP - - def __enter__(self): - return self -@@ -870,7 +877,10 @@ def block_group(self, vaddr, length=None): - :raises: :class:`ItemNotFoundError` if no Block Group Item can be found - at the address. - """ -- tree = EXTENT_TREE_OBJECTID -+ if not self._block_group_tree: -+ tree = EXTENT_TREE_OBJECTID -+ else: -+ tree = BLOCK_GROUP_TREE_OBJECTID - min_offset = length if length is not None else 0 - max_offset = length if length is not None else ULLONG_MAX - min_key = Key(vaddr, BLOCK_GROUP_ITEM_KEY, min_offset) -@@ -1240,11 +1250,14 @@ class BlockGroupItem(ItemData): - The `Block Group` has a 1 to 1 relationship with a `Chunk` and tracks some - usage information about a range of virtual address space. - -- * Tree: `EXTENT_TREE_OBJECTID` (2) -+ * Tree: `EXTENT_TREE_OBJECTID` (2) or `BLOCK_GROUP_TREE_OBJECTID` (11) - * Key objectid: Virtual address. - * Key type: `BLOCK_GROUP_ITEM_KEY` (192) - * Key offset: Block Group length. - -+ If the block_group_tree feature is enabled on the filesystem, these items -+ can be found inside the Block Group Tree instead of the Extent Tree. -+ - :ivar int vaddr: Virtual address where the Bock Group starts (taken from - the objectid field of the item key). - :ivar int length: Block Group length in bytes (taken from the offset field ---- a/btrfs/ioctl.py -+++ b/btrfs/ioctl.py -@@ -1325,10 +1325,12 @@ def _compat_flags_str(flags): - - FEATURE_COMPAT_RO_FREE_SPACE_TREE = 1 << 0 - FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID = 1 << 1 -+FEATURE_COMPAT_RO_BLOCK_GROUP_TREE = 1 << 3 - - _feature_compat_ro_str_map = { - FEATURE_COMPAT_RO_FREE_SPACE_TREE: 'free_space_tree', - FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID: 'free_space_tree_valid', -+ FEATURE_COMPAT_RO_BLOCK_GROUP_TREE : 'block_group_tree', - } - - -@@ -1383,6 +1385,7 @@ class FeatureFlags(object): - - - FEATURE_COMPAT_RO_FREE_SPACE_TREE - - FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID -+ - FEATURE_COMPAT_RO_BLOCK_GROUP_TREE - - Known incompat_flags (available as attribute of this module) are: - ---- a/btrfs/utils.py -+++ b/btrfs/utils.py -@@ -436,6 +436,7 @@ def embedded_text_for_str(text): - 'quota': btrfs.ctree.QUOTA_TREE_OBJECTID, - 'uuid': btrfs.ctree.UUID_TREE_OBJECTID, - 'free_space': btrfs.ctree.FREE_SPACE_TREE_OBJECTID, -+ 'block_group': btrfs.ctree.BLOCK_GROUP_TREE_OBJECTID, - 'tree_log': btrfs.ctree.TREE_LOG_OBJECTID, - 'tree_log_fixup': btrfs.ctree.TREE_LOG_FIXUP_OBJECTID, - 'tree_reloc': btrfs.ctree.TREE_RELOC_OBJECTID, diff --git a/dev-python/btrfs/files/13-005-ctree-FileSystem-add-block_groups-function.patch b/dev-python/btrfs/files/13-005-ctree-FileSystem-add-block_groups-function.patch deleted file mode 100644 index a6aae613a59d..000000000000 --- a/dev-python/btrfs/files/13-005-ctree-FileSystem-add-block_groups-function.patch +++ /dev/null @@ -1,58 +0,0 @@ - -Patch from: -https://github.com/knorrie/python-btrfs/commit/be867c10e30b7d8e4d3cfd939a433cc19f362966 - -From be867c10e30b7d8e4d3cfd939a433cc19f362966 Mon Sep 17 00:00:00 2001 -From: Hans van Kranenburg -Date: Sun, 21 May 2023 18:40:28 +0200 -Subject: [PATCH] WIP ctree: FileSystem: add block_groups function - -In the past, I did not really want to add this helper function, since -it's not just translating some function parameters to another function -call, but, to get all Block Group objects, we needed to search the Chunk -tree and get all of them individually. So, to make it more explicit to -the user of the library that it was a bit weird inefficient process, I -let the user do that little dance. - -Now, with the new Block Group Tree, we can actually just to a cheap -lookup of a Block Group range! So, well, let's add the convenience -function now, and let it handle both the old and new case. - -Note that the difference in behaviour between error handling for looking -up a range or a single items stays the same. block_groups(...) will -return an iterator which has no objects to produce, and block_group(...) -will throw the ItemNotFoundError. ---- a/btrfs/ctree.py -+++ b/btrfs/ctree.py -@@ -866,6 +866,31 @@ def dev_extents(self, min_devid=1, max_devid=ULLONG_MAX): - for header, data in btrfs.ioctl.search_v2(self.fd, tree, min_key, max_key): - yield DevExtent(header, data) - -+ def block_groups(self, min_vaddr=0, max_vaddr=ULLONG_MAX, nr_items=None): -+ """ -+ :param int min_vaddr: Lowest virtual address to search for. -+ :param int max_vaddr: Highest virtual address to search for. -+ :param int nr_items: Maximum amount of items to return. Defaults to no limit. -+ :returns: Block Group items from the Extent Tree or Block Group Tree -+ :rtype: Iterator[:class:`~btrfs.ctree.BlockGroupItem`] -+ """ -+ if not self._block_group_tree: -+ for chunk in self.chunks(min_vaddr, max_vaddr, nr_items): -+ try: -+ yield self.block_group(chunk.vaddr, chunk.length) -+ except btrfs.ctree.ItemNotFoundError: -+ # This is simply to prevent the program from aborting when a block -+ # group is removed in between doing the chunks lookup and the block -+ # group item lookup. -+ pass -+ else: -+ tree = BLOCK_GROUP_TREE_OBJECTID -+ min_key = Key(min_vaddr, BLOCK_GROUP_ITEM_KEY, 0) -+ max_key = Key(max_vaddr, BLOCK_GROUP_ITEM_KEY, ULLONG_MAX) -+ for header, data in btrfs.ioctl.search_v2(self.fd, tree, min_key, max_key, -+ nr_items=nr_items): -+ yield BlockGroupItem(header, data) -+ - def block_group(self, vaddr, length=None): - """ - :param int vaddr: Starting virtual address of the block group. diff --git a/dev-python/btrfs/files/13-006-btrfs-search-metadata-use-FileSystem-block_groups.patch b/dev-python/btrfs/files/13-006-btrfs-search-metadata-use-FileSystem-block_groups.patch deleted file mode 100644 index 286282f73822..000000000000 --- a/dev-python/btrfs/files/13-006-btrfs-search-metadata-use-FileSystem-block_groups.patch +++ /dev/null @@ -1,30 +0,0 @@ - -Patch from: -https://github.com/knorrie/python-btrfs/commit/59c8daca3a05f86001b1dc36b2ab2e5961bf7bc0 - -From 59c8daca3a05f86001b1dc36b2ab2e5961bf7bc0 Mon Sep 17 00:00:00 2001 -From: Hans van Kranenburg -Date: Sun, 21 May 2023 18:48:55 +0200 -Subject: [PATCH] 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. ---- a/bin/btrfs-search-metadata -+++ b/bin/btrfs-search-metadata -@@ -37,14 +37,7 @@ def get_chunks(fs, **kwargs): - - - def get_block_groups(fs, **kwargs): -- for chunk in fs.chunks(): -- try: -- yield fs.block_group(chunk.vaddr, chunk.length) -- except btrfs.ctree.ItemNotFoundError: -- # This is simply to prevent the program from aborting when a block -- # group is removed in between doing the chunks lookup and the block -- # group item lookup. -- pass -+ return fs.block_groups() - - - def get_dev_extents(fs, **kwargs): diff --git a/dev-python/btrfs/metadata.xml b/dev-python/btrfs/metadata.xml deleted file mode 100644 index 0167c381ec56..000000000000 --- a/dev-python/btrfs/metadata.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - holger@applied-asynchrony.com - Holger Hoffstätte - - - proxy-maint@gentoo.org - Proxy Maintainers - - - knorrie/python-btrfs - btrfs - - -- cgit v1.2.3