Re: [PATCH 3/8] reiserfs: Convert direct2indirect() to call folio_zero_range()

Ira Weiny <[email protected]>
Newsgroups gmane.linux.file-systems,gmane.comp.file-systems.reiserfs.general
Message-ID <Y54v4TYAT/nGd8WA@iweiny-mobl>
On Fri, Dec 16, 2022 at 08:53:42PM +0000, Matthew Wilcox (Oracle) wrote:
> Remove this open-coded call to kmap()/memset()/kunmap() with the
> higher-level abstraction folio_zero_range().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>

LGTM

Reviewed-by: Ira Weiny <[email protected]>

> ---
>  fs/reiserfs/tail_conversion.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/reiserfs/tail_conversion.c b/fs/reiserfs/tail_conversion.c
> index a61bca73c45f..ca36bb88b8b0 100644
> --- a/fs/reiserfs/tail_conversion.c
> +++ b/fs/reiserfs/tail_conversion.c
> @@ -151,11 +151,11 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
>  	 * out the unused part of the block (it was not up to date before)
>  	 */
>  	if (up_to_date_bh) {
> -		unsigned pgoff =
> -		    (tail_offset + total_tail - 1) & (PAGE_SIZE - 1);
> -		char *kaddr = kmap_atomic(up_to_date_bh->b_page);
> -		memset(kaddr + pgoff, 0, blk_size - total_tail);
> -		kunmap_atomic(kaddr);
> +		size_t start = offset_in_folio(up_to_date_bh->b_folio,
> +					(tail_offset + total_tail - 1));
> +
> +		folio_zero_range(up_to_date_bh->b_folio, start,
> +				blk_size - total_tail);
>  	}
>  
>  	REISERFS_I(inode)->i_first_direct_byte = U32_MAX;
> -- 
> 2.35.1
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.