lkml.org 
[lkml]   [2008]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectsync_file_range(SYNC_FILE_RANGE_WRITE) blocks?
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


\
 
 \ /
  Last update: 2008-05-30 12:29    [W:0.069 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site