summaryrefslogtreecommitdiff
path: root/sys-fs/btrfs-progs
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2021-12-05 02:47:11 +0000
committerV3n3RiX <venerix@koprulu.sector>2021-12-05 02:47:11 +0000
commit2771f79232c273bc2a57d23bf335dd81ccf6af28 (patch)
treec8af0fd04194aed03cf067d44e53c7edd3e9ab84 /sys-fs/btrfs-progs
parente9d044d4b9b71200a96adfa280848858c0f468c9 (diff)
gentoo resync : 05.12.2021
Diffstat (limited to 'sys-fs/btrfs-progs')
-rw-r--r--sys-fs/btrfs-progs/Manifest6
-rw-r--r--sys-fs/btrfs-progs/btrfs-progs-5.15-r1.ebuild134
-rw-r--r--sys-fs/btrfs-progs/btrfs-progs-5.15.1.ebuild (renamed from sys-fs/btrfs-progs/btrfs-progs-5.15.ebuild)0
-rw-r--r--sys-fs/btrfs-progs/files/5.15-filesystem-usage-chunks.patch94
-rw-r--r--sys-fs/btrfs-progs/files/5.15-filesystem-usage-data.patch37
5 files changed, 270 insertions, 1 deletions
diff --git a/sys-fs/btrfs-progs/Manifest b/sys-fs/btrfs-progs/Manifest
index 3199de3ad3ae..623542fefcfa 100644
--- a/sys-fs/btrfs-progs/Manifest
+++ b/sys-fs/btrfs-progs/Manifest
@@ -1,8 +1,12 @@
+AUX 5.15-filesystem-usage-chunks.patch 2797 BLAKE2B f9f0c709fcef2aa33ba404b14f8b68f8a46d07df489d05a5979c662ea20d7dc0dd7d2c39d305b513a85eaa296061f455fa33b6cce9afbd704077f385c3772e0f SHA512 9dfff219943e7d223795e24aeaf9c3f82a1530b5fe7a7b74df27176e3e52f8a3ee30af74f9b1f59689cd0e5acf274b5eeb2e2c14d0d49e23e716fd7042a5beba
+AUX 5.15-filesystem-usage-data.patch 1381 BLAKE2B cf9f6b87eb75f61ce79441227d7a55e0b3b2e4317a244469f8d1e0d92e1c06b5aebeb867d2d032c5230a47a7737b1d06c58a9d753c1dc0f0537f713ae51c16e6 SHA512 f0216410964f9d15a74fa787ee01c5b7ddd6266626bbeac6e6560cdac7043c5b091dbaf054e4112639d2819744b02fd51a95ac6394702ec1602a49e29c653588
DIST btrfs-progs-v5.10.1.tar.xz 2204164 BLAKE2B ed83729754f9abd22d4d2e7ae9a7e90e80be9b63d49a4a9692e20e5939467dbd864834b71495661e1c7a1fca89e253a62fbda37f1d01d2eadecb13f5904f0dd0 SHA512 32e5b8bda1863e34613802db91946f240b2cde21288ff8f95c1807e7afd0a67c5a704aa4d2bc0d7b1ca094de6831adbfec83fe61f74e1caf6d1975be7d972f2d
DIST btrfs-progs-v5.14.2.tar.xz 2252600 BLAKE2B 74ac21bc9bbc70a4034b6a439afbd0c0ab023ac7815c1cae1e7ac81c4239684d41be06bebe1d015dc2a0ba80cf0975e8f6da7e111b2825eb1a7814d1832914eb SHA512 dc1a73e49dd94ccd8128c197d99f112977b16350d22bc0ca32247211314a3fec66de73827305bf24ef8e0571fc890f00378d0ec3a82988f0ee54f5db10f6578c
+DIST btrfs-progs-v5.15.1.tar.xz 2280796 BLAKE2B b460254a6261d3d04a2d265a3b4e05a89385888f7ea4f2b16ec5b73922646c7f47a546fc78ba7c009e65914125435cf38157eabffc74f5d00df2c21c844922e3 SHA512 68ed89e337ae857fdaf077eaa889e259e9f162ea2222bdaa03f4187783a8682c24d45c91b0559b901d81429ba2cd3f84087d032d354092d5512fb226bdf91549
DIST btrfs-progs-v5.15.tar.xz 2275480 BLAKE2B 45fa1e20d14bdd92b1a7761771c7b6c2795d885f91fb44c9c5cf9c735c0c6c0f319e701ca2f6bf19191c50552459287042b56d4308fcc2da5bd566e63c755941 SHA512 5fc182c490733cbe7f2cdb8e131e0c79e5cc374ae32427d5f9ee2251e00e6e1d8ba0fdbbe31d50230f2bded08a9b9c652a4288998a427643a2d738f57ce72f90
EBUILD btrfs-progs-5.10.1-r1.ebuild 2981 BLAKE2B 0c1e13d87b5119c171447e3eebc0fe9439da77a7d05ae0b1130eb8904c24081716e6f15dcb39f700abbe68a0431331c78c18a9253cb631998e61a842bbbe9791 SHA512 715d72ae20791fa701e3116ae7540be89c6761cbee1b42589881482e3abab6d5f9621fcba2b22166ac858466fe821b1af32284a0eea0a25ec8d9b3f63518a7c7
EBUILD btrfs-progs-5.14.2.ebuild 3020 BLAKE2B cc9ea2671ef95528d17529556c6ae00cda5d2386c35c93e1bd07909775393dd208df0b28269935fdab8d049611dcb3b1ec4e1561346058e94166703cdf8f0a84 SHA512 c063048685057d687f99516f770789a3919e6354d7279999ffab70c05511b08ab632f888ed4a9b1d7870acd2a8bdccda9b9e4e1abec0b3c83fda3d8578eda374
-EBUILD btrfs-progs-5.15.ebuild 3020 BLAKE2B cc9ea2671ef95528d17529556c6ae00cda5d2386c35c93e1bd07909775393dd208df0b28269935fdab8d049611dcb3b1ec4e1561346058e94166703cdf8f0a84 SHA512 c063048685057d687f99516f770789a3919e6354d7279999ffab70c05511b08ab632f888ed4a9b1d7870acd2a8bdccda9b9e4e1abec0b3c83fda3d8578eda374
+EBUILD btrfs-progs-5.15-r1.ebuild 3183 BLAKE2B fc00b7541d5f2e34cb7934e689ad07f6acc9a1543dfe9f236bb34e216f2afcb8cb38660ccf0804ffc9f2e558ab5a761945dbe16a9d2241f2941f5a38cfb39016 SHA512 523711eeec516e8d2c2e10b79c8cc2c10b5a06e730338e2a2176e0ac8de82c625dfbe19985c8cc81d8a0c46ae11425fb86082d826de9cb977d435795918c0705
+EBUILD btrfs-progs-5.15.1.ebuild 3020 BLAKE2B cc9ea2671ef95528d17529556c6ae00cda5d2386c35c93e1bd07909775393dd208df0b28269935fdab8d049611dcb3b1ec4e1561346058e94166703cdf8f0a84 SHA512 c063048685057d687f99516f770789a3919e6354d7279999ffab70c05511b08ab632f888ed4a9b1d7870acd2a8bdccda9b9e4e1abec0b3c83fda3d8578eda374
EBUILD btrfs-progs-9999.ebuild 3020 BLAKE2B cc9ea2671ef95528d17529556c6ae00cda5d2386c35c93e1bd07909775393dd208df0b28269935fdab8d049611dcb3b1ec4e1561346058e94166703cdf8f0a84 SHA512 c063048685057d687f99516f770789a3919e6354d7279999ffab70c05511b08ab632f888ed4a9b1d7870acd2a8bdccda9b9e4e1abec0b3c83fda3d8578eda374
MISC metadata.xml 524 BLAKE2B 4e27833128aeb064271af7a4f3c05699b4603b1d993b32bef3d9d973182d3d0c88ac799c95f0f35495e9a99e645627afd96049273c08c3e1334d8fe1ccf0debe SHA512 471014a98bc3feb75e7930485e89daf6cb3390c37a330b8373d5c3b0b764b9180cbff133839ce4742a3c76f63e6f18895060d5906e6a113d2cd43af0df3b0d5a
diff --git a/sys-fs/btrfs-progs/btrfs-progs-5.15-r1.ebuild b/sys-fs/btrfs-progs/btrfs-progs-5.15-r1.ebuild
new file mode 100644
index 000000000000..ec22d07e7854
--- /dev/null
+++ b/sys-fs/btrfs-progs/btrfs-progs-5.15-r1.ebuild
@@ -0,0 +1,134 @@
+# Copyright 2008-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{8..9} )
+
+inherit bash-completion-r1 python-single-r1
+
+libbtrfs_soname=0
+
+if [[ ${PV} != 9999 ]]; then
+ MY_PV="v${PV/_/-}"
+ [[ "${PV}" = *_rc* ]] || \
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+ SRC_URI="https://www.kernel.org/pub/linux/kernel/people/kdave/${PN}/${PN}-${MY_PV}.tar.xz"
+ S="${WORKDIR}/${PN}-${MY_PV}"
+else
+ WANT_LIBTOOL=none
+ inherit autotools git-r3
+ EGIT_REPO_URI="https://github.com/kdave/btrfs-progs.git"
+ EGIT_BRANCH="devel"
+fi
+
+DESCRIPTION="Btrfs filesystem utilities"
+HOMEPAGE="https://btrfs.wiki.kernel.org"
+
+LICENSE="GPL-2"
+SLOT="0/${libbtrfs_soname}"
+IUSE="+convert doc python reiserfs static static-libs +zstd"
+
+RESTRICT=test # tries to mount repared filesystems
+
+RDEPEND="
+ dev-libs/lzo:2=
+ sys-apps/util-linux:0=[static-libs(+)?]
+ sys-libs/zlib:0=
+ convert? (
+ sys-fs/e2fsprogs:=
+ reiserfs? (
+ >=sys-fs/reiserfsprogs-3.6.27
+ )
+ )
+ python? ( ${PYTHON_DEPS} )
+ zstd? ( app-arch/zstd:0= )
+"
+DEPEND="${RDEPEND}
+ >=sys-kernel/linux-headers-5.10
+ convert? ( sys-apps/acl )
+ python? (
+ $(python_gen_cond_dep '
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ ')
+ )
+ static? (
+ dev-libs/lzo:2[static-libs(+)]
+ sys-apps/util-linux:0[static-libs(+)]
+ sys-libs/zlib:0[static-libs(+)]
+ convert? (
+ sys-fs/e2fsprogs[static-libs(+)]
+ reiserfs? (
+ >=sys-fs/reiserfsprogs-3.6.27[static-libs(+)]
+ )
+ )
+ zstd? ( app-arch/zstd:0[static-libs(+)] )
+ )
+"
+BDEPEND="
+ doc? (
+ || ( >=app-text/asciidoc-8.6.0 dev-ruby/asciidoctor )
+ app-text/docbook-xml-dtd:4.5
+ app-text/xmlto
+ )
+"
+
+if [[ ${PV} == 9999 ]]; then
+ DEPEND+=" sys-devel/gnuconfig"
+fi
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+# https://github.com/kdave/btrfs-progs/issues/422
+PATCHES=(
+ "${FILESDIR}/${PV}-filesystem-usage-data.patch"
+ "${FILESDIR}/${PV}-filesystem-usage-chunks.patch"
+)
+
+pkg_setup() {
+ use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ default
+ if [[ ${PV} == 9999 ]]; then
+ AT_M4DIR=m4 eautoreconf
+ mkdir config || die
+ local automakedir="$(autotools_run_tool --at-output automake --print-libdir)"
+ [[ -e ${automakedir} ]] || die "Could not locate automake directory"
+ ln -s "${automakedir}"/install-sh config/install-sh || die
+ ln -s "${EPREFIX}"/usr/share/gnuconfig/config.guess config/config.guess || die
+ ln -s "${EPREFIX}"/usr/share/gnuconfig/config.sub config/config.sub || die
+ fi
+}
+
+src_configure() {
+ local myeconfargs=(
+ --bindir="${EPREFIX}"/sbin
+ $(use_enable convert)
+ $(use_enable doc documentation)
+ $(use_enable elibc_glibc backtrace)
+ $(use_enable python)
+ $(use_enable static-libs static)
+ $(use_enable zstd)
+ --with-convert=ext2$(usex reiserfs ',reiserfs' '')
+ )
+ econf "${myeconfargs[@]}"
+}
+
+src_compile() {
+ emake V=1 all $(usev static)
+}
+
+src_install() {
+ local makeargs=(
+ $(usex python install_python '')
+ $(usex static install-static '')
+ )
+ emake V=1 DESTDIR="${D}" install "${makeargs[@]}"
+ newbashcomp btrfs-completion btrfs
+ use python && python_optimize
+
+ # install prebuilt subset of manuals
+ use doc || doman Documentation/*.[58]
+}
diff --git a/sys-fs/btrfs-progs/btrfs-progs-5.15.ebuild b/sys-fs/btrfs-progs/btrfs-progs-5.15.1.ebuild
index 36548f98db8a..36548f98db8a 100644
--- a/sys-fs/btrfs-progs/btrfs-progs-5.15.ebuild
+++ b/sys-fs/btrfs-progs/btrfs-progs-5.15.1.ebuild
diff --git a/sys-fs/btrfs-progs/files/5.15-filesystem-usage-chunks.patch b/sys-fs/btrfs-progs/files/5.15-filesystem-usage-chunks.patch
new file mode 100644
index 000000000000..be58afc8712c
--- /dev/null
+++ b/sys-fs/btrfs-progs/files/5.15-filesystem-usage-chunks.patch
@@ -0,0 +1,94 @@
+From: Nikolay Borisov <nborisov@suse.com>
+To: linux-btrfs@vger.kernel.org
+Cc: Nikolay Borisov <nborisov@suse.com>
+Subject: [PATCH] Fix calculation of chunk size for RAID1/DUP profiles
+Date: Tue, 16 Nov 2021 16:02:06 +0200
+Message-Id: <20211116140206.291252-1-nborisov@suse.com>
+List-ID: <linux-btrfs.vger.kernel.org>
+
+Current formula calculates the stripe size, however that's not what we want
+in the case of RAID1/DUP profiles. In those cases since chunkc are mirrored
+across devices we want the full size of the chunk. Without this patch the
+'btrfs fi usage' output from an fs which is using RAID1 is:
+
+ <snip>
+
+ Data,RAID1: Size:2.00GiB, Used:1.00GiB (50.03%)
+ /dev/vdc 1.00GiB
+ /dev/vdf 1.00GiB
+
+ Metadata,RAID1: Size:256.00MiB, Used:1.34MiB (0.52%)
+ /dev/vdc 128.00MiB
+ /dev/vdf 128.00MiB
+
+ System,RAID1: Size:8.00MiB, Used:16.00KiB (0.20%)
+ /dev/vdc 4.00MiB
+ /dev/vdf 4.00MiB
+
+ Unallocated:
+ /dev/vdc 8.87GiB
+ /dev/vdf 8.87GiB
+
+
+So a 2 gigabyte RAID1 chunk actually will take up 4 gigabytes on the actual disks
+2 each. In this case this is being miscalculated as taking up 1gb on each device.
+
+This also leads to erroneously calculated unallocated space. The correct output
+in this case is:
+
+ <snip>
+
+ Data,RAID1: Size:2.00GiB, Used:1.00GiB (50.03%)
+ /dev/vdc 2.00GiB
+ /dev/vdf 2.00GiB
+
+ Metadata,RAID1: Size:256.00MiB, Used:1.34MiB (0.52%)
+ /dev/vdc 256.00MiB
+ /dev/vdf 256.00MiB
+
+ System,RAID1: Size:8.00MiB, Used:16.00KiB (0.20%)
+ /dev/vdc 8.00MiB
+ /dev/vdf 8.00MiB
+
+ Unallocated:
+ /dev/vdc 7.74GiB
+ /dev/vdf 7.74GiB
+
+
+Fix it by only utilising the chunk formula for profiles which are not RAID1/DUP.
+
+Signed-off-by: Nikolay Borisov <nborisov@suse.com>
+---
+ cmds/filesystem-usage.c | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/cmds/filesystem-usage.c b/cmds/filesystem-usage.c
+index 6195f633da44..5f2289a9b40d 100644
+--- a/cmds/filesystem-usage.c
++++ b/cmds/filesystem-usage.c
+@@ -805,11 +805,17 @@ int load_chunk_and_device_info(int fd, struct chunk_info **chunkinfo,
+ */
+ static u64 calc_chunk_size(struct chunk_info *ci)
+ {
+- u32 div;
++ u32 div = 1;
+
+- /* No parity + sub_stripes, so order of "-" and "/" does not matter */
+- div = (ci->num_stripes - btrfs_bg_type_to_nparity(ci->type)) /
+- btrfs_bg_type_to_sub_stripes(ci->type);
++ /*
++ * The formula doesn't work for RAID1/DUP types, we should just return the
++ * chunk size
++ */
++ if (!(ci->type & (BTRFS_BLOCK_GROUP_RAID1_MASK|BTRFS_BLOCK_GROUP_DUP))) {
++ /* No parity + sub_stripes, so order of "-" and "/" does not matter */
++ div = (ci->num_stripes - btrfs_bg_type_to_nparity(ci->type)) /
++ btrfs_bg_type_to_sub_stripes(ci->type);
++ }
+
+ return ci->size / div;
+ }
+--
+2.17.1
+
+
diff --git a/sys-fs/btrfs-progs/files/5.15-filesystem-usage-data.patch b/sys-fs/btrfs-progs/files/5.15-filesystem-usage-data.patch
new file mode 100644
index 000000000000..f3b43d5c594d
--- /dev/null
+++ b/sys-fs/btrfs-progs/files/5.15-filesystem-usage-data.patch
@@ -0,0 +1,37 @@
+From 2f3950c8304fec2aed9bf11b52d073683b137330 Mon Sep 17 00:00:00 2001
+From: Nikolay Borisov <nborisov@suse.com>
+Date: Mon, 15 Nov 2021 11:15:42 +0200
+Subject: [PATCH] btrfs-progs: fi usage: don't reset ratio to 1 if we don't
+ have RAID56 profile
+
+Commit 80714610f36e ("btrfs-progs: use raid table for ncopies")
+slightly broke how raid ratio are being calculated since the resulting
+code would always reset ratio to be 1 in case we didn't have RAID56
+profile. The correct behavior is to simply set it to 0 if we have RAID56
+as the calculation is different in this case and leave it intact
+otherwise.
+
+This bug manifests by doing all size-related calculation for 'btrfs
+filesystem usage' command as if all block groups are of type SINGLE. Fix
+this by only resetting ratio 0 in case of RAID56.
+
+Issue: #422
+Signed-off-by: Nikolay Borisov <nborisov@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+---
+ cmds/filesystem-usage.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/cmds/filesystem-usage.c b/cmds/filesystem-usage.c
+index e22efe3a4..bac0f0fd5 100644
+--- a/cmds/filesystem-usage.c
++++ b/cmds/filesystem-usage.c
+@@ -508,8 +508,6 @@ static int print_filesystem_usage_overall(int fd, struct chunk_info *chunkinfo,
+ */
+ if (flags & BTRFS_BLOCK_GROUP_RAID56_MASK)
+ ratio = 0;
+- else
+- ratio = 1;
+
+ if (ratio > max_data_ratio)
+ max_data_ratio = ratio;