Re: [rfc] Ignore Fsync Calls in Laptop_Mode
From: Alan Cox
Date: Thu May 19 2011 - 09:42:09 EST
> Problem: laptop_mode wants to keep applications from waking the hard
> disks but fsync calls can "sneak through". (IMHO this is a bug.)
Its a standards requirement and thing many apps rely on. Also you can do
it perfectly well in user space for all apps. Thats why you can
preconfigure preloads and it's why you have glic library source code!
> Proposed solution: Pretend the fsync was executed and successful.
> Insert two lines into the fsync and fdatasync calls in fs/sync.c:
> if (unlikely(laptop_mode))
> return 0;
Whoops you've just risked corrupting any app which relies on fsync for
ordering if there is a crash.
> "This is not necessary with SSDs"
> I'm not sure, but I think that SSDs will also keep an active SATA
> connection if you write to them all the time. They also have standby
On SSD the impact is miniscule as far as I can tell. A graph would tell
The "right" way to do this is more complicated by far. An fsync is an
ordering guarantee so you need to implement that ordering guarantee even
if you don't force writes to physical media. That at least cuts down most
failures (but not all - eg commits with a network component such as email
Anyway you can do it in userspace trivially if you want.
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/