Skip to content

fs: refactor code to use clear_and_wake_up_bit()#1438

Open
vfsci-bot[bot] wants to merge 2 commits into
vfs.base.cifrom
pw/1098265/vfs.base.ci
Open

fs: refactor code to use clear_and_wake_up_bit()#1438
vfsci-bot[bot] wants to merge 2 commits into
vfs.base.cifrom
pw/1098265/vfs.base.ci

Conversation

@vfsci-bot
Copy link
Copy Markdown

@vfsci-bot vfsci-bot Bot commented May 20, 2026

Series: https://patchwork.kernel.org/project/linux-fsdevel/list/?series=1098265
Submitter: Agatha Isabelle Moreira
Version: 1
Patches: 2/2
Message-ID: <ag4PEP52c8rxrYPc@guidai>
Base: vfs.base.ci
Lore: https://lore.kernel.org/linux-fsdevel/ag4PEP52c8rxrYPc@guidai


Automated by ml2pr

Use `clear_and_wake_up_bit()` in `unlock_buffer()`, since the helper was
introduced in 'commit 8236b0a ("bdi: wake up concurrent
wb_shutdown() callers.")' as a generic way of doing the same sequence of
operations:
       	clear_bit_unlock();
	smp_mb__after_atomic();
	wake_up_bit();

The helper was implemented to avoid bugs caused by forgetting to call
`wake_up_bit()` after `clear_bit_unlock()`.

Since `unlock_buffer()` predates git and was last modified in
'commit 4e857c5 ("arch: Mass conversion of smp_mb__*()")', years
before `clear_and_wake_up_bit()`, it still uses the open-coded sequence.

Replace the open-coded sequence with the helper to avoid duplicate code
and reduce code paths to maintain.

Suggested-by: shuo chen <1289151713@qq.com>
Link: https://lore.kernel.org/kernelnewbies/agzoqV835-co4kAN@guidai/T/#t
Signed-off-by: Agatha Isabelle Moreira <code@agatha.dev>
Use `clear_and_wake_up_bit()` in `journal_end_buffer_io_sync()`, since
the helper was introduced in 'commit 8236b0a ("bdi: wake up
concurrent wb_shutdown() callers.")' as a generic way of doing the same
sequence of operations:
	clear_bit_unlock();
	smp_mb__after_atomic();
	wake_up_bit();

The helper was first implemented to avoid bugs caused by forgetting to
call `wake_up_bit()` after `clear_bit_unlock()`.

Since `journal_end_buffer_io_sync()` was first introduced by 'commit
470decc ("jbd2: initial copy of files from jbd")' and last
modified in this operation by 'commit 4e857c5 ("arch: Mass
conversion of smp_mb__*()")', years before `clear_and_wake_up_bit()`, it
still uses the open-coded sequence.

Replace the open-coded sequence with the helper to avoid duplicate code
and reduce code paths to maintain.

Suggested-by: shuo chen <1289151713@qq.com>
Link: https://lore.kernel.org/kernelnewbies/agzoqV835-co4kAN@guidai/T/#t
Signed-off-by: Agatha Isabelle Moreira <code@agatha.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant