diff options
author | Brian Foster <bfoster@redhat.com> | 2023-11-03 09:09:38 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-04 22:19:13 -0400 |
commit | 7cb2a7895d94db2979c29e4a20f33b5557c702d5 (patch) | |
tree | eaa04267abb6b23145f658e0906854f748c7c91a /fs/bcachefs/alloc_background.c | |
parent | 0996c72a0f300bfedf8df52a8e437435494fc204 (diff) | |
download | linux-stable-7cb2a7895d94db2979c29e4a20f33b5557c702d5.tar.gz linux-stable-7cb2a7895d94db2979c29e4a20f33b5557c702d5.tar.bz2 linux-stable-7cb2a7895d94db2979c29e4a20f33b5557c702d5.zip |
bcachefs: use swab40 for bch_backpointer.bucket_offset bitfield
The bucket_offset field of bch_backpointer is a 40-bit bitfield, but the
bch2_backpointer_swab() helper uses swab32. This leads to inconsistency
when an on-disk fs is accessed from an opposite endian machine.
As it turns out, we already have an internal swab40() helper that is
used from the bch_alloc_v4 swab callback. Lift it into the backpointers
header file and use it consistently in both places.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/alloc_background.c')
-rw-r--r-- | fs/bcachefs/alloc_background.c | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c index ad256a88cb5c..1fec0e67891f 100644 --- a/fs/bcachefs/alloc_background.c +++ b/fs/bcachefs/alloc_background.c @@ -297,15 +297,6 @@ fsck_err: return ret; } -static inline u64 swab40(u64 x) -{ - return (((x & 0x00000000ffULL) << 32)| - ((x & 0x000000ff00ULL) << 16)| - ((x & 0x0000ff0000ULL) >> 0)| - ((x & 0x00ff000000ULL) >> 16)| - ((x & 0xff00000000ULL) >> 32)); -} - void bch2_alloc_v4_swab(struct bkey_s k) { struct bch_alloc_v4 *a = bkey_s_to_alloc_v4(k).v; |