diff mbox

[2/2] btrfs: fix free space calculation in dump_space_info()

Message ID 20160629051216.16876-1-wangxg.fnst@cn.fujitsu.com (mailing list archive)
State Superseded
Headers show

Commit Message

Xiaoguang Wang June 29, 2016, 5:12 a.m. UTC
Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
---
 fs/btrfs/extent-tree.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Sterba July 4, 2016, 5:10 p.m. UTC | #1
On Wed, Jun 29, 2016 at 01:12:16PM +0800, Wang Xiaoguang wrote:

Can you please describe in more detail what is this patch fixing?

> Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
> ---
>  fs/btrfs/extent-tree.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 8550a0e..520ba8f 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -7747,8 +7747,8 @@ static void dump_space_info(struct btrfs_space_info *info, u64 bytes,
>  	printk(KERN_INFO "BTRFS: space_info %llu has %llu free, is %sfull\n",
>  	       info->flags,
>  	       info->total_bytes - info->bytes_used - info->bytes_pinned -
> -	       info->bytes_reserved - info->bytes_readonly,
> -	       (info->full) ? "" : "not ");
> +	       info->bytes_reserved - info->bytes_readonly -
> +	       info->bytes_may_use, (info->full) ? "" : "not ");
>  	printk(KERN_INFO "BTRFS: space_info total=%llu, used=%llu, pinned=%llu, "
>  	       "reserved=%llu, may_use=%llu, readonly=%llu\n",
>  	       info->total_bytes, info->bytes_used, info->bytes_pinned,
> -- 
> 2.9.0
> 
> 
> 
> --
> 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
--
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
Xiaoguang Wang July 6, 2016, 10:16 a.m. UTC | #2
hello,

On 07/05/2016 01:10 AM, David Sterba wrote:
> On Wed, Jun 29, 2016 at 01:12:16PM +0800, Wang Xiaoguang wrote:
>
> Can you please describe in more detail what is this patch fixing?
In original dump_space_info(), free space info is calculated by
info->total_bytes - info->bytes_used - info->bytes_pinned - 
info->bytes_reserved - info->bytes_readonly,
but I think free space info should also minus info->bytes_may_use :)

Regards,
Xiaoguang Wang

>
>> Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
>> ---
>>   fs/btrfs/extent-tree.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
>> index 8550a0e..520ba8f 100644
>> --- a/fs/btrfs/extent-tree.c
>> +++ b/fs/btrfs/extent-tree.c
>> @@ -7747,8 +7747,8 @@ static void dump_space_info(struct btrfs_space_info *info, u64 bytes,
>>   	printk(KERN_INFO "BTRFS: space_info %llu has %llu free, is %sfull\n",
>>   	       info->flags,
>>   	       info->total_bytes - info->bytes_used - info->bytes_pinned -
>> -	       info->bytes_reserved - info->bytes_readonly,
>> -	       (info->full) ? "" : "not ");
>> +	       info->bytes_reserved - info->bytes_readonly -
>> +	       info->bytes_may_use, (info->full) ? "" : "not ");
>>   	printk(KERN_INFO "BTRFS: space_info total=%llu, used=%llu, pinned=%llu, "
>>   	       "reserved=%llu, may_use=%llu, readonly=%llu\n",
>>   	       info->total_bytes, info->bytes_used, info->bytes_pinned,
>> -- 
>> 2.9.0
>>
>>
>>
>> --
>> 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
>



--
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
David Sterba July 8, 2016, 2:28 p.m. UTC | #3
On Wed, Jul 06, 2016 at 06:16:06PM +0800, Wang Xiaoguang wrote:
> hello,
> 
> On 07/05/2016 01:10 AM, David Sterba wrote:
> > On Wed, Jun 29, 2016 at 01:12:16PM +0800, Wang Xiaoguang wrote:
> >
> > Can you please describe in more detail what is this patch fixing?
> In original dump_space_info(), free space info is calculated by
> info->total_bytes - info->bytes_used - info->bytes_pinned - 
> info->bytes_reserved - info->bytes_readonly,
> but I think free space info should also minus info->bytes_may_use :)

Not really what I expected. The change is correct but the changelog
should say something "the 'used space' formula is missing the
bytes_may_used, that is used elsewhere eg. __reserve_metadata_bytes or
space_info_add_old_bytes". That way I have something to verify during
the review.
--
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
Xiaoguang Wang July 11, 2016, 11:27 a.m. UTC | #4
hello,

On 07/08/2016 10:28 PM, David Sterba wrote:
> On Wed, Jul 06, 2016 at 06:16:06PM +0800, Wang Xiaoguang wrote:
>> hello,
>>
>> On 07/05/2016 01:10 AM, David Sterba wrote:
>>> On Wed, Jun 29, 2016 at 01:12:16PM +0800, Wang Xiaoguang wrote:
>>>
>>> Can you please describe in more detail what is this patch fixing?
>> In original dump_space_info(), free space info is calculated by
>> info->total_bytes - info->bytes_used - info->bytes_pinned -
>> info->bytes_reserved - info->bytes_readonly,
>> but I think free space info should also minus info->bytes_may_use :)
> Not really what I expected. The change is correct but the changelog
> should say something "the 'used space' formula is missing the
> bytes_may_used, that is used elsewhere eg. __reserve_metadata_bytes or
> space_info_add_old_bytes". That way I have something to verify during
> the review.
Sorry, later I'll try to make my patches more cleaner, thanks.

Regards,
Xiaoguang Wang

>
>



--
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
diff mbox

Patch

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 8550a0e..520ba8f 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -7747,8 +7747,8 @@  static void dump_space_info(struct btrfs_space_info *info, u64 bytes,
 	printk(KERN_INFO "BTRFS: space_info %llu has %llu free, is %sfull\n",
 	       info->flags,
 	       info->total_bytes - info->bytes_used - info->bytes_pinned -
-	       info->bytes_reserved - info->bytes_readonly,
-	       (info->full) ? "" : "not ");
+	       info->bytes_reserved - info->bytes_readonly -
+	       info->bytes_may_use, (info->full) ? "" : "not ");
 	printk(KERN_INFO "BTRFS: space_info total=%llu, used=%llu, pinned=%llu, "
 	       "reserved=%llu, may_use=%llu, readonly=%llu\n",
 	       info->total_bytes, info->bytes_used, info->bytes_pinned,