linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iomap: move iomap_read_inline_data around
@ 2019-05-01 16:11 Christoph Hellwig
  2019-05-01 22:05 ` Dave Chinner
  2019-05-02  3:19 ` Darrick J. Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Christoph Hellwig @ 2019-05-01 16:11 UTC (permalink / raw)
  To: darrick.wong; +Cc: agruenba, linux-fsdevel

iomap_read_inline_data ended up being placed in the middle of the bio
based read I/O completion handling, which tends to confuse the heck out
of me whenever I follow the code.  Move it to a more suitable place.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/iomap.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/fs/iomap.c b/fs/iomap.c
index fbfe20b7f6f0..9ef049d61e8a 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -240,26 +240,6 @@ iomap_read_page_end_io(struct bio_vec *bvec, int error)
 	iomap_read_finish(iop, page);
 }
 
-static void
-iomap_read_inline_data(struct inode *inode, struct page *page,
-		struct iomap *iomap)
-{
-	size_t size = i_size_read(inode);
-	void *addr;
-
-	if (PageUptodate(page))
-		return;
-
-	BUG_ON(page->index);
-	BUG_ON(size > PAGE_SIZE - offset_in_page(iomap->inline_data));
-
-	addr = kmap_atomic(page);
-	memcpy(addr, iomap->inline_data, size);
-	memset(addr + size, 0, PAGE_SIZE - size);
-	kunmap_atomic(addr);
-	SetPageUptodate(page);
-}
-
 static void
 iomap_read_end_io(struct bio *bio)
 {
@@ -281,6 +261,26 @@ struct iomap_readpage_ctx {
 	struct list_head	*pages;
 };
 
+static void
+iomap_read_inline_data(struct inode *inode, struct page *page,
+		struct iomap *iomap)
+{
+	size_t size = i_size_read(inode);
+	void *addr;
+
+	if (PageUptodate(page))
+		return;
+
+	BUG_ON(page->index);
+	BUG_ON(size > PAGE_SIZE - offset_in_page(iomap->inline_data));
+
+	addr = kmap_atomic(page);
+	memcpy(addr, iomap->inline_data, size);
+	memset(addr + size, 0, PAGE_SIZE - size);
+	kunmap_atomic(addr);
+	SetPageUptodate(page);
+}
+
 static loff_t
 iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
 		struct iomap *iomap)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iomap: move iomap_read_inline_data around
  2019-05-01 16:11 [PATCH] iomap: move iomap_read_inline_data around Christoph Hellwig
@ 2019-05-01 22:05 ` Dave Chinner
  2019-05-02  3:19 ` Darrick J. Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Chinner @ 2019-05-01 22:05 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: darrick.wong, agruenba, linux-fsdevel

On Wed, May 01, 2019 at 12:11:11PM -0400, Christoph Hellwig wrote:
> iomap_read_inline_data ended up being placed in the middle of the bio
> based read I/O completion handling, which tends to confuse the heck out
> of me whenever I follow the code.  Move it to a more suitable place.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Makes sense.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iomap: move iomap_read_inline_data around
  2019-05-01 16:11 [PATCH] iomap: move iomap_read_inline_data around Christoph Hellwig
  2019-05-01 22:05 ` Dave Chinner
@ 2019-05-02  3:19 ` Darrick J. Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2019-05-02  3:19 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: agruenba, linux-fsdevel

On Wed, May 01, 2019 at 12:11:11PM -0400, Christoph Hellwig wrote:
> iomap_read_inline_data ended up being placed in the middle of the bio
> based read I/O completion handling, which tends to confuse the heck out
> of me whenever I follow the code.  Move it to a more suitable place.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/iomap.c | 40 ++++++++++++++++++++--------------------
>  1 file changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/fs/iomap.c b/fs/iomap.c
> index fbfe20b7f6f0..9ef049d61e8a 100644
> --- a/fs/iomap.c
> +++ b/fs/iomap.c
> @@ -240,26 +240,6 @@ iomap_read_page_end_io(struct bio_vec *bvec, int error)
>  	iomap_read_finish(iop, page);
>  }
>  
> -static void
> -iomap_read_inline_data(struct inode *inode, struct page *page,
> -		struct iomap *iomap)
> -{
> -	size_t size = i_size_read(inode);
> -	void *addr;
> -
> -	if (PageUptodate(page))
> -		return;
> -
> -	BUG_ON(page->index);
> -	BUG_ON(size > PAGE_SIZE - offset_in_page(iomap->inline_data));
> -
> -	addr = kmap_atomic(page);
> -	memcpy(addr, iomap->inline_data, size);
> -	memset(addr + size, 0, PAGE_SIZE - size);
> -	kunmap_atomic(addr);
> -	SetPageUptodate(page);
> -}
> -
>  static void
>  iomap_read_end_io(struct bio *bio)
>  {
> @@ -281,6 +261,26 @@ struct iomap_readpage_ctx {
>  	struct list_head	*pages;
>  };
>  
> +static void
> +iomap_read_inline_data(struct inode *inode, struct page *page,
> +		struct iomap *iomap)
> +{
> +	size_t size = i_size_read(inode);
> +	void *addr;
> +
> +	if (PageUptodate(page))
> +		return;
> +
> +	BUG_ON(page->index);
> +	BUG_ON(size > PAGE_SIZE - offset_in_page(iomap->inline_data));
> +
> +	addr = kmap_atomic(page);
> +	memcpy(addr, iomap->inline_data, size);
> +	memset(addr + size, 0, PAGE_SIZE - size);
> +	kunmap_atomic(addr);
> +	SetPageUptodate(page);
> +}
> +
>  static loff_t
>  iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
>  		struct iomap *iomap)
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-02  3:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-01 16:11 [PATCH] iomap: move iomap_read_inline_data around Christoph Hellwig
2019-05-01 22:05 ` Dave Chinner
2019-05-02  3:19 ` Darrick J. Wong

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