2023-11-30 10:18:09

by Cedric Blancher

[permalink] [raw]
Subject: NFSv4.2: How to deallocate a range of bytes in a file, aka "punch a hole"?

Good morning!

Linux has fallocate(fd, FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE, ...)
to punch a hole into a file, i.e. deallocate the blocks given and make
the file a "sparse file".

But how is this implemented on NFSv4.2 COMPOUND level? How does a
NFSv4 compound look like to punch a hole say from position 30000 to
position 35721?

Ced
--
Cedric Blancher <[email protected]>
[https://plus.google.com/u/0/+CedricBlancher/]
Institute Pasteur


2023-11-30 12:45:30

by Benjamin Coddington

[permalink] [raw]
Subject: Re: NFSv4.2: How to deallocate a range of bytes in a file, aka "punch a hole"?

On 30 Nov 2023, at 5:18, Cedric Blancher wrote:

> Good morning!
>
> Linux has fallocate(fd, FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE, ...)
> to punch a hole into a file, i.e. deallocate the blocks given and make
> the file a "sparse file".
>
> But how is this implemented on NFSv4.2 COMPOUND level? How does a
> NFSv4 compound look like to punch a hole say from position 30000 to
> position 35721?

Are you interested in the current linux client's implementation? You could
look at a wire capture of the operation to find out.

Its going to be something like PUTFH, DEALLOCATE, GETATTR..

Ben