private static void trySyncFileRange ( int fd , long offset , long nbytes , int flags ) { if ( ! initialized || ! syncFileRangePossible || fd < 0 ) { return ; } try { int ret_code = sync_file_range ( fd , offset , nbytes , flags ) ; if ( ret_code != 0 ) { log . warn ( "failed on syncing fd [%d], offset [%d], bytes [%d], ret_code [%d], errno [%d]" , fd , offset , nbytes , ret_code , Native . getLastError ( ) ) ; return ; } } catch ( UnsupportedOperationException uoe ) { log . warn ( uoe , "sync_file_range is not supported" ) ; syncFileRangePossible = false ; } catch ( UnsatisfiedLinkError nle ) { log . warn ( nle , "sync_file_range failed on fd [%d], offset [%d], bytes [%d]" , fd , offset , nbytes ) ; syncFileRangePossible = false ; } catch ( Exception e ) { log . warn ( e , "Unknown exception: sync_file_range failed on fd [%d], offset [%d], bytes [%d]" , fd , offset , nbytes ) ; syncFileRangePossible = false ; } }
Sync part of an open file to the file system .