mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@clusterfs.com>
To: Xin Zhao <uszhaoxin@gmail.com>
Cc: Arjan van de Ven <arjan@infradead.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: question about possibility of data loss in Ext2/3 file system
Date: Wed, 22 Feb 2006 16:07:03 -0700	[thread overview]
Message-ID: <20060222230703.GM26809@schatzie.adilger.int> (raw)
In-Reply-To: <4ae3c140602221434v6ec583a7yf04df5fa7a4948fc@mail.gmail.com>

On Feb 22, 2006  17:34 -0500, Xin Zhao wrote:
> Apparently the scheme you described helps improve the file integrity.
> But still not good enough. For example, if all data blocks are
> flushed, then you will update the metadata. But right after you update
> the block bitmap and before you update the inode, you lose power. You
> will get some dead blocks.  Right? Do you know how ext2/3 deal with
> this situation?

ext3 journals changes to the filesystem metadata, and if the journal
update is not fully written to disk (committed) then the change to
the filesystem _metadata_ is NOT actually performed.  Only if the
metadata change is committed to the journal does it actually continue
and update the filesystem metatada.  If that is interrupted then journal
replay will re-do the operation.

> Also, the scheme you mentioned is just for new file creation. What
> will happen if I want to update an existing file? Say, I open file A,
> seek to offset 5000, write 4096 bytes, and then close. Do you know how
> ext2/3 handle this situation?

The above is not relevant to any _data_ changes, just metadata, unless
the file(system) is running in data-journal mode.  In that case the write
is written to the journal before being written into the filesystem.  There
is a limitation on how large such a write can be before it is split into
smaller (non-atomic) transactions in the journal.  The data-journal mode
also writes twice as much data to disk so can impact performance if you
are already using more than 1/2 of your disk bandwidth.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.


  reply	other threads:[~2006-02-22 23:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-22 21:56 Xin Zhao
2006-02-22 22:00 ` Arjan van de Ven
2006-02-22 22:34   ` Xin Zhao
2006-02-22 23:07     ` Andreas Dilger [this message]
2006-02-23  4:58     ` Theodore Ts'o
2006-02-23 19:46       ` Sam Vilain
2006-02-24 16:29         ` Theodore Ts'o
2006-02-26 21:27           ` Sam Vilain
2006-02-27  7:38             ` Xin Zhao
2006-02-28 16:56               ` Phillip Susi
2006-02-23 12:52     ` linux-os (Dick Johnson)

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=20060222230703.GM26809@schatzie.adilger.int \
    --to=adilger@clusterfs.com \
    --cc=arjan@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=uszhaoxin@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

all inboxes | Powered by JetHome®