Android will be using ext4 starting with Gingerbread

Theodore Tso's picture

I received a trackback from Tim Bray’s Saving Data Safely post on the Android Developer’s blog to my Don’t fear the fsync! blog entry, so I guess the cat’s out of the bag.  Starting with Gingerbread, newer Android phones (starting with the Nexus S) will be using the ext4 file system.  Very cool!  So just as IBM used to promote Linux by saying that it was scalable enough to run on everything between watches and mainframes, I can now talk about ext4 as running in production on cell phones to Google data centers.

How much am I worried about Tim Bray’s caution to Android programmers that they use fsync() correctly?   Not a lot.  Sure, they should make sure they use fsync(), or if they want to be clever, sync_file_range(), to make sure files are appropriately written to disk (or, in Android’s case, to flash).   But unlike Ubuntu’s running on random PC’s, with users downloading the latest (possibly buggy) Nvidia drivers, handset manufacturers test their systems very carefully before they let them ship.  So if there are any problems, they tend to be found before the phone ships to end-users.  So at least in my experience, my Nexus One has been very reliable; it’s never crashed on me.   So the chances of random crashes when you exit the 3D game (as one Ubuntu user reported — and considered acceptable?!? — I’d be roasting Ubuntu and/or Nvidia under a slow fire if that was a reliably reproducible bug, not considering it par for the course) are very remote.   And fsync() is important if systems crash or aren’t shut down cleanly.  Still, if users are randomly ripping out their batteries to turn off their cell phone in a hurry, because they’re too impatient to wait for a controlled shutdown, then sure, we might have problems, and it’s a good reason for application writers to use fsync() correctly.

By the way, I had nothing to do with the choice to use ext4 on Android.  So if you’re curious about why ext4 was chosen, I can’t say anything authoritatively, since I wasn’t consulted before the decision was made (although obviously I’m delighted).   As far as I can tell after the fact, one of the reasons for choosing ext4 was better performance, especially in the light of dual-core ARM CPU’s which are becoming available in large quantities in the near future; YAFFS is single threaded, so it would have been a bottleneck on dual-core systems.  Why not btrfs?   Well, for all of btrfs’s features, it’s not out of beta yet, and Gingerbread is shipping today.  (Well, in less than a week to Best Buy, if we want to be precise.)

This is another reason why I’m glad to see ext4 being used on Android is that it validates my decision to keep working on ext4 2-3 years ago, even though newer filesystems like btrfs were promised to be coming down the pike.   As I’ve said many times before, file systems are like fine wine, and they take many years to mature.  So having ext4 ready today is a great way of giving more choices to developers and system administrators about what file system they want to use.

No related posts.