8202116: (fc) FileChannel.map should ensure mapped region is backed by disk space

Ivan Gerasimov ivan.gerasimov at oracle.com
Mon Apr 23 21:12:50 UTC 2018


I only read the changes for educational purposes, so it's not a review, 
though it looks good :)

In FileChannelImpl.c there's a typo in the copyright header: s/20178/2018/

With kind regards,
Ivan

On 4/23/18 12:32 PM, Alan Bateman wrote:
> This is a follow-up to the "Changes to RandomAccessFile in jdk9" 
> thread and the change in JDK 9 (and 8u162) to 
> RandomAccessFile.setLengthforce to force disk space to be allocated 
> for otherwise sparse files.
>
> The patch here is essentially a re-visit of JDK-8168628. 
> RandomAccessFile.setLength is reverted so that it doesn't allocate the 
> disk space. Instead, FileChannel.map is changed to allocate the disk 
> space for the case that the region to be mapped overlaps with a hole 
> in a sparse file. Testing the changes is awkward as the conditions for 
> JDK-8168628 require filing up the file system to prevent space being 
> allocated. Brian created an @ignore-ed test for JDK-8168628 so that is 
> useful to re-create the conditions. In addition, several of the 
> existing tests exercise this code as they (unknowingly) create spare 
> files.
>
> The webrev with the changes is here:
>    http://cr.openjdk.java.net/~alanb/8202116/webrev/
>
> -Alan
>

-- 
With kind regards,
Ivan Gerasimov



More information about the nio-dev mailing list