On Thu, Jun 24, 2021 at 11:28 AM Omar Sandoval <osandov@xxxxxxxxxxx> wrote: > > 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. I really would prefer to have the separate pointer to it. Fixed size doesn't help. It's still "mixed in" unless you have a clearly separate pointer. Sure, user space *could* use a separate iov entry if it wants to, but then it becomes a user choice rather than part of the design. That separate data structure would be the only way to do it for a ioctl() interface, but in the readv/writev world the whole separate "first iov entry" does that too. I also worry that this "raw compressed data" thing isn't the only thing people will want to do. I could easily see some kind of "end-to-end CRC read/write" where the user passes in not just the data, but also checksums for it to validate it (maybe because you're doing a file copy and had the original checksums, but also maybe because user space simply has a known good copy and doesn't want errors re-introduced due to memory corruption). And I continue to think that this whole issue isn't all that different from the FSVERITY thing. Of course, the real take-away is that "preadv2/pwritev2()" is a horrible interface. It should have been more extensible, rather than the lazy "just add another flag argument". I think we finally may have gotten a real extensible interface right with openat2(), and that "open_how" thing, but maybe I'm being naive and it will turn out that that wasn't so great either. Maybe we'll some day end up with a "preadv3()" that has an extensible "struct io_how" argument. Interfaces are hard. Linus