Messages in this thread | | | Date | Thu, 19 May 2011 14:43:12 +0100 | From | Alan Cox <> | Subject | Re: [rfc] Ignore Fsync Calls in Laptop_Mode |
| |
> 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 you more.
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 receives)
Anyway you can do it in userspace trivially if you want.
| |