linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Josef Bacik <josef@toxicpanda.com>,
	kernel-team@fb.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 5/5] btrfs: add enospc debug messages for ticket failure
Date: Wed, 21 Aug 2019 09:39:04 +0300	[thread overview]
Message-ID: <09dbb66d-9b23-5b3b-7f91-fdfad6a0202d@suse.com> (raw)
In-Reply-To: <20190816152019.1962-6-josef@toxicpanda.com>



On 16.08.19 г. 18:20 ч., Josef Bacik wrote:
> When debugging weird enospc problems it's handy to be able to dump the
> space info when we wake up all tickets, and see what the ticket values
> are.  This helped me figure out cases where we were enospc'ing when we
> shouldn't have been.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

With the suggestion below implemented you can add:

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  fs/btrfs/space-info.c | 32 ++++++++++++++++++++++++--------
>  1 file changed, 24 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
> index 3d3f301bae26..2819fa91c4f0 100644
> --- a/fs/btrfs/space-info.c
> +++ b/fs/btrfs/space-info.c
> @@ -256,14 +256,9 @@ do {									\
>  	spin_unlock(&__rsv->lock);					\
>  } while (0)
>  
> -void btrfs_dump_space_info(struct btrfs_fs_info *fs_info,
> -			   struct btrfs_space_info *info, u64 bytes,
> -			   int dump_block_groups)
> +static void __btrfs_dump_space_info(struct btrfs_fs_info *fs_info,
> +				    struct btrfs_space_info *info)
>  {
> -	struct btrfs_block_group_cache *cache;
> -	int index = 0;
> -
> -	spin_lock(&info->lock);

lockdep_assert_held please

>  	btrfs_info(fs_info, "space_info %llu has %llu free, is %sfull",
>  		   info->flags,
>  		   info->total_bytes - btrfs_space_info_used(info, true),
> @@ -273,7 +268,6 @@ void btrfs_dump_space_info(struct btrfs_fs_info *fs_info,
>  		info->total_bytes, info->bytes_used, info->bytes_pinned,
>  		info->bytes_reserved, info->bytes_may_use,
>  		info->bytes_readonly);
> -	spin_unlock(&info->lock);
>  
>  	DUMP_BLOCK_RSV(fs_info, global_block_rsv);
>  	DUMP_BLOCK_RSV(fs_info, trans_block_rsv);
> @@ -281,6 +275,19 @@ void btrfs_dump_space_info(struct btrfs_fs_info *fs_info,
>  	DUMP_BLOCK_RSV(fs_info, delayed_block_rsv);
>  	DUMP_BLOCK_RSV(fs_info, delayed_refs_rsv);
>  
> +}
> +
> +void btrfs_dump_space_info(struct btrfs_fs_info *fs_info,
> +			   struct btrfs_space_info *info, u64 bytes,
> +			   int dump_block_groups)
> +{
> +	struct btrfs_block_group_cache *cache;
> +	int index = 0;
> +
> +	spin_lock(&info->lock);
> +	__btrfs_dump_space_info(fs_info, info);
> +	spin_unlock(&info->lock);
> +
>  	if (!dump_block_groups)
>  		return;
>  
> @@ -685,6 +692,11 @@ static bool wake_all_tickets(struct btrfs_fs_info *fs_info,
>  	u64 tickets_id = space_info->tickets_id;
>  	u64 first_ticket_bytes = 0;
>  
> +	if (btrfs_test_opt(fs_info, ENOSPC_DEBUG)) {
> +		btrfs_info(fs_info, "cannot satisfy tickets, dumping space info");
> +		__btrfs_dump_space_info(fs_info, space_info);
> +	}
> +
>  	while (!list_empty(&space_info->tickets) &&
>  	       tickets_id == space_info->tickets_id) {
>  		ticket = list_first_entry(&space_info->tickets,
> @@ -705,6 +717,10 @@ static bool wake_all_tickets(struct btrfs_fs_info *fs_info,
>  		else if (first_ticket_bytes > ticket->bytes)
>  			return true;
>  
> +		if (btrfs_test_opt(fs_info, ENOSPC_DEBUG))
> +			btrfs_info(fs_info, "failing ticket with %llu bytes",
> +				   ticket->bytes);
> +
>  		list_del_init(&ticket->list);
>  		ticket->error = -ENOSPC;
>  		wake_up(&ticket->wait);
> 

  reply	other threads:[~2019-08-21  6:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-16 15:20 [PATCH 0/5] Fix global reserve size and can overcommit Josef Bacik
2019-08-16 15:20 ` [PATCH 1/5] btrfs: change the minimum global reserve size Josef Bacik
2019-08-20 13:45   ` Nikolay Borisov
2019-08-20 19:12     ` Josef Bacik
2019-08-16 15:20 ` [PATCH 2/5] btrfs: always reserve our entire size for the global reserve Josef Bacik
2019-08-20 14:23   ` Nikolay Borisov
2019-08-20 19:13     ` Josef Bacik
2019-08-16 15:20 ` [PATCH 3/5] btrfs: use add_old_bytes when updating " Josef Bacik
2019-08-20 15:33   ` Nikolay Borisov
2019-08-16 15:20 ` [PATCH 4/5] btrfs: do not account global reserve in can_overcommit Josef Bacik
2019-08-21  6:51   ` Nikolay Borisov
2019-08-21 15:30   ` Vladimir Panteleev
2019-08-16 15:20 ` [PATCH 5/5] btrfs: add enospc debug messages for ticket failure Josef Bacik
2019-08-21  6:39   ` Nikolay Borisov [this message]
2019-08-22 19:18 [PATCH 0/5][v2] Fix global reserve size and can overcommit Josef Bacik
2019-08-22 19:19 ` [PATCH 5/5] btrfs: add enospc debug messages for ticket failure Josef Bacik

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=09dbb66d-9b23-5b3b-7f91-fdfad6a0202d@suse.com \
    --to=nborisov@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;
as well as URLs for NNTP newsgroup(s).