From: Theodore Ts'o <tytso@mit.edu>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Akira Fujita <a-fujita@rs.jp.nec.com>,
'ext4 development' <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] mke2fs: Fix block bitmaps initalization with -O ^resize_inode
Date: Wed, 4 Dec 2013 18:44:35 -0500 [thread overview]
Message-ID: <20131204234435.GF19914@thunk.org> (raw)
In-Reply-To: <20131130200624.GA9541@birch.djwong.org>
On Sat, Nov 30, 2013 at 12:06:24PM -0800, Darrick J. Wong wrote:
> Hi Ted, I was hoping you might resolve a question for us:
> > And there is a bug that block group which has backup super block
> > and group descriptor block are not write out to device in wrtie_bitmaps()
> > when BLOCK_UNINIT is set.
> > So at this time, I attempted to fix this by cleaning BLOCK_UNIIT.
>
> Is it the case that a group should only have BLOCK_UNINIT set if the group is
> totally empty (no group metadata, no blocks allocated to files) as Akira says?
>
> Or is it the case that a group can have BLOCK_UNINIT set if the group contains
> group metadata but no blocks are allocated to files?
The meaning of BLOCK_UNINIT is that the contents of that block group's
block allocation bitmap is not initialized. This causes libext2fs to
skip writing the block allocation bitmap, and to also skip reading the
block allocation bitmap (which is why it substitutes all zero's
instead of reading the allocation bitmap block).
Before allocating a block from a block group that has the BLOCK_UNINIT
flag set, it is important that the kernel or the userspace library
first initialize the block allocation bitmap and clear the
BLOCK_UNINIT flag.
When allocating blocks, implementations MUST be able to initiaize the
allocation bitmap for block groups which has the block group's own
metadata blocks (backup superblock and bg descriptor blocks if any,
reserved bg blocks, the allocation bitmaps, and inode table blocks) in
use.
Implementations SHOULD be able to initialize bitmaps for block groups
that have metadata blocks from other block groups if the case of
flex_bg. However, historically there were some implementations that
didn't handle this correctly, which is why mke2fs initializes the
block bitmap and clears BLOCK_UNINIT in block groups that have
metadata blocks for other block groups.
Optionally, implementations MAY set the BLOCK_UNINIT bit after data
blocks have been deallocated from a block group such that the only
blocks in use are the block group's metadata groups.
Also, some implementations MAY clear the BLOCK_UNINIT bit and
initialize the block allocation bitmap early --- for example, when
allocating an inode in the block group. This shouldn't be required,
however, and so implementations SHOULD correctly handle a situation
where an inode has been allocated in the inode table, but BLOCK_UNINIT
is set.
All of this basically boils down to the two rules of thumb:
1) The BLOCK_UNINIT bit is fundamentally about whether the block
allocation bitmap is valid, and whether mke2fs can skip needing to
initialize the block, and whether e2fsck, dumpe2fs, debugfs, etc. can
skip reading said allocation bitmap.
2) The IETF rule of "be conservative in what you send, and liberal in
what you accept" applies.
Does that help?
Thanks,
- Ted
next prev parent reply other threads:[~2013-12-04 23:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-22 7:39 [PATCH] mke2fs: Fix block bitmaps initalization with -O ^resize_inode Akira Fujita
2013-11-22 8:03 ` Akira Fujita
2013-11-23 1:33 ` Darrick J. Wong
2013-11-26 1:27 ` Darrick J. Wong
2013-11-26 8:10 ` Akira Fujita
2013-11-27 0:55 ` Darrick J. Wong
2013-11-28 8:50 ` Akira Fujita
2013-11-30 20:06 ` Darrick J. Wong
2013-12-04 23:44 ` Theodore Ts'o [this message]
2013-12-05 1:22 ` Darrick J. Wong
2013-12-05 2:03 ` Theodore Ts'o
2013-12-05 5:04 ` Darrick J. Wong
2013-12-05 2:09 ` Theodore Ts'o
2013-12-05 5:00 ` Darrick J. Wong
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=20131204234435.GF19914@thunk.org \
--to=tytso@mit.edu \
--cc=a-fujita@rs.jp.nec.com \
--cc=darrick.wong@oracle.com \
--cc=linux-ext4@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).