[gfs2-utils] 06/06: gfs2edit: journal dump: decode lh_flags
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit e03f156edb8c5bc5cab3e0b9fc5ee969e2489db2
Author: Andreas Gruenbacher <agruenba(a)redhat.com>
AuthorDate: Mon Mar 25 23:13:25 2019 +0000
gfs2edit: journal dump: decode lh_flags
When dumping a journal with "gfs2_edit -p journalX, decode the lh_flags
field of log headers.
---
gfs2/edit/journal.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/gfs2/edit/journal.c b/gfs2/edit/journal.c
index 559bd4e..6364761 100644
--- a/gfs2/edit/journal.c
+++ b/gfs2/edit/journal.c
@@ -476,6 +476,8 @@ static uint64_t get_ldref(uint64_t abs_ld, int offset_from_ld)
*/
void dump_journal(const char *journal, int tblk)
{
+ const struct lgfs2_metadata *mtype;
+ const struct lgfs2_metafield *lh_flags_field;
struct gfs2_buffer_head *j_bh = NULL, dummy_bh;
uint64_t jblock, j_size, jb, abs_block, saveblk, wrappt = 0;
int start_line, journal_num;
@@ -487,6 +489,9 @@ void dump_journal(const char *journal, int tblk)
struct rgrp_tree *rgd = NULL;
uint64_t abs_ld = 0;
+ mtype = lgfs2_find_mtype(GFS2_METATYPE_LH, sbd.gfs1 ? LGFS2_MD_GFS1 : LGFS2_MD_GFS2);
+ lh_flags_field = lgfs2_find_mfield_name("lh_flags", mtype);
+
start_line = line;
lines_per_row[dmode] = 1;
journal_num = atoi(journal + 7);
@@ -593,17 +598,20 @@ void dump_journal(const char *journal, int tblk)
lh1.lh_first, lh1.lh_tail,
lh1.lh_last_dump);
} else {
+ char flags_str[256];
+
gfs2_log_header_in(&lh, dummy_bh.b_data);
check_journal_wrap(lh.lh_sequence,
&highest_seq);
+ lgfs2_field_str(flags_str, sizeof(flags_str),
+ dummy_bh.b_data, lh_flags_field,
+ (dmode == HEX_MODE));
print_gfs2("0x%"PRIx64" (j+%4"PRIx64"): Log header: Seq"
- ": 0x%llx, tail: 0x%x, blk: 0x%x%s",
+ ": 0x%llx, tail: 0x%x, blk: 0x%x [%s]",
abs_block, ((jb + wrappt) % j_size)
/ sbd.bsize, lh.lh_sequence,
lh.lh_tail, lh.lh_blkno,
- lh.lh_flags ==
- GFS2_LOG_HEAD_UNMOUNT ?
- " [UNMOUNTED]" : "");
+ flags_str);
}
eol(0);
} else if ((ld_blocks > 0) &&
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
5 years, 1 month
[gfs2-utils] 05/06: libgfs2: Fix gfs[2]_log_header metadata
description
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 2f8edd6e164e378773a3195a2adbfe874b288050
Author: Andreas Gruenbacher <agruenba(a)redhat.com>
AuthorDate: Mon Mar 25 23:11:04 2019 +0000
libgfs2: Fix gfs[2]_log_header metadata description
We want to use the lgfs2_lh_flags array for decoding the lh_flags field
in gfs2_log_header, not gfs_log_header.
---
gfs2/libgfs2/meta.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c
index 486e0ea..1da7414 100644
--- a/gfs2/libgfs2/meta.c
+++ b/gfs2/libgfs2/meta.c
@@ -388,7 +388,7 @@ MH(jd_header)
static const struct lgfs2_metafield gfs2_log_header_fields[] = {
MH(lh_header)
F(lh_sequence)
-F(lh_flags)
+F(lh_flags, .flags = LGFS2_MFF_MASK, .symtab = lgfs2_lh_flags, .nsyms = ARRAY_SIZE(lgfs2_lh_flags))
F(lh_tail)
F(lh_blkno)
F(lh_hash, .flags = LGFS2_MFF_CHECK)
@@ -411,7 +411,7 @@ F(lh_local_dinodes, .flags = LGFS2_MFF_FSBLOCKS)
static const struct lgfs2_metafield gfs_log_header_fields[] = {
MH(lh_header)
-F(lh_flags, .flags = LGFS2_MFF_MASK, .symtab = lgfs2_lh_flags, .nsyms = ARRAY_SIZE(lgfs2_lh_flags))
+F(lh_flags)
RF(lh_pad)
F(lh_first)
F(lh_sequence)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
5 years, 1 month
[gfs2-utils] 04/06: libgfs2: lgfs2_field_str: Allow to decode
bitmasks
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 78c98e69e5b3473000bf4448ab37b1c181669ffc
Author: Andreas Gruenbacher <agruenba(a)redhat.com>
AuthorDate: Mon Mar 25 21:55:19 2019 +0000
libgfs2: lgfs2_field_str: Allow to decode bitmasks
In lgfs2_field_str, decode bitmasks into their symbolic form when not
creating a hex dump (e.g., "gfs2_edit -x").
---
gfs2/libgfs2/meta.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c
index c151148..486e0ea 100644
--- a/gfs2/libgfs2/meta.c
+++ b/gfs2/libgfs2/meta.c
@@ -970,6 +970,31 @@ int lgfs2_field_str(char *str, const size_t size, const char *blk, const struct
snprintf(str, size, "%"PRIx64, value);
goto out;
}
+ if (field->flags & LGFS2_MFF_MASK) {
+ char *s = str, *end = str + size;
+ unsigned n;
+
+ for (n = 0; n < field->nsyms; n++) {
+ const struct lgfs2_symbolic *sym = &field->symtab[n];
+
+ if (!(value & sym->key))
+ continue;
+ if (s != str && s < end)
+ *s++ = '/';
+ if (s < end) {
+ const char *v = sym->value + sym->prefix;
+ size_t len = strlen(v);
+
+ if (len > end - s)
+ len = end - s;
+ memcpy(s, v, len);
+ s += len;
+ }
+ }
+ if (s < end)
+ *s = '\0';
+ goto out;
+ }
snprintf(str, size, "%"PRIu64, value);
}
out:
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
5 years, 1 month
[gfs2-utils] 03/06: libgfs2: lgfs2_field_str: Separate field
extraction from printing
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit c0fc222b19b1e5de3a56998103cd16daac9fa2a0
Author: Andreas Gruenbacher <agruenba(a)redhat.com>
AuthorDate: Mon Mar 25 21:44:40 2019 +0000
libgfs2: lgfs2_field_str: Separate field extraction from printing
In lgfs2_field_str, separate the extracting a field of known bit width
from printing that field by converting all fields into a temporary
64-bit value. This will simplify the next patch.
---
gfs2/libgfs2/meta.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c
index 19d0c41..c151148 100644
--- a/gfs2/libgfs2/meta.c
+++ b/gfs2/libgfs2/meta.c
@@ -946,23 +946,33 @@ int lgfs2_field_str(char *str, const size_t size, const char *blk, const struct
} else if (field->flags & LGFS2_MFF_STRING) {
snprintf(str, size, "%s", fieldp);
} else {
+ uint64_t value;
+
switch(field->length) {
case sizeof(uint8_t):
- snprintf(str, size, hex? "%"PRIx8 : "%"PRIu8, *(uint8_t *)fieldp);
+ value = *(uint8_t *)fieldp;
break;
case sizeof(uint16_t):
- snprintf(str, size, hex? "%"PRIx16 : "%"PRIu16, be16_to_cpu(*(uint16_t *)fieldp));
+ value = be16_to_cpu(*(uint16_t *)fieldp);
break;
case sizeof(uint32_t):
- snprintf(str, size, hex? "%"PRIx32 : "%"PRIu32, be32_to_cpu(*(uint32_t *)fieldp));
+ value = be32_to_cpu(*(uint32_t *)fieldp);
break;
case sizeof(uint64_t):
- snprintf(str, size, hex? "%"PRIx64 : "%"PRIu64, be64_to_cpu(*(uint64_t *)fieldp));
+ value = be64_to_cpu(*(uint64_t *)fieldp);
break;
default:
- break;
+ *str = 0;
+ goto out;
+ }
+
+ if (hex) {
+ snprintf(str, size, "%"PRIx64, value);
+ goto out;
}
+ snprintf(str, size, "%"PRIu64, value);
}
+out:
str[size - 1] = '\0';
return 0;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
5 years, 1 month
[gfs2-utils] 02/06: libgfs2: Allow to suppress symbol prefixes
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 015a09a937e7d850a69a5a91e15307319340a74f
Author: Andreas Gruenbacher <agruenba(a)redhat.com>
AuthorDate: Mon Mar 25 21:32:17 2019 +0000
libgfs2: Allow to suppress symbol prefixes
Add a PREFIX_SYM macro that allows to define short versions of symbols
(for example, just UNMOUNT for symbol GFS2_LOG_HEAD_UNMOUNT), to be used
in contexts where the prefix isn't helpful.
---
gfs2/libgfs2/libgfs2.h | 1 +
gfs2/libgfs2/meta.c | 55 +++++++++++++++++++++++++-------------------------
2 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 05e4512..f75ff1e 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -105,6 +105,7 @@ enum lgfs2_meta_type {
struct lgfs2_symbolic {
const uint32_t key;
const char *value;
+ unsigned int prefix;
};
struct lgfs2_metafield {
diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c
index 04b8978..19d0c41 100644
--- a/gfs2/libgfs2/meta.c
+++ b/gfs2/libgfs2/meta.c
@@ -8,7 +8,8 @@
#endif
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
-#define SYM(x) { x, #x },
+#define SYM(x) { x, #x, 0 },
+#define PREFIX_SYM(p,x) { p##x, #p #x, sizeof #p - 1 },
const struct lgfs2_symbolic lgfs2_metatypes[] = {
SYM(GFS2_METATYPE_NONE)
@@ -70,35 +71,35 @@ SYM(GFS2_DIF_INHERIT_JDATA)
const unsigned lgfs2_di_flag_size = ARRAY_SIZE(lgfs2_di_flags);
const struct lgfs2_symbolic lgfs2_lh_flags[] = {
-SYM(GFS2_LOG_HEAD_UNMOUNT)
+PREFIX_SYM(GFS2_LOG_HEAD_, UNMOUNT)
#ifdef GFS2_HAS_LH_V2
-SYM(GFS2_LOG_HEAD_FLUSH_NORMAL)
-SYM(GFS2_LO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_FLUSH)
+PREFIX_SYM(GFS2_LFC_, RGRP_GO_SYNC)
+PREFIX_SYM(GFS2_LFC_, INODE_GO_SYNC)
+PREFIX_SYM(GFS2_LFC_, INODE_GO_INVAL)
+PREFIX_SYM(GFS2_LFC_, FREEZE_GO_SYNC)
+PREFIX_SYM(GFS2_LFC_, KILL_SB)
+PREFIX_SYM(GFS2_LFC_, DO_SYNC)
+PREFIX_SYM(GFS2_LFC_, INPLACE_RESERVE)
+PREFIX_SYM(GFS2_LFC_, WRITE_INODE)
+PREFIX_SYM(GFS2_LFC_, MAKE_FS_RO)
+PREFIX_SYM(GFS2_LFC_, SYNC_FS)
+PREFIX_SYM(GFS2_LFC_, EVICT_INODE)
+PREFIX_SYM(GFS2_LFC_, TRANS_END)
+PREFIX_SYM(GFS2_LFC_, LOGD_JFLUSH_REQD)
+PREFIX_SYM(GFS2_LFC_, LOGD_AIL_FLUSH_REQD)
#endif
};
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
5 years, 1 month
[gfs2-utils] 01/06: libgfs2: Update metadata definition of
gfs2_log_header.lh_flags
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 6d590c81977b104c22e6d0caca28aea149280dfe
Author: Andreas Gruenbacher <agruenba(a)redhat.com>
AuthorDate: Mon Mar 25 21:17:26 2019 +0000
libgfs2: Update metadata definition of gfs2_log_header.lh_flags
Update the metadata definition of field lh_flags in struct gfs2_log_header.
---
gfs2/libgfs2/meta.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c
index e0ea491..04b8978 100644
--- a/gfs2/libgfs2/meta.c
+++ b/gfs2/libgfs2/meta.c
@@ -71,6 +71,35 @@ const unsigned lgfs2_di_flag_size = ARRAY_SIZE(lgfs2_di_flags);
const struct lgfs2_symbolic lgfs2_lh_flags[] = {
SYM(GFS2_LOG_HEAD_UNMOUNT)
+#ifdef GFS2_HAS_LH_V2
+SYM(GFS2_LOG_HEAD_FLUSH_NORMAL)
+SYM(GFS2_LOG_HEAD_FLUSH_SYNC)
+SYM(GFS2_LOG_HEAD_FLUSH_SHUTDOWN)
+SYM(GFS2_LOG_HEAD_FLUSH_FREEZE)
+SYM(GFS2_LOG_HEAD_RECOVERY)
+SYM(GFS2_LOG_HEAD_USERSPACE)
+
+/* Log flush callers */
+SYM(GFS2_LFC_SHUTDOWN)
+SYM(GFS2_LFC_JDATA_WPAGES)
+SYM(GFS2_LFC_SET_FLAGS)
+SYM(GFS2_LFC_AIL_EMPTY_GL)
+SYM(GFS2_LFC_AIL_FLUSH)
+SYM(GFS2_LFC_RGRP_GO_SYNC)
+SYM(GFS2_LFC_INODE_GO_SYNC)
+SYM(GFS2_LFC_INODE_GO_INVAL)
+SYM(GFS2_LFC_FREEZE_GO_SYNC)
+SYM(GFS2_LFC_KILL_SB)
+SYM(GFS2_LFC_DO_SYNC)
+SYM(GFS2_LFC_INPLACE_RESERVE)
+SYM(GFS2_LFC_WRITE_INODE)
+SYM(GFS2_LFC_MAKE_FS_RO)
+SYM(GFS2_LFC_SYNC_FS)
+SYM(GFS2_LFC_EVICT_INODE)
+SYM(GFS2_LFC_TRANS_END)
+SYM(GFS2_LFC_LOGD_JFLUSH_REQD)
+SYM(GFS2_LFC_LOGD_AIL_FLUSH_REQD)
+#endif
};
const unsigned int lgfs2_lh_flag_size = ARRAY_SIZE(lgfs2_lh_flags);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
5 years, 1 month