All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	"Darrick J . Wong" <djwong@kernel.org>,
	Andreas Gruenbacher <andreas.gruenbacher@gmail.com>
Subject: Re: [PATCH v3] iomap: support tail packing inline read
Date: Tue, 20 Jul 2021 00:45:30 +0800	[thread overview]
Message-ID: <YPWsKi33ZOS2rhCy@B-P7TQMD6M-0146.local> (raw)
In-Reply-To: <YPWozhzNIljcC83R@casper.infradead.org>

On Mon, Jul 19, 2021 at 05:31:10PM +0100, Matthew Wilcox wrote:
> On Tue, Jul 20, 2021 at 12:11:49AM +0800, Gao Xiang wrote:
> > On Mon, Jul 19, 2021 at 05:13:10PM +0200, Christoph Hellwig wrote:
> > > On Mon, Jul 19, 2021 at 04:02:30PM +0100, Matthew Wilcox wrote:
> > > > > +	if (iomap->type == IOMAP_INLINE) {
> > > > > +		iomap_read_inline_data(inode, page, iomap, pos);
> > > > > +		plen = PAGE_SIZE - poff;
> > > > > +		goto done;
> > > > > +	}
> > > > 
> > > > This is going to break Andreas' case that he just patched to work.
> > > > GFS2 needs for there to _not_ be an iop for inline data.  That's
> > > > why I said we need to sort out when to create an iop before moving
> > > > the IOMAP_INLINE case below the creation of the iop.
> > > > 
> > > > If we're not going to do that first, then I recommend leaving the
> > > > IOMAP_INLINE case where it is and changing it to ...
> > > > 
> > > > 	if (iomap->type == IOMAP_INLINE)
> > > > 		return iomap_read_inline_data(inode, page, iomap, pos);
> > > > 
> > > > ... and have iomap_read_inline_data() return the number of bytes that
> > > > it copied + zeroed (ie PAGE_SIZE - poff).
> > > 
> > > Returning the bytes is much cleaner anyway.  But we still need to deal
> > > with the sub-page uptodate status in one form or another.
> > 
> > There is another iomap_read_inline_data() caller as in:
> > +static int iomap_write_begin_inline(struct inode *inode, loff_t pos,
> > +		struct page *page, struct iomap *srcmap)
> > +{
> > +	/* needs more work for the tailpacking case, disable for now */
> > +	if (WARN_ON_ONCE(pos != 0))
> > +		return -EIO;
> > +	if (PageUptodate(page))
> > +		return 0;
> > +	iomap_read_inline_data(inode, page, srcmap, pos);
> > +	return 0;
> > +}
> > 
> > I'd like to avoid it as (void)iomap_read_inline_data(...). That's why it
> > left as void return type.
> 
> You don't need to cast away the return value in C.

Well, I don't check the current behavior of this, but see:
http://c-faq.com/style/voidcasts.html

Anyway, that's minor and easy to update if really needed.
I'd like to check if it works first...

Thanks,
Gao Xiang


WARNING: multiple messages have this Message-ID (diff)
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: "Darrick J . Wong" <djwong@kernel.org>,
	Andreas Gruenbacher <andreas.gruenbacher@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v3] iomap: support tail packing inline read
Date: Tue, 20 Jul 2021 00:45:30 +0800	[thread overview]
Message-ID: <YPWsKi33ZOS2rhCy@B-P7TQMD6M-0146.local> (raw)
In-Reply-To: <YPWozhzNIljcC83R@casper.infradead.org>

On Mon, Jul 19, 2021 at 05:31:10PM +0100, Matthew Wilcox wrote:
> On Tue, Jul 20, 2021 at 12:11:49AM +0800, Gao Xiang wrote:
> > On Mon, Jul 19, 2021 at 05:13:10PM +0200, Christoph Hellwig wrote:
> > > On Mon, Jul 19, 2021 at 04:02:30PM +0100, Matthew Wilcox wrote:
> > > > > +	if (iomap->type == IOMAP_INLINE) {
> > > > > +		iomap_read_inline_data(inode, page, iomap, pos);
> > > > > +		plen = PAGE_SIZE - poff;
> > > > > +		goto done;
> > > > > +	}
> > > > 
> > > > This is going to break Andreas' case that he just patched to work.
> > > > GFS2 needs for there to _not_ be an iop for inline data.  That's
> > > > why I said we need to sort out when to create an iop before moving
> > > > the IOMAP_INLINE case below the creation of the iop.
> > > > 
> > > > If we're not going to do that first, then I recommend leaving the
> > > > IOMAP_INLINE case where it is and changing it to ...
> > > > 
> > > > 	if (iomap->type == IOMAP_INLINE)
> > > > 		return iomap_read_inline_data(inode, page, iomap, pos);
> > > > 
> > > > ... and have iomap_read_inline_data() return the number of bytes that
> > > > it copied + zeroed (ie PAGE_SIZE - poff).
> > > 
> > > Returning the bytes is much cleaner anyway.  But we still need to deal
> > > with the sub-page uptodate status in one form or another.
> > 
> > There is another iomap_read_inline_data() caller as in:
> > +static int iomap_write_begin_inline(struct inode *inode, loff_t pos,
> > +		struct page *page, struct iomap *srcmap)
> > +{
> > +	/* needs more work for the tailpacking case, disable for now */
> > +	if (WARN_ON_ONCE(pos != 0))
> > +		return -EIO;
> > +	if (PageUptodate(page))
> > +		return 0;
> > +	iomap_read_inline_data(inode, page, srcmap, pos);
> > +	return 0;
> > +}
> > 
> > I'd like to avoid it as (void)iomap_read_inline_data(...). That's why it
> > left as void return type.
> 
> You don't need to cast away the return value in C.

Well, I don't check the current behavior of this, but see:
http://c-faq.com/style/voidcasts.html

Anyway, that's minor and easy to update if really needed.
I'd like to check if it works first...

Thanks,
Gao Xiang


  reply	other threads:[~2021-07-19 18:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19 14:47 [PATCH v3] iomap: support tail packing inline read Gao Xiang
2021-07-19 14:47 ` Gao Xiang
2021-07-19 15:02 ` Matthew Wilcox
2021-07-19 15:02   ` Matthew Wilcox
2021-07-19 15:13   ` Christoph Hellwig
2021-07-19 15:13     ` Christoph Hellwig
2021-07-19 16:11     ` Gao Xiang
2021-07-19 16:11       ` Gao Xiang
2021-07-19 16:31       ` Matthew Wilcox
2021-07-19 16:45         ` Gao Xiang [this message]
2021-07-19 16:45           ` Gao Xiang
2021-07-19 15:29   ` Gao Xiang
2021-07-19 15:29     ` Gao Xiang
2021-07-19 15:31     ` Andreas Grünbacher
2021-07-19 15:31       ` Andreas Grünbacher
2021-07-19 15:36       ` Gao Xiang
2021-07-19 15:36         ` Gao Xiang
2021-07-20 11:23 ` Andreas Grünbacher
2021-07-20 11:23   ` Andreas Grünbacher
2021-07-20 12:10   ` Gao Xiang
2021-07-20 12:10     ` Gao Xiang
2021-07-20 11:34 ` Andreas Grünbacher
2021-07-20 11:34   ` Andreas Grünbacher
2021-07-20 12:23   ` Gao Xiang
2021-07-20 12:23     ` 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=YPWsKi33ZOS2rhCy@B-P7TQMD6M-0146.local \
    --to=hsiangkao@linux.alibaba.com \
    --cc=andreas.gruenbacher@gmail.com \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.