diff mbox

[02/22] ext4: Create a rocompat flag for extended metadata checksumming

Message ID 20111128232629.19194.43499.stgit@elm3c44.beaverton.ibm.com
State Superseded, archived
Headers show

Commit Message

Darrick J. Wong Nov. 28, 2011, 11:26 p.m. UTC
This patch introduces a rocompat feature flag to signal the presence of
checksums for metadata blocks.  It also provides storage for a precomputed UUID
checksum.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
---
 fs/ext4/ext4.h |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Theodore Ts'o Dec. 5, 2011, 3:41 p.m. UTC | #1
(Reviews sent to ext4 list only)

On Mon, Nov 28, 2011 at 03:26:29PM -0800, Darrick J. Wong wrote:
> This patch introduces a rocompat feature flag to signal the presence
> of checksums for metadata blocks.  It also provides storage for a
> precomputed UUID checksum.
> 
> +
> +	/* Precomputed FS UUID checksum */
> +	__u32 s_uuid_csum;

This is really a checksum seed, right?  Calling it a UUID is going to
be confusing because UUID's are expected to be 128 bits, and something
which is 32 bits can't possibly be a universally unique.

I'd suggest calling this "s_csum_seed", and we explain it as a
random seed which is selected when the file system is formatted.

The commit description could also explain that this is used so we can
detect old metadata blocks left over from a previous use of the
storage device.

       	    	     	      	       	    - Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Darrick J. Wong Dec. 5, 2011, 7:24 p.m. UTC | #2
On Mon, Dec 05, 2011 at 10:41:33AM -0500, Ted Ts'o wrote:
> (Reviews sent to ext4 list only)
> 
> On Mon, Nov 28, 2011 at 03:26:29PM -0800, Darrick J. Wong wrote:
> > This patch introduces a rocompat feature flag to signal the presence
> > of checksums for metadata blocks.  It also provides storage for a
> > precomputed UUID checksum.
> > 
> > +
> > +	/* Precomputed FS UUID checksum */
> > +	__u32 s_uuid_csum;
> 
> This is really a checksum seed, right?  Calling it a UUID is going to
> be confusing because UUID's are expected to be 128 bits, and something
> which is 32 bits can't possibly be a universally unique.

It's the checksum of the FS UUID, so I guess 'seed' describes it.  I wasn't
trying to call it a UUID.

I also need to clarify the changelog, apparently.  s_uuid_csum is *in-core*
storage for a precomputed UUID checksum.  This piece (and i_uuid_inum_csum) are
computed at load time, just in case the user changed the UUID when the fs was
offline.

> I'd suggest calling this "s_csum_seed", and we explain it as a
> random seed which is selected when the file system is formatted.

Not necessarily random, since you can mkfs.ext4 -U.

> The commit description could also explain that this is used so we can
> detect old metadata blocks left over from a previous use of the
> storage device.

Ok.

--D

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 5b0e26a..414c2f8 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1249,6 +1249,9 @@  struct ext4_sb_info {
 
 	/* record the last minlen when FITRIM is called. */
 	atomic_t s_last_trim_minblks;
+
+	/* Precomputed FS UUID checksum */
+	__u32 s_uuid_csum;
 };
 
 static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb)
@@ -1397,6 +1400,7 @@  static inline void ext4_clear_state_flags(struct ext4_inode_info *ei)
 #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE	0x0040
 #define EXT4_FEATURE_RO_COMPAT_QUOTA		0x0100
 #define EXT4_FEATURE_RO_COMPAT_BIGALLOC		0x0200
+#define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM	0x0400
 
 #define EXT4_FEATURE_INCOMPAT_COMPRESSION	0x0001
 #define EXT4_FEATURE_INCOMPAT_FILETYPE		0x0002
@@ -1440,7 +1444,8 @@  static inline void ext4_clear_state_flags(struct ext4_inode_info *ei)
 					 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \
 					 EXT4_FEATURE_RO_COMPAT_BTREE_DIR |\
 					 EXT4_FEATURE_RO_COMPAT_HUGE_FILE |\
-					 EXT4_FEATURE_RO_COMPAT_BIGALLOC)
+					 EXT4_FEATURE_RO_COMPAT_BIGALLOC |\
+					 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)
 
 /*
  * Default values for user and/or group using reserved blocks