Re: [PATCH 03/10] block: add rq->resid_len

Tejun Heo
2009-04-30T02:03:08Z

Hello, James.

James Bottomley wrote:
> This looks good (although I'd like to test it first).

Yeah, this will need quite a bit of testing.

> Might it not be better to have an accessor setting resid_len? All
> the other patches in the series insulate users from the actual
> members of struct request by accessors, so this is a bit the odd man
> out.

I actually think it's better to expose resid_len in this case as the
semantics of the field is - initialized to zero on issue, contains
residual count on completion and whatever it contains inbetween is
upto the low level driver. Request position or length are different
as they must contain well defined values throughout request processing
and both block layer and low level driver should agree on what they
mean.

Fancy words aside, it basically boils down to allowing llds to do
either "rq->resid_len = blk_rq_bytes() - xferred" on completion or
"rq->resid_len = blk_rq_bytes()" on issue and "rq->resid_len -=
increments" while processing.

It would be better to check that the value is sane on completion tho.

Thanks.

--
tejun