Skip to content

Commit

Permalink
fs/ext4: use try_cmpxchg in ext4_update_bh_state
Browse files Browse the repository at this point in the history
Use try_cmpxchg instead of cmpxchg (*ptr, old, new) == old in
ext4_update_bh_state.  x86 CMPXCHG instruction returns success in ZF flag,
so this change saves a compare after cmpxchg (and related move instruction
in front of cmpxchg).

Also, try_cmpxchg implicitly assigns old *ptr value to "old" when cmpxchg
fails.  There is no need to re-read the value in the loop.

No functional change intended.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Uros Bizjak <[email protected]>
Cc: "Theodore Ts'o" <[email protected]>
Cc: Andreas Dilger <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
ubizjak authored and akpm00 committed Jan 31, 2023
1 parent 4ff3437 commit d760dc5

Sorry, this diff is temporarily unavailable due to heavy server load.

Please try again later.

0 comments on commit d760dc5

Please sign in to comment.