Re: [patch] blk-flush: fix flush policy calculation

From: Shaohua Li
Date: Tue Aug 02 2011 - 21:20:04 EST


2011/8/3 Jeff Moyer <jmoyer@xxxxxxxxxx>:
> Vivek Goyal <vgoyal@xxxxxxxxxx> writes:
>
>>> In testing, I did this:
>>>
>>> @@ -1817,6 +1817,14 @@ int blk_insert_cloned_request(struct
>>> request_queue *q, struct request *rq)
>>>                 return -EIO;
>>>  #endif
>>>
>>> +       if ((rq->cmd_flags & (REQ_FLUSH|REQ_FUA)) && !q->flush_flags) {
>>> +               rq->cmd_flags &= ~(REQ_FLUSH|REQ_FUA);
>>> +               if (!blk_rq_bytes(rq)) {
>>> +                       blk_end_request(rq, 0, 0);
>>> +                       return 0;
>>> +               }
>>> +       }
>>> +
>>
>> Will it make more sense to take care resetting flush/fua flags in
>> blk_insert_flush()
>
> Yes, that's much cleaner.
agreed. doing at blk_insert_flush makes a lot of sense, maybe we have
similar issue
like blk_insert_cloned_request in the future.

>> and also the part which will end the request if request is empty.
>
> Mmm-hmm.
>
> I tried this, and it blew up in my face.  ;-)  Cloned requests from
> device-mapper-land have rq->end_io filled in, which causes
> blk_insert_flush to BUG here:
>
>        BUG_ON(rq->end_io);
>
> So, we can take the usual route of trying to squirrel away a pointer,
> and reinstate that after the flush_data_end_io.  Or, perhaps someone has
> a more clever idea, that might keep us from further expanding struct
> request...?
we still have space at request->rb_node union. And since flush request
doesn't go to io scheduler, we can use the space.

Thanks,
Shaohua
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/