diff mbox series

[3/9] btrfs: rename need_do_async_reclaim

Message ID 0a1d66e4cc97d705ec58980f5883cf2a763a44f6.1601495426.git.josef@toxicpanda.com
State New, archived
Headers show
Series Improve preemptive ENOSPC flushing | expand

Commit Message

Josef Bacik Sept. 30, 2020, 8:01 p.m. UTC
All of our normal flushing is asynchronous reclaim, so this helper is
poorly named.  This is more checking if we need to preemptively flush
space, so rename it to need_preemptive_reclaim.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/space-info.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Nikolay Borisov Oct. 1, 2020, 1:20 p.m. UTC | #1
On 30.09.20 г. 23:01 ч., Josef Bacik wrote:
> All of our normal flushing is asynchronous reclaim, so this helper is
> poorly named.  This is more checking if we need to preemptively flush
> space, so rename it to need_preemptive_reclaim.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Nikolay Borisov Oct. 1, 2020, 1:24 p.m. UTC | #2
On 30.09.20 г. 23:01 ч., Josef Bacik wrote:
> All of our normal flushing is asynchronous reclaim, so this helper is
> poorly named.  This is more checking if we need to preemptively flush
> space, so rename it to need_preemptive_reclaim.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
>  fs/btrfs/space-info.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
> index 024daa843c56..98207ea57a3d 100644
> --- a/fs/btrfs/space-info.c
> +++ b/fs/btrfs/space-info.c
> @@ -795,9 +795,9 @@ btrfs_calc_reclaim_metadata_size(struct btrfs_fs_info *fs_info,
>  	return to_reclaim;
>  }
>  
> -static inline int need_do_async_reclaim(struct btrfs_fs_info *fs_info,
> -					struct btrfs_space_info *space_info,
> -					u64 used)
> +static inline int need_preemptive_reclaim(struct btrfs_fs_info *fs_info,
> +					  struct btrfs_space_info *space_info,
> +					  u64 used)

nit: oops I forgot to mention but while at it, why don't you switch the
function to bool return type.

<snip>
Josef Bacik Oct. 1, 2020, 9:37 p.m. UTC | #3
On 10/1/20 9:24 AM, Nikolay Borisov wrote:
> 
> 
> On 30.09.20 г. 23:01 ч., Josef Bacik wrote:
>> All of our normal flushing is asynchronous reclaim, so this helper is
>> poorly named.  This is more checking if we need to preemptively flush
>> space, so rename it to need_preemptive_reclaim.
>>
>> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
>> ---
>>   fs/btrfs/space-info.c | 10 +++++-----
>>   1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
>> index 024daa843c56..98207ea57a3d 100644
>> --- a/fs/btrfs/space-info.c
>> +++ b/fs/btrfs/space-info.c
>> @@ -795,9 +795,9 @@ btrfs_calc_reclaim_metadata_size(struct btrfs_fs_info *fs_info,
>>   	return to_reclaim;
>>   }
>>   
>> -static inline int need_do_async_reclaim(struct btrfs_fs_info *fs_info,
>> -					struct btrfs_space_info *space_info,
>> -					u64 used)
>> +static inline int need_preemptive_reclaim(struct btrfs_fs_info *fs_info,
>> +					  struct btrfs_space_info *space_info,
>> +					  u64 used)
> 
> nit: oops I forgot to mention but while at it, why don't you switch the
> function to bool return type.
> 

Can do, thanks,

Josef
diff mbox series

Patch

diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
index 024daa843c56..98207ea57a3d 100644
--- a/fs/btrfs/space-info.c
+++ b/fs/btrfs/space-info.c
@@ -795,9 +795,9 @@  btrfs_calc_reclaim_metadata_size(struct btrfs_fs_info *fs_info,
 	return to_reclaim;
 }
 
-static inline int need_do_async_reclaim(struct btrfs_fs_info *fs_info,
-					struct btrfs_space_info *space_info,
-					u64 used)
+static inline int need_preemptive_reclaim(struct btrfs_fs_info *fs_info,
+					  struct btrfs_space_info *space_info,
+					  u64 used)
 {
 	u64 thresh = div_factor_fine(space_info->total_bytes, 98);
 
@@ -1015,7 +1015,7 @@  static void btrfs_preempt_reclaim_metadata_space(struct work_struct *work)
 
 	spin_lock(&space_info->lock);
 	used = btrfs_space_info_used(space_info, true);
-	while (need_do_async_reclaim(fs_info, space_info, used)) {
+	while (need_preemptive_reclaim(fs_info, space_info, used)) {
 		enum btrfs_reserve_flush_enum flush;
 		u64 delalloc_size = 0;
 		u64 to_reclaim, block_rsv_size;
@@ -1509,7 +1509,7 @@  static int __reserve_bytes(struct btrfs_fs_info *fs_info,
 		 * the async reclaim as we will panic.
 		 */
 		if (!test_bit(BTRFS_FS_LOG_RECOVERING, &fs_info->flags) &&
-		    need_do_async_reclaim(fs_info, space_info, used) &&
+		    need_preemptive_reclaim(fs_info, space_info, used) &&
 		    !work_busy(&fs_info->preempt_reclaim_work)) {
 			trace_btrfs_trigger_flush(fs_info, space_info->flags,
 						  orig_bytes, flush, "preempt");