diff mbox

btrfs: cleanup btrfs_async_submit_limit to return the final limit value

Message ID 20171031125946.26844-1-anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Anand Jain Oct. 31, 2017, 12:59 p.m. UTC
btrfs_async_submit_limit() would return the q depth to be 256, however
when we are using it we are making it 2/3 times of it. So instead let
the function return the final computed value.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/disk-io.c | 6 ++++--
 fs/btrfs/volumes.c | 1 -
 2 files changed, 4 insertions(+), 3 deletions(-)

Comments

Nikolay Borisov Oct. 31, 2017, 2:18 p.m. UTC | #1
On 31.10.2017 14:59, Anand Jain wrote:
> btrfs_async_submit_limit() would return the q depth to be 256, however
> when we are using it we are making it 2/3 times of it. So instead let
> the function return the final computed value.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>

Could you put a bit info about what exactly is this limit controlling in
the changelog.

> ---
>  fs/btrfs/disk-io.c | 6 ++++--
>  fs/btrfs/volumes.c | 1 -
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index dfdab849037b..e58bbc2a68a5 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -861,7 +861,10 @@ unsigned long btrfs_async_submit_limit(struct btrfs_fs_info *info)
>  	unsigned long limit = min_t(unsigned long,
>  				    info->thread_pool_size,
>  				    info->fs_devices->open_devices);
> -	return 256 * limit;
> +	/*
> +	 * As of now limit is computed as 2/3 * 256.
> +	 */

Drop the "As of now" part, since it doesn't bring any value.

> +	return 170 * limit;
>  }
>  
>  static void run_one_async_start(struct btrfs_work *work)
> @@ -887,7 +890,6 @@ static void run_one_async_done(struct btrfs_work *work)
>  	fs_info = async->fs_info;
>  
>  	limit = btrfs_async_submit_limit(fs_info);
> -	limit = limit * 2 / 3;
>  
>  	/*
>  	 * atomic_dec_return implies a barrier for waitqueue_active
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index d1d8aa226bff..8044790c5de6 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -382,7 +382,6 @@ static noinline void run_scheduled_bios(struct btrfs_device *device)
>  
>  	bdi = device->bdev->bd_bdi;
>  	limit = btrfs_async_submit_limit(fs_info);
> -	limit = limit * 2 / 3;
>  
>  loop:
>  	spin_lock(&device->io_lock);
> 
--
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
Anand Jain Nov. 2, 2017, 5:55 a.m. UTC | #2
On 10/31/2017 10:18 PM, Nikolay Borisov wrote:
> 
> 
> On 31.10.2017 14:59, Anand Jain wrote:
>> btrfs_async_submit_limit() would return the q depth to be 256, however
>> when we are using it we are making it 2/3 times of it. So instead let
>> the function return the final computed value.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> 
> Could you put a bit info about what exactly is this limit controlling in
> the changelog.

  Ok will update.

>> ---
>>   fs/btrfs/disk-io.c | 6 ++++--
>>   fs/btrfs/volumes.c | 1 -
>>   2 files changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
>> index dfdab849037b..e58bbc2a68a5 100644
>> --- a/fs/btrfs/disk-io.c
>> +++ b/fs/btrfs/disk-io.c
>> @@ -861,7 +861,10 @@ unsigned long btrfs_async_submit_limit(struct btrfs_fs_info *info)
>>   	unsigned long limit = min_t(unsigned long,
>>   				    info->thread_pool_size,
>>   				    info->fs_devices->open_devices);
>> -	return 256 * limit;
>> +	/*
>> +	 * As of now limit is computed as 2/3 * 256.
>> +	 */
> 
> Drop the "As of now" part, since it doesn't bring any value.

Ok.

Thanks
Anand

>> +	return 170 * limit;
>>   }
>>   
>>   static void run_one_async_start(struct btrfs_work *work)
>> @@ -887,7 +890,6 @@ static void run_one_async_done(struct btrfs_work *work)
>>   	fs_info = async->fs_info;
>>   
>>   	limit = btrfs_async_submit_limit(fs_info);
>> -	limit = limit * 2 / 3;
>>   
>>   	/*
>>   	 * atomic_dec_return implies a barrier for waitqueue_active
>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>> index d1d8aa226bff..8044790c5de6 100644
>> --- a/fs/btrfs/volumes.c
>> +++ b/fs/btrfs/volumes.c
>> @@ -382,7 +382,6 @@ static noinline void run_scheduled_bios(struct btrfs_device *device)
>>   
>>   	bdi = device->bdev->bd_bdi;
>>   	limit = btrfs_async_submit_limit(fs_info);
>> -	limit = limit * 2 / 3;
>>   
>>   loop:
>>   	spin_lock(&device->io_lock);
>>
> --
> 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
diff mbox

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index dfdab849037b..e58bbc2a68a5 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -861,7 +861,10 @@  unsigned long btrfs_async_submit_limit(struct btrfs_fs_info *info)
 	unsigned long limit = min_t(unsigned long,
 				    info->thread_pool_size,
 				    info->fs_devices->open_devices);
-	return 256 * limit;
+	/*
+	 * As of now limit is computed as 2/3 * 256.
+	 */
+	return 170 * limit;
 }
 
 static void run_one_async_start(struct btrfs_work *work)
@@ -887,7 +890,6 @@  static void run_one_async_done(struct btrfs_work *work)
 	fs_info = async->fs_info;
 
 	limit = btrfs_async_submit_limit(fs_info);
-	limit = limit * 2 / 3;
 
 	/*
 	 * atomic_dec_return implies a barrier for waitqueue_active
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index d1d8aa226bff..8044790c5de6 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -382,7 +382,6 @@  static noinline void run_scheduled_bios(struct btrfs_device *device)
 
 	bdi = device->bdev->bd_bdi;
 	limit = btrfs_async_submit_limit(fs_info);
-	limit = limit * 2 / 3;
 
 loop:
 	spin_lock(&device->io_lock);