public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: JiSheng Zhang <jszhang3@gmail.com>
To: dedekind1@gmail.com
Cc: linux-mtd@lists.infradead.org
Subject: Re: UBIFS power cut issues
Date: Fri, 11 Sep 2009 17:33:38 +0800	[thread overview]
Message-ID: <2df346410909110233n6b434567qb2bbbb380417adf7@mail.gmail.com> (raw)
In-Reply-To: <1252597344.5060.99.camel@localhost>

Hi Artem,


2009/9/10 Artem Bityutskiy <dedekind1@gmail.com>:
>
>      * User creates an empty file f.dat. The file is synchronous, or
>        UBIFS is mounted in synchronous mode. User calls the write()
>        function with a 10MiB buffer.
>      * The kernel first copies all 10MiB of the data to the page cache.
>        Inode size is changed to 10MiB as well and the inode is marked
>        as dirty. Nothing has been written to the flash media so far. If
>        a power cut happens at this point, the user will end up with an
>        empty f.dat file.
>      * UBIFS sees that the I/O has to be synchronous, and starts
>        synchronizing the inode. First of all, it writes the inode node
>        to the flash media. If a power cut happens at this moment, the
>        user will end up with a 10MiB file which contains no data
>        (hole), and if he read this file, he will get 10MiB of zeroes.
>      * UBIFS starts writing the data. If a power cut happens at this
>        point, the user will end up with a 10MiB file containing a hole
>        at the end.
>
> Note, if the I/O was not synchronous, UBIFS would skip the last step and
> would just return. And the actual write-back would then happen in
> back-ground. But power cuts during write-back could anyway lead to files
> with holes at the end.

Thanks very much for this document, excellent document, I like it very much.
>
> Thus, synchronous I/O in UBIFS provides less guarantees than JFFS2 I/O -
> UBIFS has an effect of holes at the end of files. In ideal world
> applications should not assume anything about the contents of files
> which were not synchronized before a power-cut has happened. And
> "mainstream" file-systems like ext3 do not provide JFSS2-like
> guarantees.
>
> However, UBIFS is sometimes used as a JFFS2 replacement and people may
> want it to behave the same way as JFFS2 if it is mounted synchronously.
> This is doable, but needs some non-trivial development, so this was not
> implemented so far. On the other hand, there was no strong demand. You
> may implement this as an excercise, or you may try to convince UBIFS
> authors to do this.

Hmmm, this style(there's hole at the end of file) can be accepted.

Thanks again,
Jisheng

  parent reply	other threads:[~2009-09-11  9:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-02  9:35 UBIFS power cut issues JiSheng Zhang
2009-09-08  6:22 ` Artem Bityutskiy
2009-09-09  9:45   ` JiSheng Zhang
2009-09-09 10:06     ` Artem Bityutskiy
2009-09-11  9:23       ` JiSheng Zhang
2009-09-10 15:42     ` Artem Bityutskiy
2009-09-10 16:00       ` Bill Gatliff
2009-09-11  8:01         ` Artem Bityutskiy
2009-09-11  9:33       ` JiSheng Zhang [this message]
2009-09-11 10:06         ` Artem Bityutskiy

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=2df346410909110233n6b434567qb2bbbb380417adf7@mail.gmail.com \
    --to=jszhang3@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /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