Re: [PATCH 1/4] fs/btrfs: Convert kmap to kmap_local_page() using coccinelle

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

 



On Tue, Feb 16, 2021 at 06:48:23PM -0800, ira.weiny@xxxxxxxxx wrote:
> --- a/fs/btrfs/lzo.c
> +++ b/fs/btrfs/lzo.c
> @@ -118,7 +118,7 @@ int lzo_compress_pages(struct list_head *ws, struct address_space *mapping,
>  	struct workspace *workspace = list_entry(ws, struct workspace, list);
>  	int ret = 0;
>  	char *data_in;
> -	char *cpage_out;
> +	char *cpage_out, *sizes_ptr;
>  	int nr_pages = 0;
>  	struct page *in_page = NULL;
>  	struct page *out_page = NULL;
> @@ -258,10 +258,9 @@ int lzo_compress_pages(struct list_head *ws, struct address_space *mapping,
>  	}
>  
>  	/* store the size of all chunks of compressed data */
> -	cpage_out = kmap(pages[0]);
> -	write_compress_length(cpage_out, tot_out);
> -
> -	kunmap(pages[0]);
> +	sizes_ptr = kmap_local_page(pages[0]);
> +	write_compress_length(sizes_ptr, tot_out);
> +	kunmap_local(sizes_ptr);

Why is not cpage_out reused for this mapping? I don't see any reason for
another temporary variable, cpage_out is not used at this point.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux