On Thu, Aug 15, 2019 at 02:04:06PM -0700, Omar Sandoval wrote: > From: Omar Sandoval <osan...@fb.com> > > This adds an API for writing compressed data directly to the filesystem. > The use case that I have in mind is send/receive: currently, when > sending data from one compressed filesystem to another, the sending side > decompresses the data and the receiving side recompresses it before > writing it out. This is wasteful and can be avoided if we can just send > and write compressed extents. The send part will be implemented in a > separate series, as this ioctl can stand alone. > > The interface is essentially pwrite(2) with some extra information: > > - The input buffer contains the compressed data. > - Both the compressed and decompressed sizes of the data are given. > - The compression type (zlib, lzo, or zstd) is given. > > A more detailed description of the interface, including restrictions and > edge cases, is included in include/uapi/linux/btrfs.h. > > The implementation is similar to direct I/O: we have to flush any > ordered extents, invalidate the page cache, and do the io > tree/delalloc/extent map/ordered extent dance. From there, we can reuse > the compression code with a minor modification to distinguish the new > ioctl from writeback. >
I've looked at this a few times, the locking and space reservation stuff look right. What about encrypted send/recieve? Are we going to want to use this to just blind copy encrypted data without having to decrypt/re-encrypt? Should this be taken into consideration for this interface? I'll think more about it, but I can't really see any better option than this. Thanks, Josef