Re: WRITE_SAME support in FreeBSD nfsd NFSv4.1 mode?

From: Warner Losh <imp_at_bsdimp.com>
Date: Fri, 10 Jan 2025 16:17:19 UTC
On Fri, Jan 10, 2025 at 7:58 AM Rick Macklem <rick.macklem@gmail.com> wrote:

> On Thu, Jan 9, 2025 at 8:14 PM Dan Shelton <dan.f.shelton@gmail.com>
> wrote:
> >
> > On Fri, 10 Jan 2025 at 02:59, Rick Macklem <rick.macklem@gmail.com>
> wrote:
> > >
> > > On Thu, Jan 9, 2025 at 4:31 PM Dan Shelton <dan.f.shelton@gmail.com>
> wrote:
> > > >
> > > > Hello!
> > > >
> > > > Does FreeBSD nfsd support the WRITE_SAME request in NFSv4.1 mode?
> > > Not at this time, I'm afraid.
> > >
> > > Maybe in a future release, rick
> >
> > How fast could it be implemented?
> For the simplest version, not too long.
> The simplest version would be synchronous only and use
> VOP_WRITE() calls. Doing a new VOP_xxx() call to try and optimize
> it per-fs would take quite a bit longer. (I know very little about ZFS,
> but just
> maybe, block cloning would be useful for this?)
>

I had discussions years ago about adding a BIO_WRITE_SAME and whether or
not it made sense.
It's mildly helpful to just send one write command that writes all the LBAs
using the SCSI WRITE SAME
command. But it got hairy in a hurry and WRITE SAME is mostly only used to
unmap / trim blocks
anyway.

But only SCSI drives support this, and it's been too long to recall if they
all support writing multiple
blocks from the same OUT BUFFER or not. NVME doesn't have a similar concept
(just write zeros),
so I gave up on it. I didn't have a good use case for it.

Warner


> Btw, it is a NFSv4.2 call, so it would only be supported for NFSv4.2 and
> not
> NFSv4.1.
>
> rick
>
> >
> > Dan
> > --
> > Dan Shelton - Cluster Specialist Win/Lin/Bsd
> >
>
>