Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Oct 2005 12:10:13 +0200
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        S?ren Schmidt <sos@FreeBSD.org>
Cc:        Peter Edwards <peadar@FreeBSD.org>, cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/dev/ata atapi-cd.c
Message-ID:  <20051010101013.GB3975@garage.freebsd.pl>
In-Reply-To: <D29978F6-7AD7-4EF8-8A7F-12F7EE533845@FreeBSD.org>
References:  <200510092111.j99LB5gN037609@repoman.freebsd.org> <D29978F6-7AD7-4EF8-8A7F-12F7EE533845@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
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@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)

iD8DBQFDSj4FForvXbEpPzQRAhU5AKD2QkXFz7EASDy3BiBqwAc7w/HNcQCfWsei
aVxAznZMJvsiQSUum+qfUw0=
=NxXt
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051010101013.GB3975>