cvs commit: src/sys/dev/ata atapi-cd.c

Pawel Jakub Dawidek pjd at FreeBSD.org
Mon Oct 10 03:10:49 PDT 2005


On Mon, Oct 10, 2005 at 11:06:49AM +0200, S?ren Schmidt wrote:
+> On 09/10/2005, at 23:11, Peter Edwards wrote:
+> 
+> Why did you ask me to review this when you just committed it anyway ?
+> 
+> As I said I'm not sure this is the right way to fix this..

It seems to be right. I do it in my GEOM classes to handle g_clone_bio()
failures better. So the only objection I may have is that it could be
done a bit cleaner:

	struct bio_queue_head queue;
	u_int pos, size = cdp->iomax - cdp->iomax % bp->bio_to->sectorsize;
	struct bio *cbp;

	for (pos = 0; pos < bp->bio_length; pos += size) {
		cbp = g_clone_bio(bp);
		if (cbp == NULL) {
			for (cbp = bioq_first(&queue); cbp != NULL;
			    cbp = bioq_first(&queue)) {
				bioq_remove(&queue, cbp);
				g_destroy_bio(cbp);
			}
			if (bp->bio_error == 0)
				bp->bio_error = ENOMEM;
			g_io_deliver(bp, bp->bio_error);
			return;
		}
		bioq_insert_tail(&queue, cbp);
		cbp->bio_done = g_std_done;
		cbp->bio_to = bp->bio_to;
		cbp->bio_offset += pos;
		cbp->bio_data += pos; 
		cbp->bio_length = MIN(size, bp->bio_length - pos);
		cbp->bio_pblkno = cbp->bio_offset / cbp->bio_to->sectorsize;
	}
	while ((cbp = bioq_first(&queue)) != NULL) {
		bioq_remove(&queue, cbp);
		acd_strategy(cbp);
	}

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd at FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20051010/cec45508/attachment.bin


More information about the cvs-src mailing list