On 2018/11/28 上午3:53, David Sterba wrote:
> We can use simple enum for values that are not part of on-disk format:
> global filesystem states.
>
> Signed-off-by: David Sterba <dsterba@xxxxxxxx>
Good comment.
Reviewed-by: Qu Wenruo <wqu@xxxxxxxx>
Thanks,
Qu
> ---
> fs/btrfs/ctree.h | 25 +++++++++++++++++++------
> 1 file changed, 19 insertions(+), 6 deletions(-)
>
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index a98507fa9192..f82ec5e41b0c 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -109,13 +109,26 @@ static inline unsigned long btrfs_chunk_item_size(int num_stripes)
> }
>
> /*
> - * File system states
> + * Runtime (in-memory) states of filesystem
> */
> -#define BTRFS_FS_STATE_ERROR 0
> -#define BTRFS_FS_STATE_REMOUNTING 1
> -#define BTRFS_FS_STATE_TRANS_ABORTED 2
> -#define BTRFS_FS_STATE_DEV_REPLACING 3
> -#define BTRFS_FS_STATE_DUMMY_FS_INFO 4
> +enum {
> + /* Global indicator of serious filesysystem errors */
> + BTRFS_FS_STATE_ERROR,
> + /*
> + * Filesystem is being remounted, allow to skip some operations, like
> + * defrag
> + */
> + BTRFS_FS_STATE_REMOUNTING,
> + /* Track if the transaction abort has been reported */
> + BTRFS_FS_STATE_TRANS_ABORTED,
> + /*
> + * Indicate that replace source or target device state is changed and
> + * allow to block bio operations
> + */
> + BTRFS_FS_STATE_DEV_REPLACING,
> + /* The btrfs_fs_info created for self-tests */
> + BTRFS_FS_STATE_DUMMY_FS_INFO,
> +};
>
> #define BTRFS_BACKREF_REV_MAX 256
> #define BTRFS_BACKREF_REV_SHIFT 56
>
Attachment:
signature.asc
Description: OpenPGP digital signature
