Messages in this thread |  | | From | Andreas Grünbacher <> | Date | Mon, 26 Jul 2021 14:27:12 +0200 | Subject | Re: [PATCH v7] iomap: make inline data support more flexible |
| |
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
|  |