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

Tejun Heo
2009-04-30T07:22:24Z

Borislav Petkov wrote:
>> 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.
>
> Actually, the second one sounds more natural: resid_len == data_len on
> issue and decrementing while travelling through block layer and LLDD,
> while resid_len == 0 in issue might get confused somewhere.

Yeap, it depends on how the specific low level driver is doing it.

> And I like it too, we've been coming up with all sorts of hacks in
> ide-atapi wrt to residual completion and accounting of what got xferred
> already and rq->resid_len is much more cleaner, IMHO.
>
> /me testing...

AFAICT, residual count handling in ide was most broken. This patch
doesn't fix anything other than making it report 0 resid_len on SG_IO
which is usually better than reporting full residual count. The only
place inside ide where residual count is used in the tape driver to
determine actually transferred size. That part works okay with the
patch applied.

Hmmm... maybe it's about time to finally clean up residual count
handling in ide and libata, which BTW doesn't do anything about it at
the moment.

Thanks.

--
tejun