Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: rcrb rcrb <rcrbsw@gmail.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: UBIFS data integrity
Date: Thu, 16 Jan 2014 10:00:51 +0200	[thread overview]
Message-ID: <1389859251.26808.76.camel@sauron.fi.intel.com> (raw)
In-Reply-To: <CAEwL26y2Sdz4Lu=0ru3J-GF5pa-AXcWeuFNHDmWZ9PyKx7if-A@mail.gmail.com>

On Wed, 2014-01-15 at 19:31 +0100, rcrb rcrb wrote:
> On Tue, Jan 14, 2014 at 10:32 AM, Mats Kärrman <Mats.Karrman@tritech.se> wrote:
> > Hi,
> >
> > On Tuesday, January 14, 2014 3:51 AM, rcrb rcrb [rcrbsw@gmail.com] wrote:
> >> I am considering using a database over UBIFS on my embedded device.
> >> The database file is approximately 1 MiB. I wonder if I can rely on
> >> the filesystem to be sure than this file will never have a corruption,
> >> even in case of power cut during update. Will the filesystem guarantee
> >> that, after reboot, the file will be either in the pre-update state or
> >> be correctly updated ?
> >
> > First of all, UBIFS relies on the underlying MTD driver also
> > doing its job so you should also make sure this works on your
> > board.
> > If your MTD driver works, UBIFS is supposed to guarantee
> > that every write operation is atomic, i.e. it is either fully written or
> > discarded.
> > If your database is guaranteed  correct after a power-cut then
> > depends on if it is consistent after every write or if it requires
> > several write operations to produce a new consistent state.
> > In general this requires that your database also is implemented
> > in a fault tolerant way.
> >
> > BR // Mats
> 
> Thank you for you answer Mats. I checked the write system calls with
> the database I plan to use, it appears that the transactions are
> validated with only one write. So I think it will be OK.

UBIFS writes in 4KiB units. So any aligned 4KiB piece of your file is
guaranteed to either be fully written, then the read will return new
data, or not be written at all, then the read will return old data.

-- 
Best Regards,
Artem Bityutskiy

  reply	other threads:[~2014-01-16  8:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14  2:51 UBIFS data integrity rcrb rcrb
2014-01-14  9:32 ` Mats Kärrman
2014-01-15 18:31   ` rcrb rcrb
2014-01-16  8:00     ` Artem Bityutskiy [this message]
2014-01-16  8:16       ` Artem Bityutskiy
2014-01-16  9:12         ` Mats Kärrman
2014-01-16  9:26           ` Artem Bityutskiy
2014-01-17  9:21             ` Gupta, Pekon

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=1389859251.26808.76.camel@sauron.fi.intel.com \
    --to=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=rcrbsw@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox