Re: [LSF/MM/BPF TOPIC] Implementing the NFS v4.2 WRITE_SAME operation: VFS or NFS ioctl() ?

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

 



On Tue, Jan 14, 2025 at 04:38:03PM -0500, Anna Schumaker wrote:
> I've seen a few requests for implementing the NFS v4.2 WRITE_SAME [1]
> operation over the last few months [2][3] to accelerate writing
> patterns of data on the server, so it's been in the back of my mind
> for a future project. I'll need to write some code somewhere so NFS &
> NFSD can handle this request. I could keep any implementation internal
> to NFS / NFSD, but I'd like to find out if local filesystems would
> find this sort of feature useful and if I should put it in the VFS
> instead.

It would help to know more about what exactly write same does on NFS.
Is it like scsi's where you can pass a buffer and it'll write the same
buffer over and over across the device?

> I was thinking I could keep it simple, and model a function call based
> on write(3) / pwrite(3) to write some pattern N times starting at
> either the file's current offset or at a user-provide offset.
> Something like:
>     write_pattern(int filedes, const void *pattern, size_t nbytes, size_t count);
>     pwrite_pattern(int filedes, const void *pattern, size_t nbytes, size_t count, offset_t offset);

So yeah, it sounds similar.  Assuming nbytes is the size of *pattern,
and offset/count are the range to be pwritten?

> I could then construct a WRITE_SAME call in the NFS client using this
> information. This seems "good enough" to me for what people have asked
> for, at least as a client-side interface. It wouldn't really help the
> server, which would still need to do several writes in a loop to be
> spec-compliant with writing the pattern to an offset inside the
> "application data block" [4] structure.

I disagree, I think you just volunteered to plumb this pattern writing
all the way through to the block layer. ;)

> But maybe I'm simplifying this too much, and others would find the
> additional application data block fields useful? Or should I keep it
> all inside NFS, and call it with an ioctl instead of putting it into
> the VFS?

io_uring subcommand?

But I'd want to know more about what people want to use this for.
Assuming you don't just hook up FALLOC_FL_ZERO_RANGE to it and call it a
day. :)

--D

> Thoughts?
> Anna
> 
> [1]: https://datatracker.ietf.org/doc/html/rfc7862#section-15.12
> [2]: https://lore.kernel.org/linux-nfs/CAAvCNcByQhbxh9aq_z7GfHx+_=S8zVcr9-04zzdRVLpLbhxxSg@xxxxxxxxxxxxxx/
> [3]: https://lore.kernel.org/linux-nfs/CALWcw=Gg33HWRLCrj9QLXMPME=pnuZx_tE4+Pw8gwutQM4M=vw@xxxxxxxxxxxxxx/
> [4]: https://datatracker.ietf.org/doc/html/rfc7862#section-8.1
> 




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux