Subject: b_error && b_resid && SCSI tapes
To: None <tech-kern@netbsd.org>
From: Matthew Jacob <mjacob@feral.com>
List: tech-kern
Date: 09/06/2001 11:15:48
The code in scsipi_complete notes:

        if ((bp = xs->bp) != NULL) {
                if (error) {    
                        bp->b_error = error;
                        bp->b_flags |= B_ERROR;
                        bp->b_resid = bp->b_bcount;
                } else {
                        bp->b_error = 0;
                        bp->b_resid = xs->resid;
                }
                biodone(bp);
        }

That is, if you had an error, and this was a block transaction, you say you
didn't move any data.

Strictly speaking this might not be true- you may have actually written data
(but then gotten an error). D'yall think it might be clearer if we did
something like:

        if ((bp = xs->bp) != NULL) {
                if (error) {
			/*
			 * Unless a periph driver has done the noting of
			 * error already, we need to note it.
			 */
			if ((bp->b_flags & B_ERROR) == 0) {
	                        bp->b_error = error;
        	                bp->b_flags |= B_ERROR;
                	        bp->b_resid = bp->b_bcount;
			}
                } else {
                        bp->b_error = 0;
                        bp->b_resid = xs->resid;
                }
                biodone(bp);
        }

??

-matt