Re: [PATCH] block: fix residual byte count handling

From: Jens Axboe
Date: Thu Feb 28 2008 - 10:35:59 EST


On Thu, Feb 28 2008, Tejun Heo wrote:
> rq->raw_data_len introduced for block layer padding and draining
> (commit 6b00769fe1502b4ad97bb327ef7ac971b208bfb5) broke residual byte
> count handling. Block drivers modify rq->data_len to notify residual
> byte count to the block layer which blindly reported unmodified
> rq->raw_data_len to userland.
>
> To keep block drivers dealing only with rq->data_len, this should be
> handled inside block layer. However, how much extra buffer was
> appened is lost after rq->data_len is modified.
>
> This patch replaces rq->raw_data_len with rq->extra_len and add
> blk_rq_raw_data_len() helper to calculate raw data size from
> rq->data_len and rq->extra_len. The helper returns correct raw
> residual byte count when called on a rq whose data_len is modified to
> carry residual byte count.
>
> This problem was reported and diagnosed by Mike Galbraith.

Tejun, this patch isn't much cleaner at all. It really shows the pain of
these two seperate, yet related, variables.

--
Jens Axboe

--
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/