lkml.org 
[lkml]   [2011]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [rfc] Ignore Fsync Calls in Laptop_Mode
On Mon, May 23, 2011 at 10:12 AM, Oliver Neukum <oneukum@suse.de> wrote:
>> > 3. A lib doesn't fix the ordering guarantee problem.
>>
>> A properly implemented filesystem will not have ordering problems
>> just because fsyncs are not issued.
>
> But user space will have this problem. A single task's sequence of
> write(); fsync(); write(); does give an implicit guarantee of ordering
> to user space. To keep that guarantee, you need kernel support,
> because only the kernel can issue the necessary barrier/flush commands.
> A filesystem is not required to make sure your writes hit the disk
> in the order you issued them, unless you use fsync, which gives
> an even larger guarantee, but also implies ordering.

If this is correct, we do need some form of kernel support. To ensure
that one fsync means the write comes before another. Because how would
it be implemented in user space to ensure write ordering without
fsync? The library could only request the kernel to enforce write
ordering. Otherwise it would have to catch and buffer all writes
itself and then commit them with fsyncs in between. _That_ doesn't
sound like a good idea at all...

And the alternative would be that a write of
1. XXXXXXXXXXXXXXXX (file)
2. XXHHHHHXXXXXXX (write H)
3. XXHHHNNNNXXXX (write N)

would become
1. XXXXXXXXXXXXXXXX (file)
2. XXXXXXNNNNXXXX (write N)
3. XXHHHHHNNXXXX (write H)

And we have data that was never supposed to be on disk this way...


\
 
 \ /
  Last update: 2011-05-23 15:09    [W:0.071 / U:1.496 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site