[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Linux kernel NBD driver support for structured replies?



On Tue, Sep 07, 2021 at 02:19:32PM -0700, Josh Triplett wrote:
> I'm currently using the NBD client driver in the Linux kernel. At some
> point, I'd be interested in adding support for structured replies,
> specifically so that an NBD server can efficiently handle ranges of
> zeroes (e.g.  "for the 4k block you asked for, here are 200 bytes of
> data, and the rest if zero").

I don't know if you'll get the granularity of 200 bytes given the
nature of file system blocking, but it's definitely worth adding the
support so that "for the 64k block you asked for, here are 4k of data
and the rest is zero".

It will also pay dividends if you also add support for querying the
"base:allocation" meta context information, so that the kernel can
then acurately implement lseek(SEEK_HOLE) and similar on an NBD
device, since that also requires structured reply support.

> 
> Does that seem reasonable to add to the kernel driver? I wanted to check
> before considering development of a patch.

I'm not aware of anyone else doing it yet (I haven't yet been brave
enough to dive into implementing this in the kernel, although I have
implemented it in user space in both qemu and libnbd).  I'm certainly
happy to help with integration testing, or give you tips on how to
test it.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


Reply to: