Re: [PATCH 6/8] reiserfs: Convert map_block_for_writepage() to use kmap_local_folio()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 16, 2022 at 08:53:45PM +0000, Matthew Wilcox (Oracle) wrote:
> Removes uses of kmap() and b_page.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>

LGTM
Reviewed-by: Ira Weiny <ira.weiny@xxxxxxxxx>

> ---
>  fs/reiserfs/inode.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
> index 0ca2d439510a..b79848111957 100644
> --- a/fs/reiserfs/inode.c
> +++ b/fs/reiserfs/inode.c
> @@ -2360,6 +2360,7 @@ static int map_block_for_writepage(struct inode *inode,
>  	struct item_head tmp_ih;
>  	struct item_head *ih;
>  	struct buffer_head *bh;
> +	char *p;
>  	__le32 *item;
>  	struct cpu_key key;
>  	INITIALIZE_PATH(path);
> @@ -2382,7 +2383,8 @@ static int map_block_for_writepage(struct inode *inode,
>  		return -EIO;
>  	}
>  
> -	kmap(bh_result->b_page);
> +	p = kmap_local_folio(bh_result->b_folio,
> +			offset_in_folio(bh_result->b_folio, byte_offset - 1));
>  start_over:
>  	reiserfs_write_lock(inode->i_sb);
>  	make_cpu_key(&key, inode, byte_offset, TYPE_ANY, 3);
> @@ -2413,9 +2415,6 @@ static int map_block_for_writepage(struct inode *inode,
>  		set_block_dev_mapped(bh_result,
>  				     get_block_num(item, pos_in_item), inode);
>  	} else if (is_direct_le_ih(ih)) {
> -		char *p;
> -		p = page_address(bh_result->b_page);
> -		p += (byte_offset - 1) & (PAGE_SIZE - 1);
>  		copy_size = ih_item_len(ih) - pos_in_item;
>  
>  		fs_gen = get_generation(inode->i_sb);
> @@ -2491,7 +2490,7 @@ static int map_block_for_writepage(struct inode *inode,
>  			}
>  		}
>  	}
> -	kunmap(bh_result->b_page);
> +	kunmap_local(p);
>  
>  	if (!retval && buffer_mapped(bh_result) && bh_result->b_blocknr == 0) {
>  		/*
> -- 
> 2.35.1
> 



[Index of Archives]     [Linux File System Development]     [Linux BTRFS]     [Linux NFS]     [Linux Filesystems]     [Ext4 Filesystem]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Resources]

  Powered by Linux