From ebb38b5153b514abe0ad9e5b6b4136d35f8fbc31 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Wed, 8 Nov 2023 13:50:09 +0100 Subject: [PATCH] bcachefs-tools: update to 1.3.3. --- srcpkgs/bcachefs-tools/patches/32bit.patch | 87 ++++++++++++++++------ srcpkgs/bcachefs-tools/template | 4 +- 2 files changed, 67 insertions(+), 24 deletions(-) diff --git a/srcpkgs/bcachefs-tools/patches/32bit.patch b/srcpkgs/bcachefs-tools/patches/32bit.patch index 5002e103fce..e1a423ab658 100644 --- a/srcpkgs/bcachefs-tools/patches/32bit.patch +++ b/srcpkgs/bcachefs-tools/patches/32bit.patch @@ -1,42 +1,85 @@ -mount(2) takes an unsigned long parameter, which is not u64 on 32-bit -architectures. +From f2b987745d46e763c63f47ae843d28684041fa48 Mon Sep 17 00:00:00 2001 +From: Nicholas Sielicki +Date: Wed, 18 Oct 2023 00:59:02 -0500 +Subject: [PATCH 1/2] rust: mount: use libc::c_ulong for flags +libc proper treats mount flags as an unsigned long, which is usually u64, +except when it isn't. When preparing mount flags, use the libc::c_ulong type +instead of u64 to allow for this. + +This fixes compiling this file under armv7l. + +Signed-off-by: Nicholas Sielicki +--- + rust-src/src/cmd_mount.rs | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/rust-src/src/cmd_mount.rs b/rust-src/src/cmd_mount.rs +index bb23c1a1..f7c6d920 100644 --- a/rust-src/src/cmd_mount.rs +++ b/rust-src/src/cmd_mount.rs -@@ -7,14 +7,14 @@ - use crate::key; - use crate::key::KeyLoc; - use crate::logger::SimpleLogger; --use std::ffi::{CStr, CString, OsStr, c_int, c_char, c_void}; -+use std::ffi::{CStr, CString, OsStr, c_int, c_char, c_ulong, c_void}; - use std::os::unix::ffi::OsStrExt; - - fn mount_inner( +@@ -14,7 +14,7 @@ fn mount_inner( src: String, target: impl AsRef, fstype: &str, - mountflags: u64, -+ mountflags: c_ulong, ++ mountflags: libc::c_ulong, data: Option, ) -> anyhow::Result<()> { -@@ -45,7 +45,7 @@ +@@ -45,7 +45,7 @@ fn mount_inner( /// Parse a comma-separated mount options and split out mountflags and filesystem /// specific options. -fn parse_mount_options(options: impl AsRef) -> (Option, u64) { -+fn parse_mount_options(options: impl AsRef) -> (Option, c_ulong) { ++fn parse_mount_options(options: impl AsRef) -> (Option, libc::c_ulong) { use either::Either::*; debug!("parsing mount options: {}", options.as_ref()); let (opts, flags) = options + +From 8369be0fcdfb796ec63cd91f03103b35f168d2eb Mon Sep 17 00:00:00 2001 +From: Nicholas Sielicki +Date: Wed, 18 Oct 2023 23:39:04 -0500 +Subject: [PATCH 2/2] btree_write_buffer: ensure atomic64_sub_return_release + availability + +prior to this patch, on certain platforms (ie: armv7l), compilation fails due +to atomic64_sub_return_release not being defined here. Ensure that the atomics +header is pulled in, and ensure that it is available in all cases, regardless +of whether ATOMIC64_SPINLOCK is defined. + +Signed-off-by: Nicholas Sielicki +--- + include/linux/atomic.h | 6 ++++++ + libbcachefs/btree_write_buffer.c | 1 + + 2 files changed, 7 insertions(+) + +diff --git a/include/linux/atomic.h b/include/linux/atomic.h +index f4d047c1..dfaa3711 100644 +--- a/include/linux/atomic.h ++++ b/include/linux/atomic.h +@@ -318,6 +318,12 @@ static inline s64 atomic64_cmpxchg_acquire(atomic64_t *v, s64 old, s64 new) + return atomic64_cmpxchg(v, old, new); + } + ++static inline s64 atomic64_sub_return_release(s64 i, atomic64_t *v) ++{ ++ smp_mb__before_atomic(); ++ return atomic64_sub_return(i, v); ++} ++ + #endif + + #endif /* __TOOLS_LINUX_ATOMIC_H */ +diff --git a/libbcachefs/btree_write_buffer.c b/libbcachefs/btree_write_buffer.c +index 4e6241db..76b6f2dc 100644 --- a/libbcachefs/btree_write_buffer.c +++ b/libbcachefs/btree_write_buffer.c -@@ -340,7 +340,7 @@ - bch2_journal_pin_add(&c->journal, trans->journal_res.seq, &wb->journal_pin, - bch2_btree_write_buffer_journal_flush); +@@ -9,6 +9,7 @@ + #include "journal.h" + #include "journal_reclaim.h" -- atomic64_sub_return_release(btree_write_buffer_ref(new.idx), &wb->state.counter); -+ atomic64_sub_return(btree_write_buffer_ref(new.idx), &wb->state.counter); - out: - preempt_enable(); - return ret; ++#include + #include + + static int btree_write_buffered_key_cmp(const void *_l, const void *_r) diff --git a/srcpkgs/bcachefs-tools/template b/srcpkgs/bcachefs-tools/template index 671cedea48d..55420b54f48 100644 --- a/srcpkgs/bcachefs-tools/template +++ b/srcpkgs/bcachefs-tools/template @@ -1,7 +1,7 @@ # Template file for 'bcachefs-tools' pkgname=bcachefs-tools reverts="24_1" -version=1.3.1 +version=1.3.3 revision=1 build_style=gnu-makefile make_install_args="ROOT_SBINDIR=/usr/bin" @@ -15,7 +15,7 @@ maintainer="Leah Neukirchen " license="GPL-2.0-only" homepage="https://bcachefs.org/" distfiles="https://github.com/koverstreet/bcachefs-tools/archive/refs/tags/v${version}.tar.gz" -checksum=864899c262e5021e31e3b861936276831a1fa3f48ff70551392e2134e1dcd400 +checksum=8561fc1b736e1fc8057c65e330e4c22f1b5642ebfba6b170dc49204eee496e23 export VERSION=v${version} export RUST_TARGET