Re: [PATCH] fs/ntfs3: Use wait_on_buffer() directly

Konstantin Komarov
2025-12-09T13:38:10Z

On 11/28/25 11:12, Lalit Shankar Chowdhury wrote:

> wait_on_buffer() checks buffer_locked() internally
> before calling __wait_on_buffer().
>
> Signed-off-by: Lalit Shankar Chowdhury <lalitshankarch@gmail.com>
> ---
> fs/ntfs3/fsntfs.c | 15 ++++-----------
> fs/ntfs3/index.c | 4 +---
> fs/ntfs3/super.c | 4 +---
> 3 files changed, 6 insertions(+), 17 deletions(-)
>
> diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
> index c7a2f191254d..a6c155c691d6 100644
> --- a/fs/ntfs3/fsntfs.c
> +++ b/fs/ntfs3/fsntfs.c
> @@ -875,9 +875,7 @@ void ntfs_update_mftmirr(struct ntfs_sb_info *sbi, int wait)
> return;
> }
>
> - if (buffer_locked(bh2))
> - __wait_on_buffer(bh2);
> -
> + wait_on_buffer(bh2);
> lock_buffer(bh2);
> memcpy(bh2->b_data, bh1->b_data, blocksize);
> set_buffer_uptodate(bh2);
> @@ -1069,9 +1067,7 @@ int ntfs_sb_write(struct super_block *sb, u64 lbo, size_t bytes,
> return -ENOMEM;
> }
>
> - if (buffer_locked(bh))
> - __wait_on_buffer(bh);
> -
> + wait_on_buffer(bh);
> lock_buffer(bh);
> if (buf) {
> memcpy(bh->b_data + off, buf, op);
> @@ -1347,8 +1343,7 @@ int ntfs_get_bh(struct ntfs_sb_info *sbi, const struct runs_tree *run, u64 vbo,
> err = -ENOMEM;
> goto out;
> }
> - if (buffer_locked(bh))
> - __wait_on_buffer(bh);
> + wait_on_buffer(bh);
> set_buffer_uptodate(bh);
> } else {
> bh = ntfs_bread(sb, block);
> @@ -1420,9 +1415,7 @@ int ntfs_write_bh(struct ntfs_sb_info *sbi, struct NTFS_RECORD_HEADER *rhdr,
> if (op > bytes)
> op = bytes;
>
> - if (buffer_locked(bh))
> - __wait_on_buffer(bh);
> -
> + wait_on_buffer(bh);
> lock_buffer(bh);
>
> bh_data = bh->b_data + off;
> diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
> index 6d1bf890929d..763fc05d3ca7 100644
> --- a/fs/ntfs3/index.c
> +++ b/fs/ntfs3/index.c
> @@ -252,9 +252,7 @@ static int bmp_buf_get(struct ntfs_index *indx, struct ntfs_inode *ni,
>
> bbuf->bh = bh;
>
> - if (buffer_locked(bh))
> - __wait_on_buffer(bh);
> -
> + wait_on_buffer(bh);
> lock_buffer(bh);
>
> sb = sbi->sb;
> diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
> index ddff94c091b8..bb6462d5569c 100644
> --- a/fs/ntfs3/super.c
> +++ b/fs/ntfs3/super.c
> @@ -1616,9 +1616,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
> */
> struct buffer_head *bh0 = sb_getblk(sb, 0);
> if (bh0) {
> - if (buffer_locked(bh0))
> - __wait_on_buffer(bh0);
> -
> + wait_on_buffer(bh0);
> lock_buffer(bh0);
> memcpy(bh0->b_data, boot2, sizeof(*boot2));
> set_buffer_uptodate(bh0);

Applied to my tree, thanks for the patch. Regards, Konstantin