linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: Use btrfs_space_info_used instead of opencoding it
@ 2017-06-14  8:35 Nikolay Borisov
  2017-06-15  1:17 ` kbuild test robot
  2017-06-15 15:36 ` David Sterba
  0 siblings, 2 replies; 5+ messages in thread
From: Nikolay Borisov @ 2017-06-14  8:35 UTC (permalink / raw)
  To: dsterba; +Cc: linux-btrfs, Nikolay Borisov

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

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 4c0d3980fe3f..a08a743a8e09 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4935,9 +4935,8 @@ btrfs_calc_reclaim_metadata_size(struct btrfs_root *root,
 			   BTRFS_RESERVE_FLUSH_ALL))
 		return 0;
 
-	used = space_info->bytes_used + space_info->bytes_reserved +
-	       space_info->bytes_pinned + space_info->bytes_readonly +
-	       space_info->bytes_may_use;
+	used = btrfs_space_info_used(space_info, true);
+
 	if (can_overcommit(root, space_info, SZ_1M, BTRFS_RESERVE_FLUSH_ALL))
 		expected = div_factor_fine(space_info->total_bytes, 95);
 	else
@@ -5378,9 +5377,7 @@ static void space_info_add_old_bytes(struct btrfs_fs_info *fs_info,
 	 * overcommit, and if we can't then we just need to free up our space
 	 * and not satisfy any requests.
 	 */
-	used = space_info->bytes_used + space_info->bytes_reserved +
-		space_info->bytes_pinned + space_info->bytes_readonly +
-		space_info->bytes_may_use;
+	used = btrfs_space_info_used(space_info, true);
 	if (used - num_bytes >= space_info->total_bytes)
 		check_overcommit = true;
 again:
-- 
2.7.4


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

* Re: [PATCH] btrfs: Use btrfs_space_info_used instead of opencoding it
  2017-06-14  8:35 [PATCH] btrfs: Use btrfs_space_info_used instead of opencoding it Nikolay Borisov
@ 2017-06-15  1:17 ` kbuild test robot
  2017-06-15  6:32   ` Nikolay Borisov
  2017-06-15 15:36 ` David Sterba
  1 sibling, 1 reply; 5+ messages in thread
From: kbuild test robot @ 2017-06-15  1:17 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: kbuild-all, dsterba, linux-btrfs, Nikolay Borisov

[-- Attachment #1: Type: text/plain, Size: 1559 bytes --]

Hi Nikolay,

[auto build test ERROR on v4.9-rc8]
[cannot apply to btrfs/next kdave/for-next next-20170614]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Nikolay-Borisov/btrfs-Use-btrfs_space_info_used-instead-of-opencoding-it/20170615-084940
config: x86_64-randconfig-x012-201724 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   fs/btrfs/extent-tree.c: In function 'btrfs_calc_reclaim_metadata_size':
>> fs/btrfs/extent-tree.c:4918:9: error: implicit declaration of function 'btrfs_space_info_used' [-Werror=implicit-function-declaration]
     used = btrfs_space_info_used(space_info, true);
            ^~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/btrfs_space_info_used +4918 fs/btrfs/extent-tree.c

  4912	
  4913		to_reclaim = min_t(u64, num_online_cpus() * SZ_1M, SZ_16M);
  4914		if (can_overcommit(root, space_info, to_reclaim,
  4915				   BTRFS_RESERVE_FLUSH_ALL))
  4916			return 0;
  4917	
> 4918		used = btrfs_space_info_used(space_info, true);
  4919	
  4920		if (can_overcommit(root, space_info, SZ_1M, BTRFS_RESERVE_FLUSH_ALL))
  4921			expected = div_factor_fine(space_info->total_bytes, 95);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28820 bytes --]

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

* Re: [PATCH] btrfs: Use btrfs_space_info_used instead of opencoding it
  2017-06-15  1:17 ` kbuild test robot
@ 2017-06-15  6:32   ` Nikolay Borisov
  2017-06-16  8:05     ` [kbuild-all] " Ye Xiaolong
  0 siblings, 1 reply; 5+ messages in thread
From: Nikolay Borisov @ 2017-06-15  6:32 UTC (permalink / raw)
  To: kbuild test robot; +Cc: kbuild-all, dsterba, linux-btrfs



On 15.06.2017 04:17, kbuild test robot wrote:
> Hi Nikolay,
> 
> [auto build test ERROR on v4.9-rc8]
> [cannot apply to btrfs/next kdave/for-next next-20170614]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> 
> url:    https://github.com/0day-ci/linux/commits/Nikolay-Borisov/btrfs-Use-btrfs_space_info_used-instead-of-opencoding-it/20170615-084940
> config: x86_64-randconfig-x012-201724 (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=x86_64 
> 
> All errors (new ones prefixed by >>):
> 
>    fs/btrfs/extent-tree.c: In function 'btrfs_calc_reclaim_metadata_size':
>>> fs/btrfs/extent-tree.c:4918:9: error: implicit declaration of function 'btrfs_space_info_used' [-Werror=implicit-function-declaration]
>      used = btrfs_space_info_used(space_info, true);
>             ^~~~~~~~~~~~~~~~~~~~~
>    cc1: some warnings being treated as errors

This patch builds cleanly on latest linux master and it's based off that
tree. I don't see why it's being applied to 4.9-rc8.


> 
> vim +/btrfs_space_info_used +4918 fs/btrfs/extent-tree.c
> 
>   4912	
>   4913		to_reclaim = min_t(u64, num_online_cpus() * SZ_1M, SZ_16M);
>   4914		if (can_overcommit(root, space_info, to_reclaim,
>   4915				   BTRFS_RESERVE_FLUSH_ALL))
>   4916			return 0;
>   4917	
>> 4918		used = btrfs_space_info_used(space_info, true);
>   4919	
>   4920		if (can_overcommit(root, space_info, SZ_1M, BTRFS_RESERVE_FLUSH_ALL))
>   4921			expected = div_factor_fine(space_info->total_bytes, 95);
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
> 

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

* Re: [PATCH] btrfs: Use btrfs_space_info_used instead of opencoding it
  2017-06-14  8:35 [PATCH] btrfs: Use btrfs_space_info_used instead of opencoding it Nikolay Borisov
  2017-06-15  1:17 ` kbuild test robot
@ 2017-06-15 15:36 ` David Sterba
  1 sibling, 0 replies; 5+ messages in thread
From: David Sterba @ 2017-06-15 15:36 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: dsterba, linux-btrfs

On Wed, Jun 14, 2017 at 11:35:34AM +0300, Nikolay Borisov wrote:
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Reviewed-by: David Sterba <dsterba@suse.com>

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

* Re: [kbuild-all] [PATCH] btrfs: Use btrfs_space_info_used instead of opencoding it
  2017-06-15  6:32   ` Nikolay Borisov
@ 2017-06-16  8:05     ` Ye Xiaolong
  0 siblings, 0 replies; 5+ messages in thread
From: Ye Xiaolong @ 2017-06-16  8:05 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: kbuild test robot, kbuild-all, linux-btrfs, dsterba

On 06/15, Nikolay Borisov wrote:
>
>
>On 15.06.2017 04:17, kbuild test robot wrote:
>> Hi Nikolay,
>> 
>> [auto build test ERROR on v4.9-rc8]
>> [cannot apply to btrfs/next kdave/for-next next-20170614]
>> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>> 
>> url:    https://github.com/0day-ci/linux/commits/Nikolay-Borisov/btrfs-Use-btrfs_space_info_used-instead-of-opencoding-it/20170615-084940
>> config: x86_64-randconfig-x012-201724 (attached as .config)
>> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
>> reproduce:
>>         # save the attached .config to linux build tree
>>         make ARCH=x86_64 
>> 
>> All errors (new ones prefixed by >>):
>> 
>>    fs/btrfs/extent-tree.c: In function 'btrfs_calc_reclaim_metadata_size':
>>>> fs/btrfs/extent-tree.c:4918:9: error: implicit declaration of function 'btrfs_space_info_used' [-Werror=implicit-function-declaration]
>>      used = btrfs_space_info_used(space_info, true);
>>             ^~~~~~~~~~~~~~~~~~~~~
>>    cc1: some warnings being treated as errors
>
>This patch builds cleanly on latest linux master and it's based off that
>tree. I don't see why it's being applied to 4.9-rc8.
>

Sorry it's caused by one bug in 0day, now we've fixed it in latest code.
Thanks for your information.

Thanks,
Xiaolong

>
>> 
>> vim +/btrfs_space_info_used +4918 fs/btrfs/extent-tree.c
>> 
>>   4912	
>>   4913		to_reclaim = min_t(u64, num_online_cpus() * SZ_1M, SZ_16M);
>>   4914		if (can_overcommit(root, space_info, to_reclaim,
>>   4915				   BTRFS_RESERVE_FLUSH_ALL))
>>   4916			return 0;
>>   4917	
>>> 4918		used = btrfs_space_info_used(space_info, true);
>>   4919	
>>   4920		if (can_overcommit(root, space_info, SZ_1M, BTRFS_RESERVE_FLUSH_ALL))
>>   4921			expected = div_factor_fine(space_info->total_bytes, 95);
>> 
>> ---
>> 0-DAY kernel test infrastructure                Open Source Technology Center
>> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
>> 
>_______________________________________________
>kbuild-all mailing list
>kbuild-all@lists.01.org
>https://lists.01.org/mailman/listinfo/kbuild-all

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

end of thread, other threads:[~2017-06-16  8:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-14  8:35 [PATCH] btrfs: Use btrfs_space_info_used instead of opencoding it Nikolay Borisov
2017-06-15  1:17 ` kbuild test robot
2017-06-15  6:32   ` Nikolay Borisov
2017-06-16  8:05     ` [kbuild-all] " Ye Xiaolong
2017-06-15 15:36 ` 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).