[Ocfs2-tools-devel] [PATCH 5/7] debugfs.ocfs2: Support the extended
slot map.
Joel Becker
joel.becker at oracle.com
Sat Jan 12 23:18:06 PST 2008
debugfs.ocfs2 uses lower-level access to read the slot map. Add the
extended slot map calls.
Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
debugfs.ocfs2/commands.c | 8 ++++++--
debugfs.ocfs2/dump.c | 19 +++++++++++++------
debugfs.ocfs2/include/dump.h | 3 ++-
debugfs.ocfs2/utils.c | 4 ++++
include/ocfs2/ocfs2.h | 1 +
5 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/debugfs.ocfs2/commands.c b/debugfs.ocfs2/commands.c
index e021861..de9bc7e 100644
--- a/debugfs.ocfs2/commands.c
+++ b/debugfs.ocfs2/commands.c
@@ -1204,19 +1204,23 @@ static void do_slotmap (char **args)
FILE *out;
errcode_t ret;
int num_slots = OCFS2_RAW_SB(gbls.fs->fs_super)->s_max_slots;
+ struct ocfs2_slot_map_extended *se = NULL;
struct ocfs2_slot_map *sm = NULL;
if (check_device_open())
return ;
- ret = ocfs2_read_slot_map(gbls.fs, num_slots, &sm);
+ if (ocfs2_uses_extended_slot_map(OCFS2_RAW_SB(gbls.fs->fs_super)))
+ ret = ocfs2_read_slot_map_extended(gbls.fs, num_slots, &se);
+ else
+ ret = ocfs2_read_slot_map(gbls.fs, num_slots, &sm);
if (ret) {
com_err(args[0], ret, "while reading slotmap system file");
goto bail;
}
out = open_pager(gbls.interactive);
- dump_slots (out, sm, num_slots);
+ dump_slots (out, se, sm, num_slots);
close_pager (out);
bail:
diff --git a/debugfs.ocfs2/dump.c b/debugfs.ocfs2/dump.c
index 7f89412..f43bf6b 100644
--- a/debugfs.ocfs2/dump.c
+++ b/debugfs.ocfs2/dump.c
@@ -607,20 +607,27 @@ void dump_jbd_unknown (FILE *out, uint64_t start, uint64_t end)
* dump_slots()
*
*/
-void dump_slots (FILE *out, struct ocfs2_slot_map *sm, int num_slots)
+void dump_slots (FILE *out, struct ocfs2_slot_map_extended *se,
+ struct ocfs2_slot_map *sm, int num_slots)
{
int i;
+ unsigned int node_num;
fprintf (out, "\t%5s %5s\n", "Slot#", "Node#");
for (i = 0; i < num_slots; ++i) {
- if (sm->sm_slots[i] == (uint16_t)OCFS2_INVALID_SLOT)
- continue;
+ if (se) {
+ if (!se->se_slots[i].es_valid)
+ continue;
+ node_num = se->se_slots[i].es_node_num;
+ } else {
+ if (sm->sm_slots[i] == (uint16_t)OCFS2_INVALID_SLOT)
+ continue;
+ node_num = sm->sm_slots[i];
+ }
- fprintf (out, "\t%5d %5u\n", i, sm->sm_slots[i]);
+ fprintf (out, "\t%5d %5u\n", i, node_num);
}
-
- return ;
}
void dump_hb (FILE *out, char *buf, uint32_t len)
diff --git a/debugfs.ocfs2/include/dump.h b/debugfs.ocfs2/include/dump.h
index a094b7c..5310d36 100644
--- a/debugfs.ocfs2/include/dump.h
+++ b/debugfs.ocfs2/include/dump.h
@@ -48,7 +48,8 @@ void dump_jbd_superblock (FILE *out, journal_superblock_t *jsb);
void dump_jbd_block (FILE *out, journal_header_t *header, uint64_t blknum);
void dump_jbd_metadata (FILE *out, int type, char *buf, uint64_t blknum);
void dump_jbd_unknown (FILE *out, uint64_t start, uint64_t end);
-void dump_slots (FILE *out, struct ocfs2_slot_map *sm, int num_slots);
+void dump_slots (FILE *out, struct ocfs2_slot_map_extended *se,
+ struct ocfs2_slot_map *sm, int num_slots);
void dump_fast_symlink (FILE *out, char *link);
void dump_hb (FILE *out, char *buf, uint32_t len);
void dump_inode_path (FILE *out, uint64_t blkno, char *path);
diff --git a/debugfs.ocfs2/utils.c b/debugfs.ocfs2/utils.c
index a980362..af323b0 100644
--- a/debugfs.ocfs2/utils.c
+++ b/debugfs.ocfs2/utils.c
@@ -42,6 +42,9 @@ void get_incompat_flag(uint32_t flag, GString *str)
if (flag & OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC)
g_string_append(str, "Sparse ");
+ if (flag & OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP)
+ g_string_append(str, "ExtendedSlotMap ");
+
if (flag & OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG) {
g_string_append(str, "AbortedTunefs ");
}
@@ -50,6 +53,7 @@ void get_incompat_flag(uint32_t flag, GString *str)
OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG |
OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT |
OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC |
+ OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP |
OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG))
g_string_append(str, "Unknown ");
diff --git a/include/ocfs2/ocfs2.h b/include/ocfs2/ocfs2.h
index 5559774..1d8fded 100644
--- a/include/ocfs2/ocfs2.h
+++ b/include/ocfs2/ocfs2.h
@@ -76,6 +76,7 @@
#define OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG_STR "AbortedResize"
#define OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT_STR "Local"
#define OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC_STR "SparseAlloc"
+#define OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP_STR "ExtendedSlotMap"
#define OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG_STR "TunefsAbort"
#define OCFS2_FEATURE_COMPAT_BACKUP_SB_STR "BackupSuper"
#define OCFS2_FEATURE_RO_COMPAT_UNWRITTEN_STR "UnwrittenExtents"
--
1.5.2.2
More information about the Ocfs2-tools-devel
mailing list