1. 10

The Moto-Z uses a new filesystem f2fs mounted with the option nobarrier. This essentially makes fsync calls a no-op. This saves a tremendous amount of battery and nand-writes, in exchange for a minor risk of data loss if power is interrupted.


  2. 12

    I would have thought that the fs choice is negligible compared to making fsync a nop. At that point, write latency should only be limited by overall write throughput -everything will fly until you fill your write buffer and start waiting for unordered bulk IO to start draining it?

    Ditto the user space transition for fuse - if we’re counting millisecs, then that should be in the noise?

    I’m also generally worried that a benchmark like this provides pressure to turn off fsync.

    iiuc, this doesn’t just risk recent data, by re-ordering writes past an fsync boundary you could trash the structure of e.g. an sqlite file and lose the whole thing?

    1. 3

      This is a bit clickbait-y. I doubt that slower fsync calls would actually surface as 10x lag from the user’s perspective.

      1. 3

        As a user, I’m much happier to have a long-lasting phone that might forget a couple of seconds of data than a device that has to be trashed after a year of use.

        A few seconds of data loss is the difference between “I can access my mobile app’s data after a sudden power loss” and “all my work in a particular app is now corrupt, wtf!?”. Sure, if the developer is using a power-loss resistent (not immune) data storage solution like SQLite, then the problem is alleviate somewhat, but I specifically buy SSD’s with capacitors for that last-few-seconds-of-write to prevent data loss during a power outage situation, I’d prefer my phone did the same.

        NAND write endurance failures are also horribly overblown (both in this article and elsewhere), I used my Crucial M4 SSD as the primary drive & swap file for years and after dozens of terabytes of writes, it was still going strong (and relatively fast–though I don’t know what % of a performance degradation it’s been through). Then that laptop was stolen, but alas, no amount of fsync would have prevented that data loss :P

        Also, as the author noted in a small footnote update, a slightly slower FS will not manifest itself as user-facing UI latency as Android (like iOS) do not run animations on the main OS thread, so the title of “lags 10x more” is really a misnomer.

        1. 1

          The author points out that phones really are a special case… when do they ever experience sudden power loss? Particularly when the battery is not removable, it seems less likely than for desktops.

          1. 5

            When they crash and you have to force reboot them.

            1. 1

              When the battery dies because I’ve been using it all day and I’m on a bus or something rather than near a wall outlet.

              1. 1

                Right, but that isn’t sudden power loss. The OS can tell that the battery is low and has the opportunity for a graceful shutdown.

                1. 3

                  Right, but that isn’t sudden power loss. The OS can tell that the battery is low and has the opportunity for a graceful shutdown.

                  Lithium ion batteries have an “cutoff voltages” for “out of power” (~3.1v), however getting to that voltage is NOT a linear curve with a predictable time range. The micro-controller in a lithium ion battery pack uses many heuristics to guess at the remaining % of battery left based on many criterion (including, but not limited to, current power draw and past behaviour), and is susceptible to significant drift over time.

                  I’m surprised that you have never seen a case where your phone thinks it still has X% of battery left (where X is clearly bigger than 1%) and the phone shuts off suddenly. It’s happened to me on a number of occasions, and I’m glad none of those cases resulted in any data loss.

                  I have a 3 year old iPhone 5S, and the most recent egregious occurrence I can think of is it was stuck at 17% for hours, and then suddenly shut down.

                  And the iPhone is well regarded when it comes to battery management. I can’t imagine how much less reliable the average Android phone’s battery controllers are when it comes to reporting an accurate charge remaining. Sure, we all know of designed obsolescence, and perhaps I should get a new phone, but that would be counter to one of the objectives that the author of the article laid out, which is to have a long lasting phone (by life span, not battery life).

                  1. 2

                    Funnily enough, the only friends of mine who complain about their battery life are iPhone users. ¯\_(ツ)_/¯

                    I’ve only ever owned Samsung smartphones (Galaxy S3 and S5) and have never experienced sudden power loss, but thanks for setting me straight. I didn’t realize it was common.