All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Tso <tytso@MIT.EDU>
To: "D. Jansen" <d.g.jansen@googlemail.com>
Cc: Oliver Neukum <oneukum@suse.de>,
	Dave Chinner <david@fromorbit.com>,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [rfc] Ignore Fsync Calls in Laptop_Mode
Date: Thu, 26 May 2011 06:49:46 -0400	[thread overview]
Message-ID: <410B37BE-E380-40D0-82AA-48B56F389E16@mit.edu> (raw)
In-Reply-To: <BANLkTincvGV735PKb60Kg0dLX6a1CZ-iNA@mail.gmail.com>


On May 26, 2011, at 3:01 AM, D. Jansen wrote:

> That seems to be the big ordering issue. I had always assumed that
> user space writes (by the same app to the same file) would be
> committed in order. Is that really not the case?
> 
> Wouldn't most app programmers assume ordering? Wouldn't that always
> possibly be an issue? Or do all the apps that require ordered writes
> use fsync. There will surely be some who require ordering but don't
> fsync. And without ordering, some apps won't be able to avoid fsync
> without data safety issues.

I really don't like using the word "ordering" the way Dave used it,
because it's a file system lingo that *always* confuses civilians.
And "Insider" language like that isn't help for communication,
unless you're certain there are only experts in the room...

As Dave said earlier, "ordering" in the sense he was using it
refers strictly to ensuring consistency after a crash.

Now, there are two levels of consistency; one is file system
level consistency, and the other is application level 
consistency.   It used to be that desktop drives would
lie about forcing data to disk in response to a FLUSH 
CACHE command, "yes sir, I promise the data is on
the disk, sir!", because it resulted in higher WINBENCH
scores.  File systems engineers hated this, because
a primary tool we have for assuring that file systems
don't look like swiss cheese after a crash was completely
unreliable.   Fortunately, those disks have largely
disappeared from the market place.

The suggestion of making fsync a no-op is essentially
asking for a knob that breaks application-level consistency
the same way those broken hard drives broke file system
consistency by making the FLUSH CACHE command
unreliable.   Maybe improving battery lifetime is a more
honorable excuse than the purely mercenary goal of
selling more disk drives, but it can still break applications
after a crash.

Now, you may think that you're prepared by that.   After all,
you're already prepared to say that you're willing to lose
the last 15 minutes of work or whatever, right?

Well, wrong.  It's not so simple as that.  If you're only
talking about simple, flat, human-readable text files,
maybe it would work that way.   But what about complex,
binary databases?  Like sqllite databases used by 
Firefox and Chrome?   Or MySQL databases?   More
and more, sophisticated applications, even desktop
applications, are using these complex data stores,
and the libraries which update these complex data
stores rely on fsync() to prevent their database files
from looking like swiss cheese.   If you crash while
fsync() has been disabled, the entire database file
could be completely trashed, which could be hours,
days, weeks, or months of work lost.

So the resistance that people like Dave have to your 
proposal can be summed up by Confucious if you are
Chinese: ""Never impose on others what you would
not choose for yourself."  Or if you are Jewish, the Rabbi
Hillel said: "That which is hateful to you, do not do to
your fellow. That is the whole Torah; the rest is the
explanation; go and learn."   Or if you are a Muslim,
the Prophet Mohammed: "Hurt no one so that no one
may hurt you."   Breaking fsync() is like hard drives that
break faith with file system authors by lying when they 
say everything is safely written to stable storage.  And 
what are databases but complex file systems living inside
a single file?

-- Ted


  reply	other threads:[~2011-05-26 10:54 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-19 13:34 [rfc] Ignore Fsync Calls in Laptop_Mode Dennis Jansen
2011-05-19 13:43 ` Alan Cox
     [not found]   ` <BANLkTikFRwPY_qOQpPmCmNUJbBUsGcuGUw@mail.gmail.com>
     [not found]     ` <20110519153928.40521b93@lxorguk.ukuu.org.uk>
2011-05-19 15:01       ` D. Jansen
2011-05-19 15:02   ` D. Jansen
2011-05-20 15:34     ` Valdis.Kletnieks
2011-05-20  3:39 ` Dave Chinner
2011-05-20  6:01   ` D. Jansen
2011-05-22  0:48     ` Dave Chinner
2011-05-23  8:12       ` Oliver Neukum
2011-05-23 13:05         ` D. Jansen
2011-05-25  0:00         ` Dave Chinner
2011-05-25  6:50           ` Oliver Neukum
2011-05-26  7:01             ` D. Jansen
2011-05-26 10:49               ` Theodore Tso [this message]
     [not found]                 ` <BANLkTimNjt4=9v33Z9Nr12xa6GmyJ-Ue5A@mail.gmail.com>
2011-05-26 13:31                   ` Ted Ts'o
2011-05-26 16:05                     ` D. Jansen
2011-05-26 16:21                       ` Ted Ts'o
2011-05-27  7:12                         ` D. Jansen
2011-05-27 14:17                           ` Theodore Tso
2011-05-27 17:51                             ` david
2011-05-29 10:45                             ` D. Jansen
2011-05-30  1:53                               ` david
2011-05-30  7:13                                 ` Oliver Neukum
2011-05-30 12:55                                   ` Valdis.Kletnieks
2011-05-30 18:03                                     ` david
2011-05-30 13:55                                 ` D. Jansen
2011-05-30 18:02                                   ` david
2011-05-30 18:28                                     ` D. Jansen
2011-05-30 18:43                                       ` Valdis.Kletnieks
2011-05-30 19:54                                         ` D. Jansen
2011-05-30 18:45                                       ` david
2011-05-30 19:49                                         ` D. Jansen
2011-05-30 20:53                                           ` david
2011-05-30 21:24                                             ` D. Jansen
2011-05-30 22:41                                               ` david
2011-05-31  2:03                                               ` Ted Ts'o
2011-05-31  2:26                                                 ` david
2011-05-31 13:47                                                 ` D. Jansen
2011-05-31 18:23                                                   ` david
2011-05-31 18:37                                                     ` D. Jansen
2011-05-31 18:54                                                       ` david
2011-05-31 19:04                                                         ` D. Jansen
2011-06-02  7:42                                                 ` D. Jansen
2011-05-31  8:22                                               ` Valdis.Kletnieks
2011-05-30 22:10                                           ` Jesper Juhl
2011-05-31  6:48                                         ` Oliver Neukum
2011-05-26 19:31               ` Matthew Garrett
2011-05-27  7:22                 ` D. Jansen
2011-05-20 15:28 ` Valdis.Kletnieks
2011-05-20 16:40   ` D. Jansen
2011-05-20 22:03     ` torbenh
2011-05-21  8:23       ` D. Jansen
2011-05-23  8:22     ` Jesper Juhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=410B37BE-E380-40D0-82AA-48B56F389E16@mit.edu \
    --to=tytso@mit.edu \
    --cc=akpm@linux-foundation.org \
    --cc=d.g.jansen@googlemail.com \
    --cc=david@fromorbit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oneukum@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.