linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 9/9] btrfs: drop extra enum initialization where using defaults
Date: Tue, 27 Nov 2018 16:38:29 -0800	[thread overview]
Message-ID: <20181128003829.GQ846@vader> (raw)
In-Reply-To: <932e555ce5dff2ec978bf1d21a4ef1d8d5e7ccfd.1543348078.git.dsterba@suse.com>

On Tue, Nov 27, 2018 at 08:53:59PM +0100, David Sterba wrote:
> The first auto-assigned value to enum is 0, we can use that and not
> initialize all members where the auto-increment does the same. This is
> used for values that are not part of on-disk format.

Reviewed-by: Omar Sandoval <osandov@fb.com>

> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
>  fs/btrfs/btrfs_inode.h |  2 +-
>  fs/btrfs/ctree.h       | 28 ++++++++++++++--------------
>  fs/btrfs/disk-io.h     | 10 +++++-----
>  fs/btrfs/qgroup.h      |  2 +-
>  fs/btrfs/sysfs.h       |  2 +-
>  fs/btrfs/transaction.h | 14 +++++++-------
>  6 files changed, 29 insertions(+), 29 deletions(-)
> 
> diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
> index 4de321aee7a5..fc25607304f2 100644
> --- a/fs/btrfs/btrfs_inode.h
> +++ b/fs/btrfs/btrfs_inode.h
> @@ -20,7 +20,7 @@
>   * new data the application may have written before commit.
>   */
>  enum {
> -	BTRFS_INODE_ORDERED_DATA_CLOSE = 0,
> +	BTRFS_INODE_ORDERED_DATA_CLOSE,
>  	BTRFS_INODE_DUMMY,
>  	BTRFS_INODE_IN_DEFRAG,
>  	BTRFS_INODE_HAS_ASYNC_EXTENT,
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index 4bb0ac3050ff..f1d1c6ba3aa1 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -334,7 +334,7 @@ struct btrfs_node {
>   * The slots array records the index of the item or block pointer
>   * used while walking the tree.
>   */
> -enum { READA_NONE = 0, READA_BACK, READA_FORWARD };
> +enum { READA_NONE, READA_BACK, READA_FORWARD };
>  struct btrfs_path {
>  	struct extent_buffer *nodes[BTRFS_MAX_LEVEL];
>  	int slots[BTRFS_MAX_LEVEL];
> @@ -532,18 +532,18 @@ struct btrfs_free_cluster {
>  };
>  
>  enum btrfs_caching_type {
> -	BTRFS_CACHE_NO		= 0,
> -	BTRFS_CACHE_STARTED	= 1,
> -	BTRFS_CACHE_FAST	= 2,
> -	BTRFS_CACHE_FINISHED	= 3,
> -	BTRFS_CACHE_ERROR	= 4,
> +	BTRFS_CACHE_NO,
> +	BTRFS_CACHE_STARTED,
> +	BTRFS_CACHE_FAST,
> +	BTRFS_CACHE_FINISHED,
> +	BTRFS_CACHE_ERROR,
>  };
>  
>  enum btrfs_disk_cache_state {
> -	BTRFS_DC_WRITTEN	= 0,
> -	BTRFS_DC_ERROR		= 1,
> -	BTRFS_DC_CLEAR		= 2,
> -	BTRFS_DC_SETUP		= 3,
> +	BTRFS_DC_WRITTEN,
> +	BTRFS_DC_ERROR,
> +	BTRFS_DC_CLEAR,
> +	BTRFS_DC_SETUP,
>  };
>  
>  struct btrfs_caching_control {
> @@ -2621,10 +2621,10 @@ static inline gfp_t btrfs_alloc_write_mask(struct address_space *mapping)
>  /* extent-tree.c */
>  
>  enum btrfs_inline_ref_type {
> -	BTRFS_REF_TYPE_INVALID =	 0,
> -	BTRFS_REF_TYPE_BLOCK =		 1,
> -	BTRFS_REF_TYPE_DATA =		 2,
> -	BTRFS_REF_TYPE_ANY =		 3,
> +	BTRFS_REF_TYPE_INVALID,
> +	BTRFS_REF_TYPE_BLOCK,
> +	BTRFS_REF_TYPE_DATA,
> +	BTRFS_REF_TYPE_ANY,
>  };
>  
>  int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb,
> diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
> index 4cccba22640f..987a64bc0c66 100644
> --- a/fs/btrfs/disk-io.h
> +++ b/fs/btrfs/disk-io.h
> @@ -21,11 +21,11 @@
>  #define BTRFS_BDEV_BLOCKSIZE	(4096)
>  
>  enum btrfs_wq_endio_type {
> -	BTRFS_WQ_ENDIO_DATA = 0,
> -	BTRFS_WQ_ENDIO_METADATA = 1,
> -	BTRFS_WQ_ENDIO_FREE_SPACE = 2,
> -	BTRFS_WQ_ENDIO_RAID56 = 3,
> -	BTRFS_WQ_ENDIO_DIO_REPAIR = 4,
> +	BTRFS_WQ_ENDIO_DATA,
> +	BTRFS_WQ_ENDIO_METADATA,
> +	BTRFS_WQ_ENDIO_FREE_SPACE,
> +	BTRFS_WQ_ENDIO_RAID56,
> +	BTRFS_WQ_ENDIO_DIO_REPAIR,
>  };
>  
>  static inline u64 btrfs_sb_offset(int mirror)
> diff --git a/fs/btrfs/qgroup.h b/fs/btrfs/qgroup.h
> index d8f78f5ab854..e4e6ee44073a 100644
> --- a/fs/btrfs/qgroup.h
> +++ b/fs/btrfs/qgroup.h
> @@ -70,7 +70,7 @@ struct btrfs_qgroup_extent_record {
>   *	be converted into META_PERTRANS.
>   */
>  enum btrfs_qgroup_rsv_type {
> -	BTRFS_QGROUP_RSV_DATA = 0,
> +	BTRFS_QGROUP_RSV_DATA,
>  	BTRFS_QGROUP_RSV_META_PERTRANS,
>  	BTRFS_QGROUP_RSV_META_PREALLOC,
>  	BTRFS_QGROUP_RSV_LAST,
> diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h
> index c6ee600aff89..40716b357c1d 100644
> --- a/fs/btrfs/sysfs.h
> +++ b/fs/btrfs/sysfs.h
> @@ -9,7 +9,7 @@
>  extern u64 btrfs_debugfs_test;
>  
>  enum btrfs_feature_set {
> -	FEAT_COMPAT = 0,
> +	FEAT_COMPAT,
>  	FEAT_COMPAT_RO,
>  	FEAT_INCOMPAT,
>  	FEAT_MAX
> diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
> index 703d5116a2fc..f1ba78949d1b 100644
> --- a/fs/btrfs/transaction.h
> +++ b/fs/btrfs/transaction.h
> @@ -12,13 +12,13 @@
>  #include "ctree.h"
>  
>  enum btrfs_trans_state {
> -	TRANS_STATE_RUNNING		= 0,
> -	TRANS_STATE_BLOCKED		= 1,
> -	TRANS_STATE_COMMIT_START	= 2,
> -	TRANS_STATE_COMMIT_DOING	= 3,
> -	TRANS_STATE_UNBLOCKED		= 4,
> -	TRANS_STATE_COMPLETED		= 5,
> -	TRANS_STATE_MAX			= 6,
> +	TRANS_STATE_RUNNING,
> +	TRANS_STATE_BLOCKED,
> +	TRANS_STATE_COMMIT_START,
> +	TRANS_STATE_COMMIT_DOING,
> +	TRANS_STATE_UNBLOCKED,
> +	TRANS_STATE_COMPLETED,
> +	TRANS_STATE_MAX,
>  };
>  
>  #define BTRFS_TRANS_HAVE_FREE_BGS	0
> -- 
> 2.19.1
> 

  reply	other threads:[~2018-11-28  0:38 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-27 19:53 [PATCH 0/9] Switch defines to enums David Sterba
2018-11-27 19:53 ` [PATCH 1/9] btrfs: switch BTRFS_FS_STATE_* " David Sterba
2018-11-28  0:24   ` Omar Sandoval
2018-11-28 15:22     ` David Sterba
2018-11-28  1:18   ` Qu Wenruo
2018-11-28 12:49   ` Johannes Thumshirn
2018-11-27 19:53 ` [PATCH 2/9] btrfs: switch BTRFS_BLOCK_RSV_* " David Sterba
2018-11-28  0:25   ` Omar Sandoval
2018-11-28  1:19   ` Qu Wenruo
2018-11-28 12:50   ` Johannes Thumshirn
2018-11-27 19:53 ` [PATCH 3/9] btrfs: switch BTRFS_FS_* " David Sterba
2018-11-28  0:28   ` Omar Sandoval
2018-11-28  1:21   ` Qu Wenruo
2018-11-27 19:53 ` [PATCH 4/9] btrfs: switch BTRFS_ROOT_* " David Sterba
2018-11-28  0:30   ` Omar Sandoval
2018-11-28  1:22   ` Qu Wenruo
2018-11-28 13:17   ` Johannes Thumshirn
2018-11-27 19:53 ` [PATCH 5/9] btrfs: swtich EXTENT_BUFFER_* " David Sterba
2018-11-28  0:31   ` Omar Sandoval
2018-11-28  1:24   ` Qu Wenruo
2018-11-28 13:19   ` Johannes Thumshirn
2018-11-27 19:53 ` [PATCH 6/9] btrfs: switch EXTENT_FLAG_* " David Sterba
2018-11-28  0:32   ` Omar Sandoval
2018-11-28  1:25   ` Qu Wenruo
2018-11-28 13:26   ` Johannes Thumshirn
2018-11-27 19:53 ` [PATCH 7/9] btrfs: switch BTRFS_*_LOCK " David Sterba
2018-11-28  0:37   ` Omar Sandoval
2018-11-28 13:22     ` David Sterba
2018-11-28  1:26   ` Qu Wenruo
2018-11-27 19:53 ` [PATCH 8/9] btrfs: switch BTRFS_ORDERED_* " David Sterba
2018-11-28  0:37   ` Omar Sandoval
2018-11-28  1:32   ` Qu Wenruo
2018-11-28 13:28   ` Johannes Thumshirn
2018-11-27 19:53 ` [PATCH 9/9] btrfs: drop extra enum initialization where using defaults David Sterba
2018-11-28  0:38   ` Omar Sandoval [this message]
2018-11-28  1:35   ` Qu Wenruo
2018-11-28 13:29   ` Johannes Thumshirn
2018-11-28  1:33 ` [PATCH 0/9] Switch defines to enums Qu Wenruo
2018-11-28 13:25   ` David Sterba
2018-11-28 13:50     ` Qu Wenruo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181128003829.GQ846@vader \
    --to=osandov@osandov.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).