[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220223152405.GO12643@twin.jikos.cz>
Date: Wed, 23 Feb 2022 16:24:05 +0100
From: David Sterba <dsterba@...e.cz>
To: Sweet Tea Dorminy <sweettea-kernel@...miny.me>
Cc: Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
David Sterba <dsterba@...e.com>, linux-btrfs@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-team@...com
Subject: Re: [PATCH v3] btrfs: add fs state details to error messages.
On Tue, Feb 22, 2022 at 03:42:28PM -0500, Sweet Tea Dorminy wrote:
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -66,6 +66,46 @@ static struct file_system_type btrfs_root_fs_type;
>
> static int btrfs_remount(struct super_block *sb, int *flags, char *data);
>
> +#define STATE_STRING_PREFACE ": state "
> +#define STATE_STRING_BUF_LEN \
> + (sizeof(STATE_STRING_PREFACE) + BTRFS_FS_STATE_COUNT)
> +
> +/* Characters to print to indicate error conditions. RO is not an error. */
> +static const char * const fs_state_strings[] = {
> + [BTRFS_FS_STATE_ERROR] = "E",
> + [BTRFS_FS_STATE_REMOUNTING] = "M",
> + [BTRFS_FS_STATE_RO] = NULL,
> + [BTRFS_FS_STATE_TRANS_ABORTED] = "A",
> + [BTRFS_FS_STATE_DEV_REPLACING] = "P",
> + [BTRFS_FS_STATE_DUMMY_FS_INFO] = NULL,
> + [BTRFS_FS_STATE_NO_CSUMS] = NULL,
> + [BTRFS_FS_STATE_LOG_CLEANUP_ERROR] = "L",
Yeah that's the idea with the table, but I think you don't need to use
strings, it should be sufficient to use chars, and 0 works for the empty
ones. The way you did it consumes more memory and has indirection with
the pointers to the actual single letter strings.
I'm not sure if we want the non-error states like remounting or
replacing, but actually why not, even if it's a transient state it's
another piece of information that could be useful eventually.
Powered by blists - more mailing lists