+ /* This won't block, but will start writeout asynchronously */
+ sync_file_range(outfd, pair->offset, ret,
+ SYNC_FILE_RANGE_WRITE);
+ pair->offset += ret;
+ }
+write_end:
+ /*
+ * This does a blocking write-and-wait on any page that belongs to the
+ * subbuffer prior to the one we just wrote.
+ */
+ if (orig_offset >= pair->max_sb_size)
+ sync_file_range(outfd, orig_offset - pair->max_sb_size,
+ pair->max_sb_size,
+ SYNC_FILE_RANGE_WAIT_BEFORE
+ | SYNC_FILE_RANGE_WRITE
+ | SYNC_FILE_RANGE_WAIT_AFTER);
+