All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: linux-fsdevel@vger.kernel.org, David Sterba <dsterba@suse.com>
Cc: David Sterba <dsterba@suse.com>, Ira Weiny <ira.weiny@intel.com>
Subject: Re: [PATCH] affs: replace kmap_atomic() with kmap_local_page()
Date: Wed, 13 Jul 2022 01:02:42 +0200	[thread overview]
Message-ID: <4727447.GXAFRqVoOG@opensuse> (raw)
In-Reply-To: <20220712222744.24783-1-dsterba@suse.com>

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@intel.com>
> CC: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
>  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





  reply	other threads:[~2022-07-12 23:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-12 22:27 [PATCH] affs: replace kmap_atomic() with kmap_local_page() David Sterba
2022-07-12 23:02 ` Fabio M. De Francesco [this message]
2022-07-21 18:50 ` [PATCH v2] affs: use memcpy_to_zero and remove replace kmap_atomic() David Sterba
2022-07-21 22:07   ` Ira Weiny
2022-07-22 21:49     ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4727447.GXAFRqVoOG@opensuse \
    --to=fmdefrancesco@gmail.com \
    --cc=dsterba@suse.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.