From patchwork Sat Jan 7 08:35:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 134814 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 32A68B6F7E for ; Sat, 7 Jan 2012 19:36:18 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759477Ab2AGIgN (ORCPT ); Sat, 7 Jan 2012 03:36:13 -0500 Received: from e35.co.us.ibm.com ([32.97.110.153]:39957 "EHLO e35.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758706Ab2AGIgH (ORCPT ); Sat, 7 Jan 2012 03:36:07 -0500 Received: from /spool/local by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 7 Jan 2012 01:36:07 -0700 Received: from d03relay03.boulder.ibm.com (9.17.195.228) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sat, 7 Jan 2012 01:35:20 -0700 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q078ZJMG144554 for ; Sat, 7 Jan 2012 01:35:19 -0700 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q078ZHJD026421 for ; Sat, 7 Jan 2012 01:35:19 -0700 Received: from elm3c44.beaverton.ibm.com (elm3c44.beaverton.ibm.com [9.47.69.44]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q078ZGsu026360; Sat, 7 Jan 2012 01:35:16 -0700 Subject: [PATCH 22/51] debugfs: Print htree internal node 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, 07 Jan 2012 00:35:16 -0800 Message-ID: <20120107083516.25788.13047.stgit@elm3c44.beaverton.ibm.com> In-Reply-To: <20120107083256.25788.41238.stgit@elm3c44.beaverton.ibm.com> References: <20120107083256.25788.41238.stgit@elm3c44.beaverton.ibm.com> User-Agent: StGit/0.15 MIME-Version: 1.0 x-cbid: 12010708-6148-0000-0000-0000027540DB Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Print htree node checksums when dumping a directory index. Signed-off-by: Darrick J. Wong --- debugfs/htree.c | 17 ++++++++++++++++- 1 files changed, 16 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 diff --git a/debugfs/htree.c b/debugfs/htree.c index 05745eb..2fb804e 100644 --- a/debugfs/htree.c +++ b/debugfs/htree.c @@ -120,8 +120,9 @@ static void htree_dump_int_node(ext2_filsys fs, ext2_ino_t ino, { struct ext2_dx_countlimit limit; struct ext2_dx_entry e; + struct ext2_dx_tail *tail; int hash, i; - + int remainder; limit = *((struct ext2_dx_countlimit *) ent); limit.count = ext2fs_le16_to_cpu(limit.count); @@ -130,6 +131,20 @@ static void htree_dump_int_node(ext2_filsys fs, ext2_ino_t ino, fprintf(pager, "Number of entries (count): %d\n", limit.count); fprintf(pager, "Number of entries (limit): %d\n", limit.limit); + remainder = fs->blocksize - (limit.limit * + sizeof(struct ext2_dx_entry)); + if (ent == (struct ext2_dx_entry *)(rootnode + 1)) + remainder -= sizeof(struct ext2_dx_root_info) + 24; + else + remainder -= 8; + if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super, + EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) && + remainder == sizeof(struct ext2_dx_tail)) { + tail = (struct ext2_dx_tail *)(ent + limit.limit); + fprintf(pager, "Checksum: 0x%08x\n", + ext2fs_le32_to_cpu(tail->dt_checksum)); + } + for (i=0; i < limit.count; i++) { hash = i ? ext2fs_le32_to_cpu(ent[i].hash) : 0; fprintf(pager, "Entry #%d: Hash 0x%08x%s, block %u\n", i,