Re: [PATCH 1/2] iomap: Use kmap_local_page instead of kmap_atomic

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

 



On Thu, Aug 05, 2021 at 10:31:04AM -0700, Darrick J. Wong wrote:
> 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@xxxxxxxxxxxxx>
> 
> Pretty straightforward.
> Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx>
> 
> --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;

Though now that I think about it: Why does iomap_write_actor still use
copy_page_from_iter_atomic?  Can that be converted to use regular
copy_page_from_iter, which at least sometimes uses kmap_local_page?

--D

> >  	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
> > 



[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