8202116: (fc) FileChannel.map should ensure mapped region is backed by disk space
Brian Burkhalter
brian.burkhalter at oracle.com
Mon Apr 23 20:50:53 UTC 2018
I think that these changes look OK.
Brian
On Apr 23, 2018, at 12:32 PM, Alan Bateman <Alan.Bateman at oracle.com> 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
More information about the nio-dev
mailing list