Subject: Re: pseudo device vnd compress problem
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: tech-kern
Date: 03/04/2007 18:16:46
In article <20070304043206.678b125d.cliff@snipe444.org>,
Cliff Wright  <cliff@snipe444.org> wrote:
>I have found the problem of the pseudo device vnd not working with
>compression on partition a.
>A buffer object is used that contains the desired number of bytes to
>be transfered (b_bcount), and the bytes left (residual) to be transfered
>(b_resid). Near the begining of the transfer the residual is set to
>the total transfer count, then a routine bounds_check_with_label
>(in kern/subr_disk.c) is called, that can adjust the residual count
>if the end of the partition is seen. Although this adjustment looks
>questionable as their appears to be a check of number of blocks against
>number of bytes. At first their appears to be no other change on b_resid
>by this routine. But looking at sys/buf.h it can be seen that b_cylinder
>is by #define the same as b_resid, and is thus set to a cylinder number
>by this routine destroying b_resid.
>  So I can fix vnd by reseting b_resid to b_bcount. However the
>residual adjustment made by bounds_check_with_label is now superfluous,
>and should be removed. But should I now add this check in the vnd code?
>After being carefull to use b_resid instead of b_bcount, it looks like
>no other driver was doing this, so the end of partition check was not
>done any way, and even if it was used, it may have had a bug.

Yes, try it out and if it works, please send a patch.

christos