svn commit: r260354 - stable/10/sys/kern
Alexander Motin
mav at FreeBSD.org
Sun Jan 5 23:00:39 UTC 2014
Author: mav
Date: Sun Jan 5 23:00:38 2014
New Revision: 260354
URL: http://svnweb.freebsd.org/changeset/base/260354
Log:
MFC r256614:
- Take BIO lock in biodone() only when there is no completion callback set
and so we should wake up thread waiting in biowait().
- Remove msleep() timeout from biowait(). It was added 11 years ago, when
there was no locks used, and it should not be needed any more.
Modified:
stable/10/sys/kern/vfs_bio.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/kern/vfs_bio.c
==============================================================================
--- stable/10/sys/kern/vfs_bio.c Sun Jan 5 22:55:21 2014 (r260353)
+++ stable/10/sys/kern/vfs_bio.c Sun Jan 5 23:00:38 2014 (r260354)
@@ -3559,9 +3559,6 @@ biodone(struct bio *bp)
vm_offset_t start, end;
int transient;
- mtxp = mtx_pool_find(mtxpool_sleep, bp);
- mtx_lock(mtxp);
- bp->bio_flags |= BIO_DONE;
if ((bp->bio_flags & BIO_TRANSIENT_MAPPING) != 0) {
start = trunc_page((vm_offset_t)bp->bio_data);
end = round_page((vm_offset_t)bp->bio_data + bp->bio_length);
@@ -3571,11 +3568,16 @@ biodone(struct bio *bp)
start = end = 0;
}
done = bp->bio_done;
- if (done == NULL)
+ if (done == NULL) {
+ mtxp = mtx_pool_find(mtxpool_sleep, bp);
+ mtx_lock(mtxp);
+ bp->bio_flags |= BIO_DONE;
wakeup(bp);
- mtx_unlock(mtxp);
- if (done != NULL)
+ mtx_unlock(mtxp);
+ } else {
+ bp->bio_flags |= BIO_DONE;
done(bp);
+ }
if (transient) {
pmap_qremove(start, OFF_TO_IDX(end - start));
vmem_free(transient_arena, start, end - start);
@@ -3585,9 +3587,6 @@ biodone(struct bio *bp)
/*
* Wait for a BIO to finish.
- *
- * XXX: resort to a timeout for now. The optimal locking (if any) for this
- * case is not yet clear.
*/
int
biowait(struct bio *bp, const char *wchan)
@@ -3597,7 +3596,7 @@ biowait(struct bio *bp, const char *wcha
mtxp = mtx_pool_find(mtxpool_sleep, bp);
mtx_lock(mtxp);
while ((bp->bio_flags & BIO_DONE) == 0)
- msleep(bp, mtxp, PRIBIO, wchan, hz / 10);
+ msleep(bp, mtxp, PRIBIO, wchan, 0);
mtx_unlock(mtxp);
if (bp->bio_error != 0)
return (bp->bio_error);
More information about the svn-src-all
mailing list