public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: Josef Bacik <josef@toxicpanda.com>,
	linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH 11/17] btrfs: move flush related definitions to space-info.h
Date: Thu, 15 Sep 2022 17:21:16 +0800	[thread overview]
Message-ID: <3929da6f-686f-9545-ffde-81f3aa3586ca@suse.com> (raw)
In-Reply-To: <a946709036f0527dba6ec810e9cd61b19d267d6c.1663167823.git.josef@toxicpanda.com>



On 2022/9/14 23:06, Josef Bacik wrote:
> This code is used in space-info.c, move the definitions to space-info.h.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Looks good overall, but one new header makes me wonder:

> ---
>   fs/btrfs/ctree.h         | 59 ----------------------------------------
>   fs/btrfs/delayed-inode.c |  1 +
>   fs/btrfs/inode-item.c    |  1 +
>   fs/btrfs/props.c         |  1 +
>   fs/btrfs/relocation.c    |  1 +
>   fs/btrfs/space-info.h    | 59 ++++++++++++++++++++++++++++++++++++++++
>   fs/btrfs/super.c         |  1 +
>   7 files changed, 64 insertions(+), 59 deletions(-)
> 
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index 60f8817f5b7c..d99720cf4835 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -2654,65 +2654,6 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
>   
>   void btrfs_clear_space_info_full(struct btrfs_fs_info *info);
>   
> -/*
> - * Different levels for to flush space when doing space reservations.
> - *
> - * The higher the level, the more methods we try to reclaim space.
> - */
> -enum btrfs_reserve_flush_enum {
> -	/* If we are in the transaction, we can't flush anything.*/
> -	BTRFS_RESERVE_NO_FLUSH,
> -
> -	/*
> -	 * Flush space by:
> -	 * - Running delayed inode items
> -	 * - Allocating a new chunk
> -	 */
> -	BTRFS_RESERVE_FLUSH_LIMIT,
> -
> -	/*
> -	 * Flush space by:
> -	 * - Running delayed inode items
> -	 * - Running delayed refs
> -	 * - Running delalloc and waiting for ordered extents
> -	 * - Allocating a new chunk
> -	 */
> -	BTRFS_RESERVE_FLUSH_EVICT,
> -
> -	/*
> -	 * Flush space by above mentioned methods and by:
> -	 * - Running delayed iputs
> -	 * - Committing transaction
> -	 *
> -	 * Can be interrupted by a fatal signal.
> -	 */
> -	BTRFS_RESERVE_FLUSH_DATA,
> -	BTRFS_RESERVE_FLUSH_FREE_SPACE_INODE,
> -	BTRFS_RESERVE_FLUSH_ALL,
> -
> -	/*
> -	 * Pretty much the same as FLUSH_ALL, but can also steal space from
> -	 * global rsv.
> -	 *
> -	 * Can be interrupted by a fatal signal.
> -	 */
> -	BTRFS_RESERVE_FLUSH_ALL_STEAL,
> -};
> -
> -enum btrfs_flush_state {
> -	FLUSH_DELAYED_ITEMS_NR	=	1,
> -	FLUSH_DELAYED_ITEMS	=	2,
> -	FLUSH_DELAYED_REFS_NR	=	3,
> -	FLUSH_DELAYED_REFS	=	4,
> -	FLUSH_DELALLOC		=	5,
> -	FLUSH_DELALLOC_WAIT	=	6,
> -	FLUSH_DELALLOC_FULL	=	7,
> -	ALLOC_CHUNK		=	8,
> -	ALLOC_CHUNK_FORCE	=	9,
> -	RUN_DELAYED_IPUTS	=	10,
> -	COMMIT_TRANS		=	11,
> -};
> -
>   int btrfs_subvolume_reserve_metadata(struct btrfs_root *root,
>   				     struct btrfs_block_rsv *rsv,
>   				     int nitems, bool use_global_rsv);
> diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
> index cac5169eaf8d..a411f04a7b97 100644
> --- a/fs/btrfs/delayed-inode.c
> +++ b/fs/btrfs/delayed-inode.c
> @@ -14,6 +14,7 @@
>   #include "qgroup.h"
>   #include "locking.h"
>   #include "inode-item.h"
> +#include "space-info.h"
>   
>   #define BTRFS_DELAYED_WRITEBACK		512
>   #define BTRFS_DELAYED_BACKGROUND	128
> diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c
> index 0eeb5ea87894..366f3a788c6a 100644
> --- a/fs/btrfs/inode-item.c
> +++ b/fs/btrfs/inode-item.c
> @@ -8,6 +8,7 @@
>   #include "disk-io.h"
>   #include "transaction.h"
>   #include "print-tree.h"
> +#include "space-info.h"
>   
>   struct btrfs_inode_ref *btrfs_find_name_in_backref(struct extent_buffer *leaf,
>   						   int slot, const char *name,
> diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
> index 055a631276ce..07f62e3ba6a5 100644
> --- a/fs/btrfs/props.c
> +++ b/fs/btrfs/props.c
> @@ -10,6 +10,7 @@
>   #include "ctree.h"
>   #include "xattr.h"
>   #include "compression.h"
> +#include "space-info.h"
>   
>   #define BTRFS_PROP_HANDLERS_HT_BITS 8
>   static DEFINE_HASHTABLE(prop_handlers_ht, BTRFS_PROP_HANDLERS_HT_BITS);

>   struct btrfs_space_info {
>   	spinlock_t lock;
>   
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index be7df8d1d5b8..2add5b23c476 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -49,6 +49,7 @@
>   #include "discard.h"
>   #include "qgroup.h"
>   #include "raid56.h"
> +#include "space-info.h"

Why super.c needs this header?

The moved code is definition for btrfs_reserve_flush_enum and 
btrfs_flush_state, but I didn't see any direct usage inside super.c.

Is it for trace event?

Or you just did the same search using "FLUSH" as keyword and got hit on 
FLUSHONCOMMIT?

Thanks,
Qu

>   #define CREATE_TRACE_POINTS
>   #include <trace/events/btrfs.h>
>   

  reply	other threads:[~2022-09-15  9:21 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14 15:06 [PATCH 00/17] btrfs: initial ctree.h cleanups, simple stuff Josef Bacik
2022-09-14 15:06 ` [PATCH 01/17] btrfs: remove set/clear_pending_info helpers Josef Bacik
2022-09-15  9:03   ` Qu Wenruo
2022-09-15 14:11   ` Johannes Thumshirn
2022-10-07 16:51   ` David Sterba
2022-09-14 15:06 ` [PATCH 02/17] btrfs: remove BTRFS_TOTAL_BYTES_PINNED_BATCH Josef Bacik
2022-09-15  9:03   ` Qu Wenruo
2022-09-15 14:11   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 03/17] btrfs: remove BTRFS_IOPRIO_READA Josef Bacik
2022-09-15  9:03   ` Qu Wenruo
2022-09-15 14:12   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 04/17] btrfs: move btrfs on disk definitions out of ctree.h Josef Bacik
2022-09-15  9:07   ` Qu Wenruo
2022-10-07 17:07     ` David Sterba
2022-10-07 23:50       ` Qu Wenruo
2022-09-14 15:06 ` [PATCH 05/17] btrfs: move btrfs_get_block_group helper out of disk-io.h Josef Bacik
2022-09-15  9:10   ` Qu Wenruo
2022-09-15 14:14   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 06/17] btrfs: move maximum limits to btrfs_tree.h Josef Bacik
2022-09-15  9:10   ` Qu Wenruo
2022-09-15 14:15   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 07/17] btrfs: move BTRFS_MAX_MIRRORS into scrub.c Josef Bacik
2022-09-15  9:11   ` Qu Wenruo
2022-09-15 14:16   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 08/17] btrfs: move discard stat defs to free-space-cache.h Josef Bacik
2022-09-15  9:13   ` Qu Wenruo
2022-09-15 14:18   ` Johannes Thumshirn
2022-10-07 17:17     ` David Sterba
2022-10-07 17:16   ` David Sterba
2022-09-14 15:06 ` [PATCH 09/17] btrfs: move btrfs_chunk_item_size out of ctree.h Josef Bacik
2022-09-15  9:14   ` Qu Wenruo
2022-10-07 17:23     ` David Sterba
2022-09-15 14:19   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 10/17] btrfs: move btrfs_should_fragment_free_space into block-group.c Josef Bacik
2022-09-15  9:16   ` Qu Wenruo
2022-09-15 14:21   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 11/17] btrfs: move flush related definitions to space-info.h Josef Bacik
2022-09-15  9:21   ` Qu Wenruo [this message]
2022-10-07 17:28     ` David Sterba
2022-09-15 14:21   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 12/17] btrfs: move btrfs_print_data_csum_error into inode.c Josef Bacik
2022-09-15  9:22   ` Qu Wenruo
2022-10-07 17:31     ` David Sterba
2022-09-15 14:23   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 13/17] btrfs: move trans_handle_cachep out of ctree.h Josef Bacik
2022-09-15  9:23   ` Qu Wenruo
2022-09-15 14:24   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 14/17] btrfs: move btrfs_path_cachep " Josef Bacik
2022-09-15  9:27   ` Qu Wenruo
2022-09-15 14:27   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 15/17] btrfs: move free space cachep's " Josef Bacik
2022-09-15  9:27   ` Qu Wenruo
2022-09-15 14:27   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 16/17] btrfs: move btrfs_next_old_item into ctree.c Josef Bacik
2022-09-15  9:29   ` Qu Wenruo
2022-09-15 14:29   ` Johannes Thumshirn
2022-09-14 15:06 ` [PATCH 17/17] btrfs: move the btrfs_verity_descriptor_item defs up in ctree.h Josef Bacik
2022-09-15  9:30   ` Qu Wenruo
2022-09-15 14:30   ` Johannes Thumshirn
2022-09-15  9:47 ` [PATCH 00/17] btrfs: initial ctree.h cleanups, simple stuff Qu Wenruo
2022-10-07 17:51   ` David Sterba

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=3929da6f-686f-9545-ffde-81f3aa3586ca@suse.com \
    --to=wqu@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.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