Re: [PATCH v2 23/34] gfs2: Convert gfs2_dir_readahead to bh_submit()

Jan Kara <[email protected]> Sat, 30 May 2026 13:49:18 +0200
Newsgroups dev.linux.lists.gfs2,org.kernel.vger.linux-fsdevel
Message-ID <zv5vn2zt2ew2ysc4meuymeyudrxxebgjuxwdroqhcjduo3brck@6m43po355hpy>
On Thu 28-05-26 18:31:36, Matthew Wilcox (Oracle) wrote:
> Avoid an extra indirect function call by using bh_submit() instead of
> submit_bh().  Also simplify the control flow now that the buffer
> refcount is not put by bh_end_read().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
> Cc: [email protected]

Looks good. Feel free to add:

Reviewed-by: Jan Kara <[email protected]>

								Honza

> ---
>  fs/gfs2/dir.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
> index 022dbb31e0d9..0237b36b9eb1 100644
> --- a/fs/gfs2/dir.c
> +++ b/fs/gfs2/dir.c
> @@ -1505,15 +1505,13 @@ static void gfs2_dir_readahead(struct inode *inode, unsigned hsize, u32 index,
>  		if (trylock_buffer(bh)) {
>  			if (buffer_uptodate(bh)) {
>  				unlock_buffer(bh);
> -				brelse(bh);
> -				continue;
> +			} else {
> +				bh_submit(bh, REQ_OP_READ | REQ_RAHEAD |
> +						REQ_META | REQ_PRIO,
> +						bh_end_read);
>  			}
> -			bh->b_end_io = end_buffer_read_sync;
> -			submit_bh(REQ_OP_READ | REQ_RAHEAD | REQ_META |
> -				  REQ_PRIO, bh);
> -			continue;
>  		}
> -		brelse(bh);
> +		put_bh(bh);
>  	}
>  }
>  
> -- 
> 2.47.3
> 
-- 
Jan Kara <[email protected]>
SUSE Labs, CR