Subject: UBIFS and small dynamic files

Artem Bityutskiy dedekind1 at gmail.com
Fri Oct 28 10:03:16 EDT 2011


On Mon, 2011-10-24 at 04:21 +0100, Jon Povey wrote:
> You need to rewrite files with safe POSIX semantics.
> It is not crash-safe to rewrite the target file directly (but many
> apps are naive and do this in an unsafe way)
> 
> The right way to do it is write a new file on the same filesystem,
> fsync() it, then rename it over the target. The rename is atomic
> so after a crash you either get the old file or the new one.
> 
> I had a quick google for the authoritative sequence but I couldn't
> find and can't remember it exactly. I think it might involve an fsync
> on the directory handle too if you want to be sure the new file has
> arrived on flash. This avoids syncing the entire filesystem
> or mounting it -o sync.

You can set per-file "sync" attribute as well.

Someone can also implement something similar as ext4 has in UBIFS: we
can sync when the last reference to the file descriptor is dropped. I
also described this in the MTD web site.

-- 
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20111028/c0a7dd87/attachment-0001.sig>


More information about the linux-mtd mailing list