Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Sep 2002 23:13:14 +0200
From:      Poul-Henning Kamp <phk@critter.freebsd.dk>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        Bruce Evans <bde@zeta.org.au>, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/kern vfs_bio.c src/sys/sys bio.h 
Message-ID:  <3301.1032124394@critter.freebsd.dk>
In-Reply-To: Your message of "Sun, 15 Sep 2002 13:50:10 PDT." <200209152050.g8FKoAkl058030@apollo.backplane.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <200209152050.g8FKoAkl058030@apollo.backplane.com>, Matthew Dillon w
rites:

>    Sigh.  Obviously Poul you aren't interested in anyone commenting on
>    or critiquing your work.

I appreciate any competent and insightful comment on my work, feel free
to submit any you might have instead of this kind.

>    Really.  So you are saying that this is non-critical.

Yes, I am saying that.

I even think everybody who has read the code would agree with that.

>    You have created a general function, biowait(), which you apparently
>    have specialized to only be useful and useable and fairly deterministic
>    in a particular situation.

No, I have made it generally useful, rather than impose a locking
model which is more likely to be wrong than right in all instances
of current use.

Sometimes you have an I/O operation which is totally non-critical
and where using the normal bio_done callback would mean writing an
extra function just to be able to use that interface.

As you have not seen from the source code, all other I/O consumers,
use the expedient and efficient bp->bio_done callback which allows
the controlling entity to autonomously decide and implement whatever
kind of locking is appropriate for this particular struct bio.

The cases which use biowait() are typically semi-synchronous cases,
for instance where you need to format all 160 tracks of a floppy,
or get multiple pieces of information during GEOM-attach.

For this particular kind of bio operations, there is not, and will
never be "the one and only true lock" for any and all struct bio,
and that is why the biowait() function cannot implement any locking
scheme in any meaningful way.

Yes, I could stick biowait() a mutex argument, but I would have to
create a mutex per call in GEOM and create a mutex in the floppy
driver, just to catch a race condition which is unlikely to ever
occur in the first place and which it is perfectly acceptable to
deal with by a short timeout.

I will admit that the timeout solution, is pragmatic, not perfect,
but I happen to think pragmatic is a virtue in programming, and
even more so in people.

Let me quote the 5th commandment from the X11:

	5. If you can get 90 percent of the desired effect for 
           10 percent of the work, use the simpler solution.

In this case we got 99.999% for 10%.

I pressume we are done now ?

Poul-Henning

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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