Re: [PATCH] affs: replace kmap_atomic() with kmap_local_page()

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

 



On mercoledì 13 luglio 2022 00:27:44 CEST David Sterba wrote:
> The use of kmap() is being deprecated in favor of kmap_local_page()
> where it is feasible. With kmap_local_page(), the mapping is per thread,
> CPU local and not globally visible, like in this case around a simple
> memcpy().
> 
> CC: Ira Weiny <ira.weiny@xxxxxxxxx>
> CC: Fabio M. De Francesco <fmdefrancesco@xxxxxxxxx>
> Signed-off-by: David Sterba <dsterba@xxxxxxxx>
> ---
>  fs/affs/file.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/affs/file.c b/fs/affs/file.c
> index cd00a4c68a12..92754c40c5cd 100644
> --- a/fs/affs/file.c
> +++ b/fs/affs/file.c
> @@ -545,9 +545,9 @@ affs_do_readpage_ofs(struct page *page, unsigned to, 
int create)
>  			return PTR_ERR(bh);
>  		tmp = min(bsize - boff, to - pos);
>  		BUG_ON(pos + tmp > to || tmp > bsize);
> -		data = kmap_atomic(page);
> +		data = kmap_local_page(page);
>  		memcpy(data + pos, AFFS_DATA(bh) + boff, tmp);
> -		kunmap_atomic(data);
> +		kunmap_local(data);
>  		affs_brelse(bh);
>  		bidx++;
>  		pos += tmp;
> -- 
> 2.36.1
> 
It looks good but... what about using memcpy_to_page() instead of open 
coding kmap_local_page() + memcpy() and delete variable "char *data" since 
it will become unused?

Thanks,

Fabio








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

  Powered by Linux