diff mbox series

bcache: use REQ_PRIO to indicate bio for metadata

Message ID 20180925161213.15923-1-colyli@suse.de (mailing list archive)
State New, archived
Headers show
Series bcache: use REQ_PRIO to indicate bio for metadata | expand

Commit Message

Coly Li Sept. 25, 2018, 4:12 p.m. UTC
In cached_dev_cache_miss() and check_should_bypass(), REQ_META is used
to check whether a bio is for metadata request. REQ_META is used for
blktrace, the correct REQ_ flag should be REQ_PRIO. This flag means the
bio should be prior to other bio, and frequently be used to indicate
metadata io in file system code.

This patch replaces REQ_META with correct flag REQ_PRIO.

CC Adam Manzanares because he explains to me what REQ_PRIO is for.

Signed-off-by: Coly Li <colyli@suse.de>
Cc: Adam Manzanares <adam.manzanares@wdc.com>
---
 drivers/md/bcache/request.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Adam Manzanares Sept. 25, 2018, 4:32 p.m. UTC | #1
On 9/25/18 9:12 AM, Coly Li wrote:
> In cached_dev_cache_miss() and check_should_bypass(), REQ_META is used
> to check whether a bio is for metadata request. REQ_META is used for
> blktrace, the correct REQ_ flag should be REQ_PRIO. This flag means the
> bio should be prior to other bio, and frequently be used to indicate
> metadata io in file system code.
> 
> This patch replaces REQ_META with correct flag REQ_PRIO.
> 
> CC Adam Manzanares because he explains to me what REQ_PRIO is for.

Sorry for the confusion, I was talking about using the bi_ioprio field 
to pass ioprio information down to devices that support prioritized 
commands. I haven't used the REQ_PRIO flag in the work that I have done.

> 
> Signed-off-by: Coly Li <colyli@suse.de>
> Cc: Adam Manzanares <adam.manzanares@wdc.com>
> ---
>   drivers/md/bcache/request.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
> index 51be355a3309..13d3355a90c0 100644
> --- a/drivers/md/bcache/request.c
> +++ b/drivers/md/bcache/request.c
> @@ -395,7 +395,7 @@ static bool check_should_bypass(struct cached_dev *dc, struct bio *bio)
>   	 * unless the read-ahead request is for metadata (eg, for gfs2).
>   	 */
>   	if (bio->bi_opf & (REQ_RAHEAD|REQ_BACKGROUND) &&
> -	    !(bio->bi_opf & REQ_META))
> +	    !(bio->bi_opf & REQ_PRIO))
>   		goto skip;
>   
>   	if (bio->bi_iter.bi_sector & (c->sb.block_size - 1) ||
> @@ -877,7 +877,7 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s,
>   	}
>   
>   	if (!(bio->bi_opf & REQ_RAHEAD) &&
> -	    !(bio->bi_opf & REQ_META) &&
> +	    !(bio->bi_opf & REQ_PRIO) &&
>   	    s->iop.c->gc_stats.in_use < CUTOFF_CACHE_READA)
>   		reada = min_t(sector_t, dc->readahead >> 9,
>   			      get_capacity(bio->bi_disk) - bio_end_sector(bio));
>
Coly Li Sept. 26, 2018, 3:54 a.m. UTC | #2
On 9/26/18 12:32 AM, Adam Manzanares wrote:
>
> On 9/25/18 9:12 AM, Coly Li wrote:
>> In cached_dev_cache_miss() and check_should_bypass(), REQ_META is used
>> to check whether a bio is for metadata request. REQ_META is used for
>> blktrace, the correct REQ_ flag should be REQ_PRIO. This flag means the
>> bio should be prior to other bio, and frequently be used to indicate
>> metadata io in file system code.
>>
>> This patch replaces REQ_META with correct flag REQ_PRIO.
>>
>> CC Adam Manzanares because he explains to me what REQ_PRIO is for.
> Sorry for the confusion, I was talking about using the bi_ioprio field
> to pass ioprio information down to devices that support prioritized
> commands. I haven't used the REQ_PRIO flag in the work that I have done.

Hi Adam,

Aha, I misunderstood you. After 'git blame' I realize REQ_PRIO is 
invented by Christoph Hellwig,

     Add a new REQ_PRIO to let requests preempt others in the cfq I/O 
schedule,
     and lave REQ_META purely for marking requests as metadata in blktrace.

 From log of commit 65299a3b788b ("block: separate priority boosting 
from REQ_META") it seems this patch still uses REQ_PRIO in a correct 
way. And, thank you for clarifying this :-)

Coly Li

>> Signed-off-by: Coly Li <colyli@suse.de>
>> Cc: Adam Manzanares <adam.manzanares@wdc.com>
>> ---
>>    drivers/md/bcache/request.c | 4 ++--
>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
>> index 51be355a3309..13d3355a90c0 100644
>> --- a/drivers/md/bcache/request.c
>> +++ b/drivers/md/bcache/request.c
>> @@ -395,7 +395,7 @@ static bool check_should_bypass(struct cached_dev *dc, struct bio *bio)
>>    	 * unless the read-ahead request is for metadata (eg, for gfs2).
>>    	 */
>>    	if (bio->bi_opf & (REQ_RAHEAD|REQ_BACKGROUND) &&
>> -	    !(bio->bi_opf & REQ_META))
>> +	    !(bio->bi_opf & REQ_PRIO))
>>    		goto skip;
>>    
>>    	if (bio->bi_iter.bi_sector & (c->sb.block_size - 1) ||
>> @@ -877,7 +877,7 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s,
>>    	}
>>    
>>    	if (!(bio->bi_opf & REQ_RAHEAD) &&
>> -	    !(bio->bi_opf & REQ_META) &&
>> +	    !(bio->bi_opf & REQ_PRIO) &&
>>    	    s->iop.c->gc_stats.in_use < CUTOFF_CACHE_READA)
>>    		reada = min_t(sector_t, dc->readahead >> 9,
>>    			      get_capacity(bio->bi_disk) - bio_end_sector(bio));
diff mbox series

Patch

diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 51be355a3309..13d3355a90c0 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -395,7 +395,7 @@  static bool check_should_bypass(struct cached_dev *dc, struct bio *bio)
 	 * unless the read-ahead request is for metadata (eg, for gfs2).
 	 */
 	if (bio->bi_opf & (REQ_RAHEAD|REQ_BACKGROUND) &&
-	    !(bio->bi_opf & REQ_META))
+	    !(bio->bi_opf & REQ_PRIO))
 		goto skip;
 
 	if (bio->bi_iter.bi_sector & (c->sb.block_size - 1) ||
@@ -877,7 +877,7 @@  static int cached_dev_cache_miss(struct btree *b, struct search *s,
 	}
 
 	if (!(bio->bi_opf & REQ_RAHEAD) &&
-	    !(bio->bi_opf & REQ_META) &&
+	    !(bio->bi_opf & REQ_PRIO) &&
 	    s->iop.c->gc_stats.in_use < CUTOFF_CACHE_READA)
 		reada = min_t(sector_t, dc->readahead >> 9,
 			      get_capacity(bio->bi_disk) - bio_end_sector(bio));