linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Andreas Gr??nbacher <andreas.gruenbacher@gmail.com>,
	Christoph Hellwig <hch@infradead.org>,
	Matthew Wilcox <willy@infradead.org>,
	linux-erofs@lists.ozlabs.org,
	Linux FS-devel Mailing List <linux-fsdevel@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Darrick J. Wong" <djwong@kernel.org>, Chao Yu <chao@kernel.org>,
	Liu Bo <bo.liu@linux.alibaba.com>,
	Joseph Qi <joseph.qi@linux.alibaba.com>,
	Liu Jiang <gerry@linux.alibaba.com>
Subject: Re: [PATCH 1/2] iomap: support tail packing inline read
Date: Mon, 19 Jul 2021 12:15:47 +0100	[thread overview]
Message-ID: <YPVe41YqpfGLNsBS@infradead.org> (raw)
In-Reply-To: <YPLdSja/4FBsjss/@B-P7TQMD6M-0146.local>

On Sat, Jul 17, 2021 at 09:38:18PM +0800, Gao Xiang wrote:
> >From 62f367245492e389711bcebbf7da5adae586299f Mon Sep 17 00:00:00 2001
> From: Christoph Hellwig <hch@lst.de>
> Date: Fri, 16 Jul 2021 10:52:48 +0200
> Subject: [PATCH] iomap: support tail packing inline read

I'd still credit this to you as you did all the hard work.

> +	/* inline source data must be inside a single page */
> +	BUG_ON(iomap->length > PAGE_SIZE - offset_in_page(iomap->inline_data));
> +	/* handle tail-packing blocks cross the current page into the next */
> +	if (size > PAGE_SIZE - poff)
> +		size = PAGE_SIZE - poff;

This should probably use min or min_t.

>  
>  	addr = kmap_atomic(page);
> -	memcpy(addr, iomap->inline_data, size);
> -	memset(addr + size, 0, PAGE_SIZE - size);
> +	memcpy(addr + poff, iomap->inline_data - iomap->offset + pos, size);
> +	memset(addr + poff + size, 0, PAGE_SIZE - poff - size);
>  	kunmap_atomic(addr);
> -	SetPageUptodate(page);
> +	flush_dcache_page(page);

The flush_dcache_page addition should be a separate patch.

>  
>  	if (dio->flags & IOMAP_DIO_WRITE) {
>  		loff_t size = inode->i_size;
> @@ -394,7 +395,8 @@ iomap_dio_inline_actor(struct inode *inode, loff_t pos, loff_t length,
>  			mark_inode_dirty(inode);
>  		}
>  	} else {
> -		copied = copy_to_iter(iomap->inline_data + pos, length, iter);
> +		copied = copy_to_iter(iomap->inline_data + pos - iomap->offset,
> +				length, iter);

We also need to take the offset into account for the write side.
I guess it would be nice to have a local variable for the inline
address to not duplicate that calculation multiple times.

  parent reply	other threads:[~2021-07-19 11:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16  5:07 [PATCH 0/2] erofs: iomap support for tailpacking cases Gao Xiang
2021-07-16  5:07 ` [PATCH 1/2] iomap: support tail packing inline read Gao Xiang
2021-07-16  9:19   ` Christoph Hellwig
2021-07-16  9:46     ` Gao Xiang
2021-07-16 13:47     ` Matthew Wilcox
2021-07-16 14:38       ` Matthew Wilcox
2021-07-16 13:02   ` Matthew Wilcox
2021-07-16 13:56     ` Gao Xiang
2021-07-16 14:44       ` Matthew Wilcox
2021-07-16 15:03         ` Gao Xiang
2021-07-16 15:53           ` Andreas Grünbacher
2021-07-17 13:38             ` Gao Xiang
2021-07-17 15:01               ` Matthew Wilcox
2021-07-17 15:15                 ` Gao Xiang
2021-07-17 18:40                   ` Matthew Wilcox
2021-07-19 11:19                     ` Christoph Hellwig
2021-07-19 13:45                       ` Gao Xiang
2021-07-19 11:15               ` Christoph Hellwig [this message]
2021-07-19 13:31                 ` Gao Xiang
2021-07-16  5:07 ` [PATCH 2/2] erofs: convert all uncompressed cases to iomap Gao Xiang

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=YPVe41YqpfGLNsBS@infradead.org \
    --to=hch@infradead.org \
    --cc=andreas.gruenbacher@gmail.com \
    --cc=bo.liu@linux.alibaba.com \
    --cc=chao@kernel.org \
    --cc=djwong@kernel.org \
    --cc=gerry@linux.alibaba.com \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=willy@infradead.org \
    --subject='Re: [PATCH 1/2] iomap: support tail packing inline read' \
    /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

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