All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Gao Xiang <hsiangkao@linux.alibaba.com>,
	linux-erofs@lists.ozlabs.org, 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>,
	Andreas Gruenbacher <agruenba@redhat.com>
Subject: Re: [PATCH 1/2] iomap: support tail packing inline read
Date: Fri, 16 Jul 2021 15:38:48 +0100	[thread overview]
Message-ID: <YPGZ+GE/Bb0zNhzD@casper.infradead.org> (raw)
In-Reply-To: <YPGN97vWokqkWSZn@casper.infradead.org>

On Fri, Jul 16, 2021 at 02:47:35PM +0100, Matthew Wilcox wrote:
> I think it looks something like this ...
> 
> @@ -211,23 +211,18 @@ struct iomap_readpage_ctx {
>  };
> 
>  static void iomap_read_inline_data(struct inode *inode, struct folio *folio,
> -               struct iomap *iomap)
> +               struct iomap *iomap, loff_t pos, size_t size)
>  {
> -       size_t size = i_size_read(inode);
>         void *addr;
> +       size_t offset = offset_in_folio(folio, pos);
> 
> -       if (folio_test_uptodate(folio))
> -               return;
> +       BUG_ON(size != i_size_read(inode) - pos);
> 
> -       BUG_ON(folio->index);
> -       BUG_ON(folio_multi(folio));
> -       BUG_ON(size > PAGE_SIZE - offset_in_page(iomap->inline_data));
> -
> -       addr = kmap_local_folio(folio, 0);
> +       addr = kmap_local_folio(folio, offset);
>         memcpy(addr, iomap->inline_data, size);
>         memset(addr + size, 0, PAGE_SIZE - size);
>         kunmap_local(addr);
> -       folio_mark_uptodate(folio);
> +       iomap_set_range_uptodate(folio, to_iomap_page(folio), pos, size);

That should be s/size/PAGE_SIZE - offset/
(because this has just zeroed all the bytes in the page after end-of-file)

WARNING: multiple messages have this Message-ID
From: Matthew Wilcox <willy@infradead.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Andreas Gruenbacher <agruenba@redhat.com>,
	"Darrick J. Wong" <djwong@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Joseph Qi <joseph.qi@linux.alibaba.com>,
	Liu Bo <bo.liu@linux.alibaba.com>,
	linux-fsdevel@vger.kernel.org,
	Gao Xiang <hsiangkao@linux.alibaba.com>,
	Liu Jiang <gerry@linux.alibaba.com>,
	linux-erofs@lists.ozlabs.org
Subject: Re: [PATCH 1/2] iomap: support tail packing inline read
Date: Fri, 16 Jul 2021 15:38:48 +0100	[thread overview]
Message-ID: <YPGZ+GE/Bb0zNhzD@casper.infradead.org> (raw)
In-Reply-To: <YPGN97vWokqkWSZn@casper.infradead.org>

On Fri, Jul 16, 2021 at 02:47:35PM +0100, Matthew Wilcox wrote:
> I think it looks something like this ...
> 
> @@ -211,23 +211,18 @@ struct iomap_readpage_ctx {
>  };
> 
>  static void iomap_read_inline_data(struct inode *inode, struct folio *folio,
> -               struct iomap *iomap)
> +               struct iomap *iomap, loff_t pos, size_t size)
>  {
> -       size_t size = i_size_read(inode);
>         void *addr;
> +       size_t offset = offset_in_folio(folio, pos);
> 
> -       if (folio_test_uptodate(folio))
> -               return;
> +       BUG_ON(size != i_size_read(inode) - pos);
> 
> -       BUG_ON(folio->index);
> -       BUG_ON(folio_multi(folio));
> -       BUG_ON(size > PAGE_SIZE - offset_in_page(iomap->inline_data));
> -
> -       addr = kmap_local_folio(folio, 0);
> +       addr = kmap_local_folio(folio, offset);
>         memcpy(addr, iomap->inline_data, size);
>         memset(addr + size, 0, PAGE_SIZE - size);
>         kunmap_local(addr);
> -       folio_mark_uptodate(folio);
> +       iomap_set_range_uptodate(folio, to_iomap_page(folio), pos, size);

That should be s/size/PAGE_SIZE - offset/
(because this has just zeroed all the bytes in the page after end-of-file)

  reply	other threads:[~2021-07-16 14:40 UTC|newest]

Thread overview: 39+ 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 ` Gao Xiang
2021-07-16  5:07 ` [PATCH 1/2] iomap: support tail packing inline read Gao Xiang
2021-07-16  5:07   ` Gao Xiang
2021-07-16  9:19   ` Christoph Hellwig
2021-07-16  9:19     ` Christoph Hellwig
2021-07-16  9:46     ` Gao Xiang
2021-07-16  9:46       ` Gao Xiang
2021-07-16 13:47     ` Matthew Wilcox
2021-07-16 13:47       ` Matthew Wilcox
2021-07-16 14:38       ` Matthew Wilcox [this message]
2021-07-16 14:38         ` Matthew Wilcox
2021-07-16 13:02   ` Matthew Wilcox
2021-07-16 13:02     ` Matthew Wilcox
2021-07-16 13:56     ` Gao Xiang
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:03           ` Gao Xiang
2021-07-16 15:53           ` Andreas Grünbacher
2021-07-16 15:53             ` Andreas Grünbacher
2021-07-17 13:38             ` Gao Xiang
2021-07-17 13:38               ` Gao Xiang
2021-07-17 15:01               ` Matthew Wilcox
2021-07-17 15:15                 ` Gao Xiang
2021-07-17 15:15                   ` Gao Xiang
2021-07-17 18:40                   ` Matthew Wilcox
2021-07-19 11:19                     ` Christoph Hellwig
2021-07-19 11:19                       ` Christoph Hellwig
2021-07-19 13:45                       ` Gao Xiang
2021-07-19 13:45                         ` Gao Xiang
2021-07-19 11:15               ` Christoph Hellwig
2021-07-19 13:31                 ` Gao Xiang
2021-07-19 13:31                   ` Gao Xiang
2021-07-16  5:07 ` [PATCH 2/2] erofs: convert all uncompressed cases to iomap Gao Xiang
2021-07-16  5:07   ` Gao Xiang
2021-07-18  5:30   ` kernel test robot
2021-07-18  5:30   ` [RFC PATCH] erofs: erofs_iomap_end() can be static kernel test robot
2021-07-18 16:53     ` 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=YPGZ+GE/Bb0zNhzD@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=agruenba@redhat.com \
    --cc=bo.liu@linux.alibaba.com \
    --cc=chao@kernel.org \
    --cc=djwong@kernel.org \
    --cc=gerry@linux.alibaba.com \
    --cc=hch@infradead.org \
    --cc=hsiangkao@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 \
    /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.