fspacectl(2) questions

From: Rick Macklem <rmacklem_at_uoguelph.ca>
Date: Wed, 18 Aug 2021 00:00:02 +0000
First off, thanks for doing this. I am just implementing the NFSv4.2
Deallocate operation using it. (I'll put the patches up on phabricator

There are a couple of things I've spotted during testing.
1 - If you specify (for example):
        rqst.r_offset = 65536
        rqst.r_len = 1048576
        and then use these to do a fspacectl(fd, SPACECTL_DEALLOC, &rqst, 0, &rqst)
   on a file < 1048576 bytes in length, it works and zeros out 65536->EOF,
   which is what I would have expected.
   However, rqst.r_offset is set to 1114112 after the syscall.
   Is that intended? I just thought it was a little weird to return r_offset > EOF instead
   of the size of the file.
   If that is the intended behaviour, I'm fine with that, but maybe "man fspacectl"
   should indicate that? Maybe something like "bytes beyond EOF in the specified
   range will not be set to zero (ie. file size not increased), but that r_offset will be
   advanced to the end of the range, even if beyond EOF".

2 - Setting
     rqst.r_offset = OFF_MAX
     rqst.r_len = 65536
     results in an EINVAL errno, which seems fine, but isn't mentioned in the
     man page.
But overall, works fine for me. (Of course, it will be nice when UFS and ZFS
get VOP_DEALLOCATE() calls that really deallocate.)

Again, thanks for doing this, rick

Received on Wed Aug 18 2021 - 00:00:02 UTC

Original text of this message