Subject: Re: [nfsv4] sparse files support for NFS

From: Marc Eshel <[email-masked]>
Date: Tue, 29 Sep 2009 10:03:02 -0700

I would like to propose an extension to NFSv4.2 to support sparse files. 
Sparse files are very common way to represent huge files like a database 
file or a virtual machine image. In some case the application will be 
aware of the file organization and will avoid reading the holes in the 
file but it will not work if the NFS clients which is between the 
application and the file server doesn't have this knowledge. If it tries 
to prefetch few blocks or the complete file in anticipation of its use it 
might read the holes in the files and that can be very expensive over NFS.

The proposal is to modify the READ RPC to avoid reading the holes in 
sparse file. First step a very simple one, instead of returning a block of 
zeros, just return a return code E_HOLE and avoid transferring a lock of 
zeros over the network. Step two can also provide additional information 
along with the E_HOLE return code to specify the offset of next data chunk 
and the length of it. Step three would be to use pNFS layouts to describe 
the holes in the file and avoid reading them by the client all together.

Marc.