[Ocfs2-tools-devel] [PATCH 02/11] debugfs.ocfs2: Display cluster stack information.
Sunil Mushran
Sunil.Mushran at oracle.com
Thu May 29 11:51:43 PDT 2008
Joel Becker wrote:
> debugfs.ocfs2 now recognizes OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK and
> acts appropriately when dumping the superblock. This includes
> displaying the cluster stack name and cluster name.
>
> Signed-off-by: Joel Becker <joel.becker at oracle.com>
>
Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
> diff --git a/debugfs.ocfs2/utils.c b/debugfs.ocfs2/utils.c
> index af323b0..eef0531 100644
> --- a/debugfs.ocfs2/utils.c
> +++ b/debugfs.ocfs2/utils.c
> @@ -28,33 +28,35 @@
>
> extern dbgfs_gbls gbls;
>
> +/*
> + * Tests features in a flag field and adds to a printable string. Expects
> + * the flag field named 'flag' and the string named 'str'. Primarily for
> + * readability.
> + */
> +#define test_feature(_flag, _flagstr) do { \
> + typeof(flag) _f = (_flag); \
> + if (flag & _f) { \
> + g_string_append(str, (_flagstr)); \
> + g_string_append_c(str, ' '); \
> + flag &= ~_f; \
> + } \
> +} while (0)
>
We should make a note of the use of flag and str in the function
where this macro is being used.
> +
> void get_incompat_flag(uint32_t flag, GString *str)
> {
> - if (flag & OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV)
> - g_string_append(str, "Heartbeat ");
> -
> - if (flag & OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG)
> - g_string_append(str, "AbortedResize ");
> -
> - if (flag & OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT)
> - g_string_append(str, "Local ");
> -
> - 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 ");
> - }
>
> - if (flag & ~(OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV |
> - 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))
> + test_feature(OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV, "Heartbeat");
> + test_feature(OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG, "AbortedResize");
> + test_feature(OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT, "Local");
> + test_feature(OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC, "Sparse");
> + test_feature(OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP,
> + "ExtendedSlotMap");
> + test_feature(OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK,
> + "UserspaceClusterStack");
> + test_feature(OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG, "AbortedTunefs");
> +
> + /* test_feature() clears out known flags */
> + if (flag)
> g_string_append(str, "Unknown ");
>
> if (!str->len)
> @@ -81,10 +83,10 @@ void get_tunefs_flag(uint32_t incompat_flag, uint16_t flag, GString *str)
>
> void get_compat_flag(uint32_t flag, GString *str)
> {
> - if (flag & OCFS2_FEATURE_COMPAT_BACKUP_SB)
> - g_string_append(str, "BackupSuper ");
> + test_feature(OCFS2_FEATURE_COMPAT_BACKUP_SB, "BackupSuper");
>
> - if (flag & ~(OCFS2_FEATURE_COMPAT_BACKUP_SB))
> + /* test_feature() clears out known flags */
> + if (flag)
> g_string_append(str, "Unknown ");
>
> if (!str->len)
> @@ -95,10 +97,10 @@ void get_compat_flag(uint32_t flag, GString *str)
>
> void get_rocompat_flag(uint32_t flag, GString *str)
> {
> - if (flag & OCFS2_FEATURE_RO_COMPAT_UNWRITTEN)
> - g_string_append(str, "Unwritten ");
> + test_feature(OCFS2_FEATURE_RO_COMPAT_UNWRITTEN, "Unwritten");
>
> - if (flag & ~OCFS2_FEATURE_RO_COMPAT_UNWRITTEN)
> + /* test_feature() clears out known flags */
> + if (flag)
> g_string_append(str, "Unknown ");
>
> if (!str->len)
>
More information about the Ocfs2-tools-devel
mailing list