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

--6sX45UoQRIJXqkqR
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Oct 10, 2005 at 11:06:49AM +0200, S?ren Schmidt wrote:
+> On 09/10/2005, at 23:11, Peter Edwards wrote:
+>=20
+> Why did you ask me to review this when you just committed it anyway ?
+>=20
+> 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 =3D cdp->iomax - cdp->iomax % bp->bio_to->sectorsize;
	struct bio *cbp;

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

--=20
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--6sX45UoQRIJXqkqR
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)

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

--6sX45UoQRIJXqkqR--



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