linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2.3 00/23] ext4: Add metadata checksumming
@ 2012-01-07  8:27 Darrick J. Wong
  2012-01-07  8:27 ` [PATCH 01/23] ext4: Create a new BH_Verified flag to avoid unnecessary metadata validation Darrick J. Wong
                   ` (22 more replies)
  0 siblings, 23 replies; 32+ messages in thread
From: Darrick J. Wong @ 2012-01-07  8:27 UTC (permalink / raw)
  To: Andreas Dilger, Theodore Tso, Darrick J. Wong
  Cc: Sunil Mushran, Martin K Petersen, Greg Freemyer, Amir Goldstein,
	linux-kernel, Andi Kleen, Mingming Cao, Joel Becker,
	linux-fsdevel, linux-ext4, Coly Li

Hi all,

This patchset adds crc32c checksums to most of the ext4 metadata objects.  A
full design document is on the ext4 wiki[1] but I will summarize that document here.

As much as we wish our storage hardware was totally reliable, it is still
quite possible for data to be corrupted on disk, corrupted during transfer over
a wire, or written to the wrong places.  To protect against this sort of
non-hostile corruption, it is desirable to store checksums of metadata objects
on the filesystem to prevent broken metadata from shredding the filesystem.

The crc32c polynomial was chosen for its improved error detection capabilities
over crc32 and crc16, and because of its hardware acceleration on current and
upcoming Intel and Sparc chips.

Each type of metadata object has been retrofitted to store a checksum as follows:

- The superblock stores a crc32c of itself.
- Each inode stores crc32c(fs_uuid + inode_num + inode_gen + inode +
  slack_space_after_inode)
- Block and inode bitmaps each get their own crc32c(fs_uuid + group_num +
  bitmap), stored in the block group descriptor.
- Each extent tree block stores a crc32c(fs_uuid + inode_num + inode_gen +
  extent_entries) in unused space at the end of the block.
- Each directory leaf block has an unused-looking directory entry big enough to
  store a crc32c(fs_uuid + inode_num + inode_gen + block) at the end of the
  block.
- Each directory htree block is shortened to contain a crc32c(fs_uuid +
  inode_num + inode_gen + block) at the end of the block.
- Extended attribute blocks store crc32c(fs_uuid + id + ea_block) in the
  header, where id is, depending on the refcount, either the inode_num and
  inode_gen; or the block number.
- MMP blocks store crc32c(fs_uuid + mmpblock) at the end of the MMP block.
- Block groups can now use crc32c instead of crc16.
- The journal now has a v2 checksum feature flag.
- crc32c(j_uuid + block) checksums have been inserted into descriptor blocks,
  commit blocks, revoke blocks, and the journal superblock.
- Each block tag in a descriptor block has a checksum of the related data block.

The patchset for e2fsprogs will be sent under separate cover only to linux-ext4
as it is quite lengthy (~51 patches).

As far as performance impact goes, I see nearly no change with a standard mail
server ffsb simulation.  On a test that involves only file creation and
deletion and extent tree modifications, I see a drop of about 50 percent with
the current kernel crc32c implementation; this improves to a drop of about 20
percent with the enclosed crc32c implementation.  However, given that metadata
is usually a small fraction of total IO, it doesn't seem like the cost of
enabling this feature is unreasonable.

There are a few unresolved issues:

- I haven't fixed it up to checksum the exclude bitmap yet.  I'll probably
  submit that as an add-on to the snapshot patchset.

- Using the journal commit hooks to delay crc32c calculation until dirty
  buffers are actually being written to disk.

- Interaction with online resize code.  Yongqiang seems to be in the process of
  rewriting this not to use custom metadata block write functions, but I haven't
  looked at it very closely yet.

Please have a look at the design document and patches, and please feel free to
suggest any changes.

v2: Checksum the MMP block, store the checksum type in the superblock, include
the inode generation in file checksums, and finally solve the problem of limited
space in block groups by splitting the checksum into two halves.

v2.1: Checksum the reserved parts of the htree tail structure.  Fix some flag
handling bugs with the mb cache init routine wherein bitmaps could fail to be
checksummed at read time.

v2.2: Reincorporate the FS UUID in the bitmap checksum calcuations.  Move all
disk layout changes to the front and the feature flag enablement to the end of
the patch set.  Fail journal recovery if revoke block fails checksum.

v2.3: Update the design document URL, and various minor naming cleanups.

This patchset has been tested on 3.2.0-rc7 on x64, i386, ppc64, and ppc32.  The
patches seems to work fine on all four platforms.

--D

[1] https://ext4.wiki.kernel.org/articles/e/x/t/Ext4_Metadata_Checksums_4d24.html


^ permalink raw reply	[flat|nested] 32+ messages in thread
* [PATCH v3 00/23] ext4: Add metadata checksumming
@ 2012-03-06 20:47 Darrick J. Wong
  2012-03-06 20:50 ` [PATCH 18/23] jbd2: Checksum journal superblock Darrick J. Wong
  0 siblings, 1 reply; 32+ messages in thread
From: Darrick J. Wong @ 2012-03-06 20:47 UTC (permalink / raw)
  To: Andreas Dilger, Theodore Tso, Darrick J. Wong
  Cc: Sunil Mushran, Martin K Petersen, Greg Freemyer, Amir Goldstein,
	linux-kernel, Andi Kleen, Mingming Cao, Joel Becker,
	linux-fsdevel, linux-ext4, Coly Li

Hi all,

This patchset adds crc32c checksums to most of the ext4 metadata objects.  A
full design document is on the ext4 wiki[1] but I will summarize that document here.

As much as we wish our storage hardware was totally reliable, it is still
quite possible for data to be corrupted on disk, corrupted during transfer over
a wire, or written to the wrong places.  To protect against this sort of
non-hostile corruption, it is desirable to store checksums of metadata objects
on the filesystem to prevent broken metadata from shredding the filesystem.

The crc32c polynomial was chosen for its improved error detection capabilities
over crc32 and crc16, and because of its hardware acceleration on current and
upcoming Intel and Sparc chips.

Each type of metadata object has been retrofitted to store a checksum as follows:

- The superblock stores a crc32c of itself.
- Each inode stores crc32c(fs_uuid + inode_num + inode_gen + inode +
  slack_space_after_inode)
- Block and inode bitmaps each get their own crc32c(fs_uuid + group_num +
  bitmap), stored in the block group descriptor.
- Each extent tree block stores a crc32c(fs_uuid + inode_num + inode_gen +
  extent_entries) in unused space at the end of the block.
- Each directory leaf block has an unused-looking directory entry big enough to
  store a crc32c(fs_uuid + inode_num + inode_gen + block) at the end of the
  block.
- Each directory htree block is shortened to contain a crc32c(fs_uuid +
  inode_num + inode_gen + block) at the end of the block.
- Extended attribute blocks store crc32c(fs_uuid + id + ea_block) in the
  header, where id is, depending on the refcount, either the inode_num and
  inode_gen; or the block number.
- MMP blocks store crc32c(fs_uuid + mmpblock) at the end of the MMP block.
- Block groups can now use crc32c instead of crc16.
- The journal now has a v2 checksum feature flag.
- crc32c(j_uuid + block) checksums have been inserted into descriptor blocks,
  commit blocks, revoke blocks, and the journal superblock.
- Each block tag in a descriptor block has a checksum of the related data block.

The patchset for e2fsprogs will be sent under separate cover only to linux-ext4
as it is quite lengthy (~51 patches).

As far as performance impact goes, I see nearly no change with a standard mail
server ffsb simulation.  On a test that involves only file creation and
deletion and extent tree modifications, I see a drop of about 50 percent with
the current kernel crc32c implementation; this improves to a drop of about 20
percent with the enclosed crc32c implementation.  However, given that metadata
is usually a small fraction of total IO, it doesn't seem like the cost of
enabling this feature is unreasonable.

There are a few unresolved issues:

- I haven't fixed it up to checksum the exclude bitmap yet.  I'll probably
  submit that as an add-on to the snapshot patchset.

- Using the journal commit hooks to delay crc32c calculation until dirty
  buffers are actually being written to disk.

Please have a look at the design document and patches, and please feel free to
suggest any changes.

v2: Checksum the MMP block, store the checksum type in the superblock, include
the inode generation in file checksums, and finally solve the problem of limited
space in block groups by splitting the checksum into two halves.

v2.1: Checksum the reserved parts of the htree tail structure.  Fix some flag
handling bugs with the mb cache init routine wherein bitmaps could fail to be
checksummed at read time.

v2.2: Reincorporate the FS UUID in the bitmap checksum calcuations.  Move all
disk layout changes to the front and the feature flag enablement to the end of
the patch set.  Fail journal recovery if revoke block fails checksum.

v2.3: Update the design document URL, and various minor naming cleanups.

v3: Eliminate the bg_use_meta_csum feature flag and make metadata_csum
supersede uninit_bg.  Minor fixes to support the new online resize code.

This patchset has been tested on 3.3.0-rc6 on x64 and i386.  The patches seems
to work fine on both platforms.

--D

[1] https://ext4.wiki.kernel.org/articles/e/x/t/Ext4_Metadata_Checksums_4d24.html


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2012-03-06 20:51 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-07  8:27 [PATCH v2.3 00/23] ext4: Add metadata checksumming Darrick J. Wong
2012-01-07  8:27 ` [PATCH 01/23] ext4: Create a new BH_Verified flag to avoid unnecessary metadata validation Darrick J. Wong
2012-01-07  8:28 ` [PATCH 02/23] ext4: Change on-disk layout to support extended metadata checksumming Darrick J. Wong
2012-01-07  8:28 ` [PATCH 03/23] ext4: Record the checksum algorithm in use in the superblock Darrick J. Wong
2012-01-07  8:28 ` [PATCH 04/23] ext4: Only call out to crc32c if necessary Darrick J. Wong
2012-01-07  8:28 ` [PATCH 05/23] ext4: Calculate and verify superblock checksum Darrick J. Wong
2012-01-07  8:28 ` [PATCH 06/23] ext4: Calculate and verify inode checksums Darrick J. Wong
2012-01-07  8:28 ` [PATCH 07/23] ext4: Calculate and verify checksums for inode bitmaps Darrick J. Wong
2012-01-07  8:28 ` [PATCH 08/23] ext4: Calculate and verify block bitmap checksum Darrick J. Wong
2012-01-07  8:28 ` [PATCH 09/23] ext4: Verify and calculate checksums for extent tree blocks Darrick J. Wong
2012-01-07  8:28 ` [PATCH 10/23] ext4: Calculate and verify checksums for htree nodes Darrick J. Wong
2012-01-07  8:29 ` [PATCH 11/23] ext4: Calculate and verify checksums of directory leaf blocks Darrick J. Wong
2012-01-07  8:29 ` [PATCH 12/23] ext4: Calculate and verify checksums of extended attribute blocks Darrick J. Wong
2012-01-07  8:29 ` [PATCH 13/23] ext4: Add new feature to make block group checksums use metadata_csum algorithm Darrick J. Wong
     [not found]   ` <8ED6E1F9-DB56-4D31-BCA8-2A3A8D514BD5@dilger.ca>
2012-02-13 22:28     ` Ted Ts'o
2012-02-29  1:27       ` [RFC] e2fsprogs: Rework metadata_csum/gdt_csum flag handling Darrick J. Wong
2012-02-29  5:40         ` Andreas Dilger
2012-03-03  3:50           ` [RFC v2] " Darrick J. Wong
2012-02-29  1:32       ` [RFC] ext4: Rework metadata_csum/gdt_csum flag handling in kernel Darrick J. Wong
2012-02-29  5:48         ` Andreas Dilger
2012-03-03  3:56           ` [RFC v2] " Darrick J. Wong
2012-01-07  8:29 ` [PATCH 14/23] ext4: Add checksums to the MMP block Darrick J. Wong
2012-01-07  8:29 ` [PATCH 15/23] jbd2: Change disk layout for metadata checksumming Darrick J. Wong
2012-01-07  8:29 ` [PATCH 16/23] jbd2: Enable journal clients to enable v2 checksumming Darrick J. Wong
2012-01-07  8:29 ` [PATCH 17/23] jbd2: Grab a reference to the crc32c driver only when necessary Darrick J. Wong
2012-01-07  8:29 ` [PATCH 18/23] jbd2: Checksum journal superblock Darrick J. Wong
2012-01-07  8:30 ` [PATCH 19/23] jbd2: Checksum revocation blocks Darrick J. Wong
2012-01-07  8:30 ` [PATCH 20/23] jbd2: Checksum descriptor blocks Darrick J. Wong
2012-01-07  8:30 ` [PATCH 21/23] jbd2: Checksum commit blocks Darrick J. Wong
2012-01-07  8:30 ` [PATCH 22/23] jbd2: Checksum data blocks that are stored in the journal Darrick J. Wong
2012-01-07  8:30 ` [PATCH 23/23] ext4/jbd2: Add metadata checksumming to the list of supported features Darrick J. Wong
2012-03-06 20:47 [PATCH v3 00/23] ext4: Add metadata checksumming Darrick J. Wong
2012-03-06 20:50 ` [PATCH 18/23] jbd2: Checksum journal superblock Darrick J. Wong

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).