linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@sun.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: Alexander Shishkin <alexander.shishckin@gmail.com>,
	linux-ext4@vger.kernel.org
Subject: Re: [Q] ext3 mkfs: zeroing journal blocks
Date: Mon, 11 May 2009 13:35:22 -0600	[thread overview]
Message-ID: <20090511193522.GD3209@webber.adilger.int> (raw)
In-Reply-To: <4A087202.4010601@redhat.com>

On May 11, 2009  13:44 -0500, Eric Sandeen wrote:
> Andreas Dilger wrote:
> > The reason that the journal is zeroed is because there is some chance
> > that old (valid at the time) transaction headers and commit blocks might
> > be in the journal and could accidentally be "recovered" and cause bad
> > corruption of the filesystem.
> 
> But I guess the question is, why isn't a normal internal log zeroed?
> 
> If I'm reading it right only external logs get this treatment, and I
> think that's what generated the original question from Alexander.

Hmm, possibly because when ext3 was first allocated the internal journal
created was "dd if=/dev/zero of=/mnt/fs/.journal bs=1M count={jnl_size}"
on the filesystem mounted as ext2, so normal filesystem IO would handle
the zeroing of the blocks.  Even today if tune2fs adds a journal to a
filesystem it does the zero filling of the journal.

Looking at the mke2fs code it also appears to be doing zeroing of the
journal inode in:

      mke2fs
        ->ext2fs_add_journal_inode
	  ->write_journal_inode
	    ->ext2fs_block_iterate
	      ->mkjournal_proc (increment zero_count)
	  ->ext2fs_zero_blocks

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.


  parent reply	other threads:[~2009-05-11 19:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-11 15:03 [Q] ext3 mkfs: zeroing journal blocks Alexander Shishkin
2009-05-11 17:58 ` Eric Sandeen
2009-05-11 18:20   ` Andreas Dilger
2009-05-11 18:44     ` Eric Sandeen
2009-05-11 19:35       ` Theodore Tso
2009-05-11 19:35       ` Andreas Dilger [this message]
2009-05-12 11:55       ` Alexander Shishkin
2009-05-12 12:13         ` Theodore Tso
2009-05-12 12:49           ` Alexander Shishkin
2009-05-12 21:04             ` Theodore Tso
2009-07-29 15:58             ` [PATCH] [RFC] mkjournal: zero journal blocks only when necessary Alexander Shishkin
2009-07-29 17:16               ` Theodore Tso

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=20090511193522.GD3209@webber.adilger.int \
    --to=adilger@sun.com \
    --cc=alexander.shishckin@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sandeen@redhat.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;
as well as URLs for NNTP newsgroup(s).