sync_file_range(SYNC_FILE_RANGE_WRITE) blocks?

From: Pavel Machek
Date: Fri May 30 2008 - 06:25:55 EST


Hi!

sync_file_range(SYNC_FILE_RANGE_WRITE) blocks ... which makes problem
for s2disk: there we want to start writeout as early as possible
(system is going to shut down after write, and we need the data on
disk).

Unfortuantely, sync_file_range(SYNC_FILE_RANGE_WRITE) blocks, which
does not work for us. Is there non-blocking variant? "Start writeout
on this fd, but don't block me"?

For now I'm doing:

static inline int start_writeout(int fd)
{
#ifdef SYS_sync_file_range
if (fork())
return 0;
else {
syscall(SYS_sync_file_range, fd,
(loff_t)0, (loff_t)0, SYNC_FILE_RANGE_WRITE);
exit(0);
}
#else
errno = ENOSYS;
return -1;
#endif
}

...but I'd prefer something more elegant...
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/