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

Langer, Christoph christoph.langer at sap.com
Mon Apr 23 21:02:27 UTC 2018


Hi Alan,

I think the changes look good.

One question, regarding the reordering of includes in unix files FileChannelImpl.c and FileDispatcherImpl.c: Wouldn't it be more natural to first include the VM includes ("jni.h", "jvm.h" etc.) and then the system includes? I think this is the rule in hotspot code, afaik.

Best regards
Christoph

> -----Original Message-----
> From: nio-dev [mailto:nio-dev-bounces at openjdk.java.net] On Behalf Of
> Alan Bateman
> Sent: Montag, 23. April 2018 21:32
> To: nio-dev at openjdk.java.net
> Subject: 8202116: (fc) FileChannel.map should ensure mapped region is
> backed by disk space
> 
> 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


More information about the nio-dev mailing list