mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-07 04:26:29 +00:00
scoutfs: use our own _le bitmap xor helper
We were using bitmap_xor() to set and clear blocks of allocator bits at a time. bitmap_xor() is a ternary function with two const input pointers and we were providing the changing destination as a const input pointer. That doesn't seem wise. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -245,6 +245,23 @@ static void bitmap_set_le(__le64 *map, int ind, int nbits)
|
||||
set_bit_le(ind++, map);
|
||||
}
|
||||
|
||||
/*
|
||||
* xor the destination bitmap with the source. bitmap_xor() requires 2
|
||||
* const inputs so I'm not comfortable giving it the changing
|
||||
* destination pointer as one of the const input pointers.
|
||||
*/
|
||||
static void bitmap_xor_bitmap_le(__le64 *dst, __le64 *src, int nbits)
|
||||
{
|
||||
int i;
|
||||
|
||||
BUG_ON((unsigned long)src & 7);
|
||||
BUG_ON((unsigned long)dst & 7);
|
||||
BUG_ON(nbits & 63);
|
||||
|
||||
for (i = 0; i < nbits; i += 64)
|
||||
*(dst++) ^= *(src++);
|
||||
}
|
||||
|
||||
static void bitmap_clear_le(__le64 *map, int ind, int nbits)
|
||||
{
|
||||
unsigned int full;
|
||||
@@ -1417,13 +1434,13 @@ wrapped:
|
||||
}
|
||||
|
||||
/* carefully modify src last, it might also be inp */
|
||||
bitmap_xor((void *)dst_rdx->bits, (void *)dst_rdx->bits,
|
||||
(void *)inp_rdx->bits, SCOUTFS_RADIX_BITS);
|
||||
bitmap_xor_bitmap_le(dst_rdx->bits, inp_rdx->bits,
|
||||
SCOUTFS_RADIX_BITS);
|
||||
dst_lg_delta = count_lg_bitmap(dst_rdx->bits, inp_rdx->bits);
|
||||
|
||||
src_lg_delta = count_lg_bitmap(src_rdx->bits, inp_rdx->bits);
|
||||
bitmap_xor((void *)src_rdx->bits, (void *)src_rdx->bits,
|
||||
(void *)inp_rdx->bits, SCOUTFS_RADIX_BITS);
|
||||
bitmap_xor_bitmap_le(src_rdx->bits, inp_rdx->bits,
|
||||
SCOUTFS_RADIX_BITS);
|
||||
|
||||
if (ind < le32_to_cpu(dst_rdx->sm_first))
|
||||
dst_rdx->sm_first = cpu_to_le32(ind);
|
||||
|
||||
Reference in New Issue
Block a user