]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: client: refactor cifs_revalidate_mapping() to use clear_and_wake_up_bit()
authorMehdi Hassan <mehdi.h.business@pm.me>
Sat, 4 Jul 2026 02:35:06 +0000 (02:35 +0000)
committerSteve French <stfrench@microsoft.com>
Mon, 6 Jul 2026 01:08:26 +0000 (20:08 -0500)
In the `skip_invalidate:` path under `cifs_revalidate_mapping()`, the
sequence of calls:
        clear_bit_unlock();
        smp_mb__after_atomic();
        wake_up_bit();
can be replaced exactly by `clear_and_wake_up_bit()`.

The `clear_and_wake_up_bit()` helper function was introduced in
'commit 8236b0ae31c83 ("bdi: wake up concurrent wb_shutdown()
callers.")' to replace equivalent instances of this sequence of
operations. This substitution has been applied in multiple subsystems.

Compile-tested with CONFIG_CIFS=y on x86_64, no new warnings present.

Suggested-by: Agatha Isabelle Moreira <code@agatha.dev>
Link: https://kernelnewbies.org/Beginner%20Cleanup%20and%20Refactor%20Tasks%20by%20Agatha%20Isabelle%20Moreira#task_010
Cc: Agatha Isabelle Moreira <code@agatha.dev>
Signed-off-by: Mehdi Hassan <mehdi.h.business@pm.me>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/inode.c

index 1dbcfd163ff06904800baff5073ece799cf011af..2ed1c79c1132564ed716b95cb2bfb2f961681a49 100644 (file)
@@ -2812,9 +2812,7 @@ cifs_revalidate_mapping(struct inode *inode)
        }
 
 skip_invalidate:
-       clear_bit_unlock(CIFS_INO_LOCK, flags);
-       smp_mb__after_atomic();
-       wake_up_bit(flags, CIFS_INO_LOCK);
+       clear_and_wake_up_bit(CIFS_INO_LOCK, flags);
 
        return rc;
 }