On Thu, Jun 24, 2021 at 10:52:17AM -0700, Linus Torvalds wrote: > On Wed, Jun 23, 2021 at 11:15 PM Omar Sandoval <osandov@xxxxxxxxxxx> wrote: > > > > On Thu, Jun 24, 2021 at 03:00:39AM +0100, Matthew Wilcox wrote: > > > > > > 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?