From patchwork Sat Oct 8 07:37:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 118466 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1DB48B6FAF for ; Sat, 8 Oct 2011 18:40:25 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752974Ab1JHHkI (ORCPT ); Sat, 8 Oct 2011 03:40:08 -0400 Received: from e34.co.us.ibm.com ([32.97.110.152]:39644 "EHLO e34.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752912Ab1JHHkB (ORCPT ); Sat, 8 Oct 2011 03:40:01 -0400 Received: from /spool/local by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 8 Oct 2011 01:40:00 -0600 Received: from d03relay02.boulder.ibm.com ([9.17.195.227]) by e34.co.us.ibm.com ([192.168.1.134]) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sat, 8 Oct 2011 01:39:58 -0600 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p987bm28133904 for ; Sat, 8 Oct 2011 01:37:48 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p987bkks001137 for ; Sat, 8 Oct 2011 01:37:47 -0600 Received: from elm3c44.beaverton.ibm.com ([9.47.69.44]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p987bjPP001126; Sat, 8 Oct 2011 01:37:45 -0600 Subject: [PATCH 42/47] libext2fs: Add feature flags for jbd2 v2 checksums To: Andreas Dilger , Theodore Tso , "Darrick J. Wong" From: "Darrick J. Wong" Cc: Sunil Mushran , Amir Goldstein , Andi Kleen , Mingming Cao , Joel Becker , linux-ext4@vger.kernel.org, Coly Li Date: Sat, 08 Oct 2011 00:37:45 -0700 Message-ID: <20111008073745.17888.93954.stgit@elm3c44.beaverton.ibm.com> In-Reply-To: <20111008073315.17888.22132.stgit@elm3c44.beaverton.ibm.com> References: <20111008073315.17888.22132.stgit@elm3c44.beaverton.ibm.com> User-Agent: StGit/0.15 MIME-Version: 1.0 x-cbid: 11100807-1780-0000-0000-0000001DEA1C Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Add the necessary structure fields, flags, and constants that are needed to extend checksum coverage to all journal metadata blocks. Signed-off-by: Darrick J. Wong --- lib/e2p/feature.c | 2 ++ lib/ext2fs/kernel-jbd.h | 12 ++++++++---- misc/dumpe2fs.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 4 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 diff --git a/lib/e2p/feature.c b/lib/e2p/feature.c index dc52ba7..f85ed14 100644 --- a/lib/e2p/feature.c +++ b/lib/e2p/feature.c @@ -98,6 +98,8 @@ static struct feature jrnl_feature_list[] = { "journal_incompat_revoke" }, { E2P_FEATURE_INCOMPAT, JFS_FEATURE_INCOMPAT_ASYNC_COMMIT, "journal_async_commit" }, + { E2P_FEATURE_INCOMPAT, JFS_FEATURE_INCOMPAT_CSUM_V2, + "journal_checksum_v2" }, { 0, 0, 0 }, }; diff --git a/lib/ext2fs/kernel-jbd.h b/lib/ext2fs/kernel-jbd.h index 066c031..08479d3 100644 --- a/lib/ext2fs/kernel-jbd.h +++ b/lib/ext2fs/kernel-jbd.h @@ -114,6 +114,7 @@ typedef struct journal_header_s #define JBD2_CRC32_CHKSUM 1 #define JBD2_MD5_CHKSUM 2 #define JBD2_SHA1_CHKSUM 3 +#define JBD2_CRC32C_CHKSUM 4 #define JBD2_CRC32_CHKSUM_SIZE 4 @@ -205,7 +206,10 @@ typedef struct journal_superblock_s __u32 s_max_trans_data; /* Limit of data blocks per trans. */ /* 0x0050 */ - __u32 s_padding[44]; + __u8 s_checksum_type; /* checksum type */ + __u8 s_padding2[3]; + __u32 s_padding[42]; + __u32 s_checksum; /* crc32c(superblock) */ /* 0x0100 */ __u8 s_users[16*48]; /* ids of all fs'es sharing the log */ @@ -224,18 +228,18 @@ typedef struct journal_superblock_s #define JFS_FEATURE_COMPAT_CHECKSUM 0x00000001 -#define JFS_FEATURE_INCOMPAT_REVOKE 0x00000001 - #define JFS_FEATURE_INCOMPAT_REVOKE 0x00000001 #define JFS_FEATURE_INCOMPAT_64BIT 0x00000002 #define JFS_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004 +#define JFS_FEATURE_INCOMPAT_CSUM_V2 0x00000008 /* Features known to this kernel version: */ #define JFS_KNOWN_COMPAT_FEATURES 0 #define JFS_KNOWN_ROCOMPAT_FEATURES 0 #define JFS_KNOWN_INCOMPAT_FEATURES (JFS_FEATURE_INCOMPAT_REVOKE|\ JFS_FEATURE_INCOMPAT_ASYNC_COMMIT|\ - JFS_FEATURE_INCOMPAT_64BIT) + JFS_FEATURE_INCOMPAT_64BIT|\ + JFS_FEATURE_INCOMPAT_CSUM_V2) #ifdef __KERNEL__ diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c index 33c0933..a9cec88 100644 --- a/misc/dumpe2fs.c +++ b/misc/dumpe2fs.c @@ -313,6 +313,16 @@ static void list_bad_blocks(ext2_filsys fs, int dump) ext2fs_badblocks_list_free(bb_list); } +static char *journal_checksum_type_str(__u8 type) +{ + switch (type) { + case JBD2_CRC32C_CHKSUM: + return "crc32c"; + default: + return "unknown"; + } +} + static void print_inline_journal_information(ext2_filsys fs) { journal_superblock_t *jsb; @@ -379,6 +389,15 @@ static void print_inline_journal_information(ext2_filsys fs) (unsigned int)ntohl(jsb->s_maxlen), (unsigned int)ntohl(jsb->s_sequence), (unsigned int)ntohl(jsb->s_start)); + if (jsb->s_feature_compat & + ext2fs_cpu_to_be32(JFS_FEATURE_COMPAT_CHECKSUM)) + printf(_("Journal checksum type: crc32\n")); + if (jsb->s_feature_incompat & + ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_CSUM_V2)) + printf(_("Journal checksum type: %s\n" + "Journal checksum: 0x%08x\n"), + journal_checksum_type_str(jsb->s_checksum_type), + ext2fs_be32_to_cpu(jsb->s_checksum)); } static void print_journal_information(ext2_filsys fs) @@ -404,6 +423,16 @@ static void print_journal_information(ext2_filsys fs) exit(1); } + if (jsb->s_feature_compat & + ext2fs_cpu_to_be32(JFS_FEATURE_COMPAT_CHECKSUM)) + printf(_("Journal checksum type: crc32\n")); + if (jsb->s_feature_incompat & + ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_CSUM_V2)) + printf(_("Journal checksum type: %s\n" + "Journal checksum: 0x%08x\n"), + journal_checksum_type_str(jsb->s_checksum_type), + ext2fs_be32_to_cpu(jsb->s_checksum)); + printf(_("\nJournal block size: %u\n" "Journal length: %u\n" "Journal first block: %u\n"