[Ocfs2-tools-devel] [PATCH 05/15] dx_dirs v10: Update for dr_num_entries
Coly Li
coly.li at suse.de
Wed Mar 24 12:50:46 PDT 2010
This just adds the new field, swaps it appropriately, and prints it in
debuggs.
Signed-off-by: Mark Fasheh <mfasheh at suse.com>
Signed-off-by: Coly Li <coly.li at suse.de>
---
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 b62a017..be266a7 100644
--- a/include/ocfs2-kernel/ocfs2_fs.h
+++ b/include/ocfs2-kernel/ocfs2_fs.h
@@ -867,7 +867,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)
--
Coly Li
SuSE Labs
More information about the Ocfs2-tools-devel
mailing list