Re: [PATCH RESEND x3 v9 1/9] iov_iter: add copy_struct_from_iter()
From: Omar Sandoval <osandov@osandov.com>
Date: 2021-06-24 18:28:41
Also in:
linux-btrfs, linux-fsdevel
From: Omar Sandoval <osandov@osandov.com>
Date: 2021-06-24 18:28:41
Also in:
linux-btrfs, linux-fsdevel
On Thu, Jun 24, 2021 at 10:52:17AM -0700, Linus Torvalds wrote:
On Wed, Jun 23, 2021 at 11:15 PM Omar Sandoval [off-list ref] wrote:quoted
On Thu, Jun 24, 2021 at 03:00:39AM +0100, Matthew Wilcox wrote:quoted
Does that work for O_DIRECT and the required 512-byte alignment?I suppose the kernel could pad the encoded_iov structure with zeroes to the next sector boundary, since zeroes are effectively noops for encoded_iov.Ugh. I really think the whole "embed the control structure in the stream" is wrong. The alignment issue is just another sign of that. Separating it out is the right thing to do. At least the "first iov entry" thing did separate the control structure from the actual data. I detest the whole "embed the two together".
I'll suggest the fixed-size struct encoded_iov again, then. If we're willing to give up some of the flexibility of a variable size, then userspace can always put the fixed-size structure in its own iovec or include it inline with the data, depending on what's more convenient and whether it's using O_DIRECT. A fixed size is much easier for both the kernel and userspace to deal with. Do we really need to support unlimited extensions to encoded_iov, or can we stick 32-64 bytes of reserved space at the end of the structure and call it a day?