linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 1/2] iomap: Use kmap_local_page instead of kmap_atomic
Date: Thu, 5 Aug 2021 10:31:04 -0700	[thread overview]
Message-ID: <20210805173104.GF3601405@magnolia> (raw)
In-Reply-To: <20210803193134.1198733-1-willy@infradead.org>

On Tue, Aug 03, 2021 at 08:31:33PM +0100, Matthew Wilcox (Oracle) wrote:
> kmap_atomic() has the side-effect of disabling pagefaults and
> preemption.  kmap_local_page() does not do this and is preferred.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Pretty straightforward.
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/iomap/buffered-io.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> index c1c8cd41ea81..8ee0211bea86 100644
> --- a/fs/iomap/buffered-io.c
> +++ b/fs/iomap/buffered-io.c
> @@ -223,10 +223,10 @@ static int iomap_read_inline_data(struct inode *inode, struct page *page,
>  	if (poff > 0)
>  		iomap_page_create(inode, page);
>  
> -	addr = kmap_atomic(page) + poff;
> +	addr = kmap_local_page(page) + poff;
>  	memcpy(addr, iomap->inline_data, size);
>  	memset(addr + size, 0, PAGE_SIZE - poff - size);
> -	kunmap_atomic(addr);
> +	kunmap_local(addr);
>  	iomap_set_range_uptodate(page, poff, PAGE_SIZE - poff);
>  	return PAGE_SIZE - poff;
>  }
> @@ -682,9 +682,9 @@ static size_t iomap_write_end_inline(struct inode *inode, struct page *page,
>  	BUG_ON(!iomap_inline_data_valid(iomap));
>  
>  	flush_dcache_page(page);
> -	addr = kmap_atomic(page);
> -	memcpy(iomap_inline_data(iomap, pos), addr + pos, copied);
> -	kunmap_atomic(addr);
> +	addr = kmap_local_page(page) + pos;
> +	memcpy(iomap_inline_data(iomap, pos), addr, copied);
> +	kunmap_local(addr);
>  
>  	mark_inode_dirty(inode);
>  	return copied;
> -- 
> 2.30.2
> 

  parent reply	other threads:[~2021-08-05 17:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03 19:31 [PATCH 1/2] iomap: Use kmap_local_page instead of kmap_atomic Matthew Wilcox (Oracle)
2021-08-03 19:31 ` [PATCH 2/2] iomap: Add another assertion to inline data handling Matthew Wilcox (Oracle)
2021-08-05 17:31   ` Darrick J. Wong
2021-08-05 17:31 ` Darrick J. Wong [this message]
2021-08-05 17:39   ` [PATCH 1/2] iomap: Use kmap_local_page instead of kmap_atomic Darrick J. Wong
2021-08-05 18:24     ` Matthew Wilcox
2021-08-10 21:18       ` Thomas Gleixner

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=20210805173104.GF3601405@magnolia \
    --to=djwong@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=willy@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).