lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210715215145.GN22357@magnolia>
Date:   Thu, 15 Jul 2021 14:51:45 -0700
From:   "Darrick J. Wong" <djwong@...nel.org>
To:     "Matthew Wilcox (Oracle)" <willy@...radead.org>
Cc:     linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v14 103/138] iomap: Convert iomap_read_inline_data to
 take a folio

On Thu, Jul 15, 2021 at 04:36:29AM +0100, Matthew Wilcox (Oracle) wrote:
> Inline data is restricted to being less than a page in size, so we

$deity I hope so.

> don't need to handle multi-page folios.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>

Reviewed-by: Darrick J. Wong <djwong@...nel.org>

--D

> ---
>  fs/iomap/buffered-io.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> index 5e0aa23d4693..c616ef1feb21 100644
> --- a/fs/iomap/buffered-io.c
> +++ b/fs/iomap/buffered-io.c
> @@ -194,24 +194,24 @@ struct iomap_readpage_ctx {
>  	struct readahead_control *rac;
>  };
>  
> -static void
> -iomap_read_inline_data(struct inode *inode, struct page *page,
> +static void iomap_read_inline_data(struct inode *inode, struct folio *folio,
>  		struct iomap *iomap)
>  {
>  	size_t size = i_size_read(inode);
>  	void *addr;
>  
> -	if (PageUptodate(page))
> +	if (folio_test_uptodate(folio))
>  		return;
>  
> -	BUG_ON(page->index);
> +	BUG_ON(folio->index);
> +	BUG_ON(folio_multi(folio));
>  	BUG_ON(size > PAGE_SIZE - offset_in_page(iomap->inline_data));
>  
> -	addr = kmap_atomic(page);
> +	addr = kmap_local_folio(folio, 0);
>  	memcpy(addr, iomap->inline_data, size);
>  	memset(addr + size, 0, PAGE_SIZE - size);
> -	kunmap_atomic(addr);
> -	SetPageUptodate(page);
> +	kunmap_local(addr);
> +	folio_mark_uptodate(folio);
>  }
>  
>  static inline bool iomap_block_needs_zeroing(struct inode *inode,
> @@ -236,7 +236,7 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
>  
>  	if (iomap->type == IOMAP_INLINE) {
>  		WARN_ON_ONCE(pos);
> -		iomap_read_inline_data(inode, &folio->page, iomap);
> +		iomap_read_inline_data(inode, folio, iomap);
>  		return PAGE_SIZE;
>  	}
>  
> @@ -614,7 +614,7 @@ static int iomap_write_begin(struct inode *inode, loff_t pos, size_t len,
>  
>  	page = folio_file_page(folio, pos >> PAGE_SHIFT);
>  	if (srcmap->type == IOMAP_INLINE)
> -		iomap_read_inline_data(inode, page, srcmap);
> +		iomap_read_inline_data(inode, folio, srcmap);
>  	else if (iomap->flags & IOMAP_F_BUFFER_HEAD)
>  		status = __block_write_begin_int(page, pos, len, NULL, srcmap);
>  	else
> -- 
> 2.30.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ