From 56f5ac553c2686271b657ed8be4f8ca001aa7ed6 Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Sun, 11 Apr 2010 16:10:02 +0800 Subject: [PATCH 05/30] dx_dirs: Update for dr_num_entries This just adds the new field, swaps it appropriately, and prints it in debuggs. [Modified the patch for code rebase and cleanup -- Coly Li] Signed-off-by: Mark Fasheh Signed-off-by: Coly Li --- debugfs.ocfs2/dump.c | 2 ++ include/ocfs2-kernel/ocfs2_fs.h | 5 ++++- libocfs2/dirblock.c | 1 + 3 files changed, 7 insertions(+), 1 deletions(-) diff --git a/debugfs.ocfs2/dump.c b/debugfs.ocfs2/dump.c index 2e887ce..88ec430 100644 --- a/debugfs.ocfs2/dump.c +++ b/debugfs.ocfs2/dump.c @@ -600,6 +600,8 @@ void dump_dx_root(FILE *out, struct ocfs2_dx_root_block *dr) "Flags: (0x%x) %s\n", tmp_str, dr->dr_suballoc_bit, dr->dr_flags, flags->str); + fprintf(out, "\tTotal Entry Count: %d\n", dr->dr_num_entries); + dump_block_check(out, &dr->dr_check); if (dr->dr_flags & OCFS2_DX_FLAG_INLINE) diff --git a/include/ocfs2-kernel/ocfs2_fs.h b/include/ocfs2-kernel/ocfs2_fs.h index d4de181..f3c2450 100644 --- a/include/ocfs2-kernel/ocfs2_fs.h +++ b/include/ocfs2-kernel/ocfs2_fs.h @@ -810,7 +810,10 @@ struct ocfs2_dx_root_block { __u8 dr_reserved0; __le16 dr_reserved1; __le64 dr_dir_blkno; /* Pointer to parent inode */ - __le64 dr_reserved2; + __le32 dr_num_entries; /* Total number of + * names stored in + * this directory.*/ + __le32 dr_reserved2; __le64 dr_free_blk; /* Pointer to head of free * unindexed block list. */ __le64 dr_reserved3[15]; diff --git a/libocfs2/dirblock.c b/libocfs2/dirblock.c index d68e5c0..4bf48f3 100644 --- a/libocfs2/dirblock.c +++ b/libocfs2/dirblock.c @@ -266,6 +266,7 @@ static void ocfs2_swap_dx_root_to_cpu(struct ocfs2_dx_root_block *dx_root) dx_root->dr_last_eb_blk = bswap_64(dx_root->dr_last_eb_blk); dx_root->dr_clusters = bswap_32(dx_root->dr_clusters); dx_root->dr_dir_blkno = bswap_64(dx_root->dr_dir_blkno); + dx_root->dr_num_entries = bswap_32(dx_root->dr_num_entries); dx_root->dr_free_blk = bswap_64(dx_root->dr_free_blk); if (dx_root->dr_flags & OCFS2_DX_FLAG_INLINE) -- 1.7.0.2