From: "Andreas Grünbacher" <andreas.gruenbacher@gmail.com> To: Christoph Hellwig <hch@lst.de> Cc: Andreas Gruenbacher <agruenba@redhat.com>, Gao Xiang <hsiangkao@linux.alibaba.com>, "Darrick J . Wong" <djwong@kernel.org>, Matthew Wilcox <willy@infradead.org>, Huang Jianan <huangjianan@oppo.com>, linux-erofs@lists.ozlabs.org, Linux FS-devel Mailing List <linux-fsdevel@vger.kernel.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org> Subject: Re: [PATCH v7] iomap: make inline data support more flexible Date: Mon, 26 Jul 2021 14:27:12 +0200 [thread overview] Message-ID: <CAHpGcMJhuSApy4eg9jKe2pYq4d7bY-Lg-Bmo9tOANghQ2Hxo-A@mail.gmail.com> (raw) In-Reply-To: <20210726121702.GA528@lst.de> Am Mo., 26. Juli 2021 um 14:17 Uhr schrieb Christoph Hellwig <hch@lst.de>: > > > Subject: iomap: Support tail packing > > I can't say I like this "tail packing" language here when we have the > perfectly fine inline wording. Same for various comments in the actual > code. > > > + /* inline and tail-packed data must start page aligned in the file */ > > + if (WARN_ON_ONCE(offset_in_page(iomap->offset))) > > + return -EIO; > > + if (WARN_ON_ONCE(size > PAGE_SIZE - offset_in_page(iomap->inline_data))) > > + return -EIO; > > Why can't we use iomap_inline_data_size_valid here? We can now. Gao, can you change that? > That is how can size be different from iomap->length? Quoting from my previous reply, "In the iomap_readpage case (iomap_begin with flags == 0), iomap->length will be the amount of data up to the end of the inode. In the iomap_file_buffered_write case (iomap_begin with flags == IOMAP_WRITE), iomap->length will be the size of iomap->inline_data. (For extending writes, we need to write beyond the current end of inode.) So iomap->length isn't all that useful for iomap_read_inline_data." > Shouldn't the offset_in_page also go into iomap_inline_data_size_valid, > which should probably be called iomap_inline_data_valid then? Hmm, not sure what you mean: iomap_inline_data_size_valid does take offset_in_page(iomap->inline_data) into account. > > if (iomap->type == IOMAP_INLINE) { > > + int ret = iomap_read_inline_data(inode, page, iomap); > > + return ret ?: PAGE_SIZE; > > The ?: expression without the first leg is really confuing. Especially > if a good old if is much more readable here. I'm sure Gao can change this. > int ret = iomap_read_inline_data(inode, page, iomap); > > if (ret) > return ret; > return PAGE_SIZE; > > > + copied = copy_from_iter(iomap_inline_data(iomap, pos), length, iter); > > > > + copied = copy_to_iter(iomap_inline_data(iomap, pos), length, iter); > > Pleae avoid the overly long lines. I thought people were okay with 80 character long lines? Thanks, Andreas
WARNING: multiple messages have this Message-ID (diff)
From: "Andreas Grünbacher" <andreas.gruenbacher@gmail.com> To: Christoph Hellwig <hch@lst.de> Cc: Andreas Gruenbacher <agruenba@redhat.com>, "Darrick J . Wong" <djwong@kernel.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, Matthew Wilcox <willy@infradead.org>, Linux FS-devel Mailing List <linux-fsdevel@vger.kernel.org>, linux-erofs@lists.ozlabs.org Subject: Re: [PATCH v7] iomap: make inline data support more flexible Date: Mon, 26 Jul 2021 14:27:12 +0200 [thread overview] Message-ID: <CAHpGcMJhuSApy4eg9jKe2pYq4d7bY-Lg-Bmo9tOANghQ2Hxo-A@mail.gmail.com> (raw) In-Reply-To: <20210726121702.GA528@lst.de> Am Mo., 26. Juli 2021 um 14:17 Uhr schrieb Christoph Hellwig <hch@lst.de>: > > > Subject: iomap: Support tail packing > > I can't say I like this "tail packing" language here when we have the > perfectly fine inline wording. Same for various comments in the actual > code. > > > + /* inline and tail-packed data must start page aligned in the file */ > > + if (WARN_ON_ONCE(offset_in_page(iomap->offset))) > > + return -EIO; > > + if (WARN_ON_ONCE(size > PAGE_SIZE - offset_in_page(iomap->inline_data))) > > + return -EIO; > > Why can't we use iomap_inline_data_size_valid here? We can now. Gao, can you change that? > That is how can size be different from iomap->length? Quoting from my previous reply, "In the iomap_readpage case (iomap_begin with flags == 0), iomap->length will be the amount of data up to the end of the inode. In the iomap_file_buffered_write case (iomap_begin with flags == IOMAP_WRITE), iomap->length will be the size of iomap->inline_data. (For extending writes, we need to write beyond the current end of inode.) So iomap->length isn't all that useful for iomap_read_inline_data." > Shouldn't the offset_in_page also go into iomap_inline_data_size_valid, > which should probably be called iomap_inline_data_valid then? Hmm, not sure what you mean: iomap_inline_data_size_valid does take offset_in_page(iomap->inline_data) into account. > > if (iomap->type == IOMAP_INLINE) { > > + int ret = iomap_read_inline_data(inode, page, iomap); > > + return ret ?: PAGE_SIZE; > > The ?: expression without the first leg is really confuing. Especially > if a good old if is much more readable here. I'm sure Gao can change this. > int ret = iomap_read_inline_data(inode, page, iomap); > > if (ret) > return ret; > return PAGE_SIZE; > > > + copied = copy_from_iter(iomap_inline_data(iomap, pos), length, iter); > > > > + copied = copy_to_iter(iomap_inline_data(iomap, pos), length, iter); > > Pleae avoid the overly long lines. I thought people were okay with 80 character long lines? Thanks, Andreas
next prev parent reply other threads:[~2021-07-26 12:27 UTC|newest] Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-23 17:41 [PATCH v7] iomap: make inline data support more flexible Gao Xiang 2021-07-23 17:41 ` Gao Xiang 2021-07-23 19:40 ` Matthew Wilcox 2021-07-23 19:40 ` Matthew Wilcox 2021-07-24 0:54 ` Gao Xiang 2021-07-24 0:54 ` Gao Xiang 2021-07-25 21:39 ` Andreas Grünbacher 2021-07-25 21:39 ` Andreas Grünbacher 2021-07-25 22:16 ` Andreas Gruenbacher 2021-07-25 22:16 ` Andreas Gruenbacher 2021-07-26 2:36 ` Gao Xiang 2021-07-26 2:36 ` Gao Xiang 2021-07-26 7:22 ` Andreas Gruenbacher 2021-07-26 7:22 ` Andreas Gruenbacher 2021-07-26 7:38 ` Gao Xiang 2021-07-26 7:38 ` Gao Xiang 2021-07-26 21:36 ` Darrick J. Wong 2021-07-26 21:36 ` Darrick J. Wong 2021-07-26 22:20 ` Andreas Grünbacher 2021-07-26 22:20 ` Andreas Grünbacher 2021-07-26 3:06 ` Matthew Wilcox 2021-07-26 3:06 ` Matthew Wilcox 2021-07-26 6:56 ` Andreas Gruenbacher 2021-07-26 6:56 ` Andreas Gruenbacher 2021-07-26 4:00 ` Gao Xiang 2021-07-26 4:00 ` Gao Xiang 2021-07-26 8:08 ` Andreas Grünbacher 2021-07-26 8:08 ` Andreas Grünbacher 2021-07-26 8:17 ` Gao Xiang 2021-07-26 8:17 ` Gao Xiang 2021-07-26 11:06 ` Andreas Gruenbacher 2021-07-26 11:06 ` Andreas Gruenbacher 2021-07-26 12:17 ` Christoph Hellwig 2021-07-26 12:17 ` Christoph Hellwig 2021-07-26 12:27 ` Andreas Grünbacher [this message] 2021-07-26 12:27 ` Andreas Grünbacher 2021-07-26 12:50 ` Gao Xiang 2021-07-26 12:50 ` Gao Xiang 2021-07-26 13:10 ` Andreas Gruenbacher 2021-07-26 13:27 ` Christoph Hellwig 2021-07-26 13:27 ` Christoph Hellwig 2021-07-27 8:20 ` David Sterba 2021-07-27 8:20 ` David Sterba 2021-07-27 13:35 ` Matthew Wilcox 2021-07-27 15:04 ` Gao Xiang 2021-07-27 15:04 ` Gao Xiang 2021-07-27 16:53 ` David Sterba 2021-07-27 16:53 ` David Sterba 2021-07-26 12:32 ` Matthew Wilcox 2021-07-26 12:32 ` Matthew Wilcox 2021-07-26 13:03 ` Andreas Gruenbacher 2021-07-26 13:03 ` Andreas Gruenbacher 2021-07-26 13:12 ` Gao Xiang 2021-07-26 13:12 ` Gao Xiang 2021-07-26 13:30 ` Christoph Hellwig 2021-07-26 8:08 ` Joseph Qi 2021-07-26 8:08 ` Joseph Qi 2021-08-01 10:29 Andreas Gruenbacher 2021-08-01 10:29 ` Andreas Gruenbacher
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=CAHpGcMJhuSApy4eg9jKe2pYq4d7bY-Lg-Bmo9tOANghQ2Hxo-A@mail.gmail.com \ --to=andreas.gruenbacher@gmail.com \ --cc=agruenba@redhat.com \ --cc=djwong@kernel.org \ --cc=hch@lst.de \ --cc=hsiangkao@linux.alibaba.com \ --cc=huangjianan@oppo.com \ --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: linkBe 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.