Skip to content

Commit

Permalink
bcachefs: Fix bitwise math on 32 bit systems
Browse files Browse the repository at this point in the history
The ~0UL needs to be ~0ULL for this mask and shift to work correctly on
32 bit systems.

Fixes: bad8626 ("bcachefs: CONFIG_BCACHEFS_INJECT_TRANSACTION_RESTARTS")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
  • Loading branch information
Dan Carpenter authored and Kent Overstreet committed Oct 14, 2024
1 parent ac802e0 commit 8044a9c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/bcachefs/btree_iter.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ static int btree_trans_restart(struct btree_trans *trans, int err)
static inline int trans_maybe_inject_restart(struct btree_trans *trans, unsigned long ip)
{
#ifdef CONFIG_BCACHEFS_INJECT_TRANSACTION_RESTARTS
if (!(ktime_get_ns() & ~(~0UL << min(63, (10 + trans->restart_count_this_trans))))) {
if (!(ktime_get_ns() & ~(~0ULL << min(63, (10 + trans->restart_count_this_trans))))) {
trace_and_count(trans->c, trans_restart_injected, trans, ip);
return btree_trans_restart_ip(trans,
BCH_ERR_transaction_restart_fault_inject, ip);
Expand Down

0 comments on commit 8044a9c

Please sign in to comment.