static IOException lastErrorToException() { return new IOException(errorMessage(Native.getLastError())); }
static IOException lastErrorToException() { return new IOException(errorMessage(Native.getLastError())); }
static IOException lastErrorToException() { return new IOException(errorMessage(Native.getLastError())); }
static void fadvise(int fd, long offset, long length, int advice) throws IOException { int result = platform().fadvise(fd, offset, length, advice); if (result != 0) { throw new IOException(errorMessage(result)); } }
static void fadvise(int fd, long offset, long length, int advice) throws IOException { int result = platform().fadvise(fd, offset, length, advice); if (result != 0) { throw new IOException(errorMessage(result)); } }
@Override protected void preallocate(long pos, long length) throws IOException { if (FallocateHolder.INSTANCE == null) { // Don't have fallocate (or equivalent). Use default non-destructive zero-fill behavior. super.preallocate(pos, length); return; } // Uses posix_fallocate call to quickly allocate blocks and mark them as uninitialized. // If the filesystem supports fallocate then this requires no I/O to the data blocks, // and is much faster than zero-filling the file, which is the fallback behavior. // Since linux 2.6.31 fallocate is supported by at least btrfs, ext4, ocfs2, and // xfs filesystems. Ext4 on Linux 4.2.0 takes ~30 microseconds to fallocate 64MB, // compared to 27 milliseconds to zero-fill that same amount. // // On OSX, uses fcntl with command F_PREALLOCATE. int result = FallocateHolder.INSTANCE.fallocate(fd(), pos, length); if (result != 0) { // Note: the native call above does not set errno. throw new IOException(errorMessage(result)); } }
@Override protected void preallocate(long pos, long length) throws IOException { PlatformIO platform = platform(); if (platform == NullIO.INSTANCE) { // Don't have fallocate (or equivalent). Use default non-destructive zero-fill behavior. super.preallocate(pos, length); return; } // Uses posix_fallocate call to quickly allocate blocks and mark them as uninitialized. // If the filesystem supports fallocate then this requires no I/O to the data blocks, // and is much faster than zero-filling the file, which is the fallback behavior. // Since linux 2.6.31 fallocate is supported by at least btrfs, ext4, ocfs2, and // xfs filesystems. Ext4 on Linux 4.2.0 takes ~30 microseconds to fallocate 64MB, // compared to 27 milliseconds to zero-fill that same amount. // // On OSX, uses fcntl with command F_PREALLOCATE. int result = platform.fallocate(fd(), pos, length); if (result != 0) { // Note: the native call above does not set errno. throw new IOException(errorMessage(result)); } }
@Override protected void doPreallocate(long pos, long length) throws IOException { PlatformIO platform = platform(); if (platform == NullIO.INSTANCE) { // Don't have fallocate (or equivalent). Use default non-destructive zero-fill behavior. super.doPreallocate(pos, length); return; } // Uses posix_fallocate call to quickly allocate blocks and mark them as uninitialized. // If the filesystem supports fallocate then this requires no I/O to the data blocks, // and is much faster than zero-filling the file, which is the fallback behavior. // Since linux 2.6.31 fallocate is supported by at least btrfs, ext4, ocfs2, and // xfs filesystems. Ext4 on Linux 4.2.0 takes ~30 microseconds to fallocate 64MB, // compared to 27 milliseconds to zero-fill that same amount. // // On OSX, uses fcntl with command F_PREALLOCATE. int result = platform.fallocate(fd(), pos, length); if (result != 0) { // Note: the native call above does not set errno. throw new IOException(errorMessage(result)); } }