UBIFS data integrity

Gupta, Pekon pekon at ti.com
Fri Jan 17 04:21:54 EST 2014


>From: Artem Bityutskiy
>>On Thu, 2014-01-16 at 09:12 +0000, Mats Kärrman wrote:
[...]

>> Sorry if I mislead you, I guess the final statement of my original mail is
>> still valid then:
>> "In general this requires that your database also is implemented
>> in a fault tolerant way."
>> I.e. it must itself make sure it's entire write is completed before
>> switching to a new "state". Unless the DB implements some kind of
>> journaling this may be a problem.
>
>Sure. The ordering or the 4K writes is not guaranteed, but I think the
>memory management subsystem uses LRU lists so older writes go first. Any
>write that crosses the 4096 byte-aligned boundary is not atomic. So the
>only thing UBIFS guarantees is something like:
>
>fsync
>write(4k-5k)
>fsync
>
>will guarantee that the 1K piece of data either gets fully written or
>not at all.
>
Mounting UBIFS with -o sync will also do the same.
 http://www.linux-mtd.infradead.org/doc/ubifs.html#L_sync_semantics

Alternatively, if somehow in your application you can guarantee that
every update to database is within 4K boundary (and aligned), then your
database should always be in recoverable state.

with regards, pekon


More information about the linux-mtd mailing list