]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commit
ceph: refactor wake_up_bit() pattern of calling
authorViacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Tue, 8 Jul 2025 19:20:57 +0000 (12:20 -0700)
committerViacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Wed, 9 Jul 2025 18:51:15 +0000 (11:51 -0700)
commitcecb25b9bb86a955a155a36c459c85c6cdd83def
treedda371673b0093652794b17d6c1281122fc855ef
parent1abcbcd5e3b1cd298288d2aa4e8454e3d64bfe09
ceph: refactor wake_up_bit() pattern of calling

The wake_up_bit() is called in ceph_async_unlink_cb(),
wake_async_create_waiters(), and ceph_finish_async_create().
It makes sense to switch on clear_bit() function, because
it makes the code much cleaner and easier to understand.
More important rework is the adding of smp_mb__after_atomic()
memory barrier after the bit modification and before
wake_up_bit() call. It can prevent potential race condition
of accessing the modified bit in other threads. Luckily,
clear_and_wake_up_bit() already implements the required
functionality pattern:

static inline void clear_and_wake_up_bit(int bit, unsigned long *word)
{
clear_bit_unlock(bit, word);
/* See wake_up_bit() for which memory barrier you need to use. */
smp_mb__after_atomic();
wake_up_bit(word, bit);
}

Reviewed-by: Alex Markuze amarkuze@redhat.com
Link: https://lore.kernel.org/r/20250708192057.539725-1-slava@dubeyko.com
Signed-off-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
fs/ceph/dir.c
fs/ceph/file.c