linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: Add enospc_debug printing in metadata_reserve_bytes
@ 2017-12-15 10:05 Nikolay Borisov
  2017-12-15 11:36 ` Qu Wenruo
  2018-02-05 16:20 ` Nikolay Borisov
  0 siblings, 2 replies; 7+ messages in thread
From: Nikolay Borisov @ 2017-12-15 10:05 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

Currently when enoscp_debug mount option is turned on we do not print
any debug info in case metadata reservation failures happen. Fix this
by adding the necessary hook in reserve_metadata_bytes.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/extent-tree.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 4497f937e8fb..7a281fc97bc5 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -5382,10 +5382,15 @@ static int reserve_metadata_bytes(struct btrfs_root *root,
 		    !block_rsv_use_bytes(global_rsv, orig_bytes))
 			ret = 0;
 	}
-	if (ret == -ENOSPC)
+	if (ret == -ENOSPC) {
 		trace_btrfs_space_reservation(fs_info, "space_info:enospc",
 					      block_rsv->space_info->flags,
 					      orig_bytes, 1);
+
+		if (btrfs_test_opt(fs_info, ENOSPC_DEBUG))
+			dump_space_info(fs_info, block_rsv->space_info,
+					orig_bytes, 0);
+	}
 	return ret;
 }
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] btrfs: Add enospc_debug printing in metadata_reserve_bytes
  2017-12-15 10:05 [PATCH] btrfs: Add enospc_debug printing in metadata_reserve_bytes Nikolay Borisov
@ 2017-12-15 11:36 ` Qu Wenruo
  2017-12-15 11:41   ` Nikolay Borisov
  2018-02-05 16:20 ` Nikolay Borisov
  1 sibling, 1 reply; 7+ messages in thread
From: Qu Wenruo @ 2017-12-15 11:36 UTC (permalink / raw)
  To: Nikolay Borisov, linux-btrfs


[-- Attachment #1.1: Type: text/plain, Size: 1392 bytes --]



On 2017年12月15日 18:05, Nikolay Borisov wrote:
> Currently when enoscp_debug mount option is turned on we do not print
> any debug info in case metadata reservation failures happen. Fix this
> by adding the necessary hook in reserve_metadata_bytes.

Reviewed-by: Qu Wenruo <wqu@suse.com>

> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
>  fs/btrfs/extent-tree.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 4497f937e8fb..7a281fc97bc5 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -5382,10 +5382,15 @@ static int reserve_metadata_bytes(struct btrfs_root *root,
>  		    !block_rsv_use_bytes(global_rsv, orig_bytes))
>  			ret = 0;
>  	}
> -	if (ret == -ENOSPC)
> +	if (ret == -ENOSPC) {
>  		trace_btrfs_space_reservation(fs_info, "space_info:enospc",
>  					      block_rsv->space_info->flags,
>  					      orig_bytes, 1);

Nothing related to this patch itself.

But btrfs_space_reservation() seems to be abused.
Every type from delalloc to enospc debug will use it.

What about splitting them into different trace events?

Thanks,
Qu

> +
> +		if (btrfs_test_opt(fs_info, ENOSPC_DEBUG))
> +			dump_space_info(fs_info, block_rsv->space_info,
> +					orig_bytes, 0);
> +	}
>  	return ret;
>  }
>  
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 520 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] btrfs: Add enospc_debug printing in metadata_reserve_bytes
  2017-12-15 11:36 ` Qu Wenruo
@ 2017-12-15 11:41   ` Nikolay Borisov
  0 siblings, 0 replies; 7+ messages in thread
From: Nikolay Borisov @ 2017-12-15 11:41 UTC (permalink / raw)
  To: Qu Wenruo, linux-btrfs



On 15.12.2017 13:36, Qu Wenruo wrote:
> .
> 
> But btrfs_space_reservation() seems to be abused.
> Every type from delalloc to enospc debug will use it.
> 
> What about splitting them into different trace events?

I think trace events form some sort of an ABI so we can't really be
modifying current events, though I'd defer to David on that matter.

OTOH the trace event contains all the information we like - either if
it's an alloc/free operation, whether it's data or metadata and whether
it's enospc or not. Admittedly the last thing is a bit of a pain-point
since if you want to filter enospc you have to do string parsing on the
output from the trace_btrfs_space_reservation. But even this doesn't
sound too compelling to warrant a split. Either ways I'm fine with it.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] btrfs: Add enospc_debug printing in metadata_reserve_bytes
  2017-12-15 10:05 [PATCH] btrfs: Add enospc_debug printing in metadata_reserve_bytes Nikolay Borisov
  2017-12-15 11:36 ` Qu Wenruo
@ 2018-02-05 16:20 ` Nikolay Borisov
  2018-02-06  1:29   ` Qu Wenruo
  1 sibling, 1 reply; 7+ messages in thread
From: Nikolay Borisov @ 2018-02-05 16:20 UTC (permalink / raw)
  To: linux-btrfs



On 15.12.2017 12:05, Nikolay Borisov wrote:
> Currently when enoscp_debug mount option is turned on we do not print
> any debug info in case metadata reservation failures happen. Fix this
> by adding the necessary hook in reserve_metadata_bytes.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
>  fs/btrfs/extent-tree.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 4497f937e8fb..7a281fc97bc5 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -5382,10 +5382,15 @@ static int reserve_metadata_bytes(struct btrfs_root *root,
>  		    !block_rsv_use_bytes(global_rsv, orig_bytes))
>  			ret = 0;
>  	}
> -	if (ret == -ENOSPC)
> +	if (ret == -ENOSPC) {
>  		trace_btrfs_space_reservation(fs_info, "space_info:enospc",
>  					      block_rsv->space_info->flags,
>  					      orig_bytes, 1);
> +
> +		if (btrfs_test_opt(fs_info, ENOSPC_DEBUG))
> +			dump_space_info(fs_info, block_rsv->space_info,
> +					orig_bytes, 0);
> +	}
>  	return ret;
>  }
>  
> 

Ping

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] btrfs: Add enospc_debug printing in metadata_reserve_bytes
  2018-02-05 16:20 ` Nikolay Borisov
@ 2018-02-06  1:29   ` Qu Wenruo
  2018-02-06  9:18     ` Nikolay Borisov
  0 siblings, 1 reply; 7+ messages in thread
From: Qu Wenruo @ 2018-02-06  1:29 UTC (permalink / raw)
  To: Nikolay Borisov, linux-btrfs


[-- Attachment #1.1: Type: text/plain, Size: 1504 bytes --]



On 2018年02月06日 00:20, Nikolay Borisov wrote:
> 
> 
> On 15.12.2017 12:05, Nikolay Borisov wrote:
>> Currently when enoscp_debug mount option is turned on we do not print
>> any debug info in case metadata reservation failures happen. Fix this
>> by adding the necessary hook in reserve_metadata_bytes.
>>
>> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Looks good.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

>> ---
>>  fs/btrfs/extent-tree.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
>> index 4497f937e8fb..7a281fc97bc5 100644
>> --- a/fs/btrfs/extent-tree.c
>> +++ b/fs/btrfs/extent-tree.c
>> @@ -5382,10 +5382,15 @@ static int reserve_metadata_bytes(struct btrfs_root *root,
>>  		    !block_rsv_use_bytes(global_rsv, orig_bytes))
>>  			ret = 0;
>>  	}
>> -	if (ret == -ENOSPC)
>> +	if (ret == -ENOSPC) {
>>  		trace_btrfs_space_reservation(fs_info, "space_info:enospc",
>>  					      block_rsv->space_info->flags,
>>  					      orig_bytes, 1);
>> +
>> +		if (btrfs_test_opt(fs_info, ENOSPC_DEBUG))
>> +			dump_space_info(fs_info, block_rsv->space_info,
>> +					orig_bytes, 0);
>> +	}
>>  	return ret;
>>  }
>>  
>>
> 
> Ping
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 520 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] btrfs: Add enospc_debug printing in metadata_reserve_bytes
  2018-02-06  1:29   ` Qu Wenruo
@ 2018-02-06  9:18     ` Nikolay Borisov
  2018-02-14 13:13       ` David Sterba
  0 siblings, 1 reply; 7+ messages in thread
From: Nikolay Borisov @ 2018-02-06  9:18 UTC (permalink / raw)
  To: Qu Wenruo, linux-btrfs



On  6.02.2018 03:29, Qu Wenruo wrote:
> 
> 
> On 2018年02月06日 00:20, Nikolay Borisov wrote:
>>
>>
>> On 15.12.2017 12:05, Nikolay Borisov wrote:
>>> Currently when enoscp_debug mount option is turned on we do not print
>>> any debug info in case metadata reservation failures happen. Fix this
>>> by adding the necessary hook in reserve_metadata_bytes.
>>>
>>> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> 
> Looks good.
> 
> Reviewed-by: Qu Wenruo <wqu@suse.com>

Yeah you already reviewed it back in December, I was bumping it to make
sure David won't miss it since it's a rather old patch :)

> 
> Thanks,
> Qu
> 
>>> ---
>>>  fs/btrfs/extent-tree.c | 7 ++++++-
>>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
>>> index 4497f937e8fb..7a281fc97bc5 100644
>>> --- a/fs/btrfs/extent-tree.c
>>> +++ b/fs/btrfs/extent-tree.c
>>> @@ -5382,10 +5382,15 @@ static int reserve_metadata_bytes(struct btrfs_root *root,
>>>  		    !block_rsv_use_bytes(global_rsv, orig_bytes))
>>>  			ret = 0;
>>>  	}
>>> -	if (ret == -ENOSPC)
>>> +	if (ret == -ENOSPC) {
>>>  		trace_btrfs_space_reservation(fs_info, "space_info:enospc",
>>>  					      block_rsv->space_info->flags,
>>>  					      orig_bytes, 1);
>>> +
>>> +		if (btrfs_test_opt(fs_info, ENOSPC_DEBUG))
>>> +			dump_space_info(fs_info, block_rsv->space_info,
>>> +					orig_bytes, 0);
>>> +	}
>>>  	return ret;
>>>  }
>>>  
>>>
>>
>> Ping
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] btrfs: Add enospc_debug printing in metadata_reserve_bytes
  2018-02-06  9:18     ` Nikolay Borisov
@ 2018-02-14 13:13       ` David Sterba
  0 siblings, 0 replies; 7+ messages in thread
From: David Sterba @ 2018-02-14 13:13 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: Qu Wenruo, linux-btrfs

On Tue, Feb 06, 2018 at 11:18:41AM +0200, Nikolay Borisov wrote:
> >> On 15.12.2017 12:05, Nikolay Borisov wrote:
> >>> Currently when enoscp_debug mount option is turned on we do not print
> >>> any debug info in case metadata reservation failures happen. Fix this
> >>> by adding the necessary hook in reserve_metadata_bytes.
> >>>
> >>> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> > 
> > Looks good.
> > 
> > Reviewed-by: Qu Wenruo <wqu@suse.com>
> 
> Yeah you already reviewed it back in December, I was bumping it to make
> sure David won't miss it since it's a rather old patch :)

Added to next, thanks.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-02-14 13:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-15 10:05 [PATCH] btrfs: Add enospc_debug printing in metadata_reserve_bytes Nikolay Borisov
2017-12-15 11:36 ` Qu Wenruo
2017-12-15 11:41   ` Nikolay Borisov
2018-02-05 16:20 ` Nikolay Borisov
2018-02-06  1:29   ` Qu Wenruo
2018-02-06  9:18     ` Nikolay Borisov
2018-02-14 13:13       ` David Sterba

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).