From 12ba547cb49cd7d99c9c3e33a4832c88fb66a436 Mon Sep 17 00:00:00 2001 From: pjd Date: Thu, 1 Nov 2007 11:04:21 +0000 Subject: [PATCH] Call zil_commit() (if ZIL is not disabled) after every non-read request (BIO_WRITE and BIO_FLUSH) as it is done is Solaris. The difference is that Solaris calls it only for sync requests, but we can't say in GEOM is the request is sync or async, so we do it for every request. MFC after: 1 week --- .../opensolaris/uts/common/fs/zfs/zvol.c | 22 +++++++++---------- .../opensolaris/uts/common/fs/zfs/zvol.c | 22 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c index 38d164ec21f6..fedae03e5107 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c @@ -335,13 +335,6 @@ zvol_serve_one(zvol_state_t *zv, struct bio *bp) bp->bio_completed = bp->bio_length - resid; if (bp->bio_completed < bp->bio_length) bp->bio_error = (off > volsize ? EINVAL : error); - - /* - * XXX: We are devilering here? - * Looks like I don't understand something here, but I was sure it was - * an async request. - */ - g_io_deliver(bp, bp->bio_error); } static void @@ -366,12 +359,19 @@ zvol_worker(void *arg) continue; } mtx_unlock(&zv->zv_queue_mtx); - if (bp->bio_cmd == BIO_FLUSH) { - zil_commit(zv->zv_zilog, UINT64_MAX, ZVOL_OBJ); - g_io_deliver(bp, 0); - } else { + switch (bp->bio_cmd) { + case BIO_FLUSH: + break; + case BIO_READ: + case BIO_WRITE: zvol_serve_one(zv, bp); + break; } + + if (bp->bio_cmd != BIO_READ && !zil_disable) + zil_commit(zv->zv_zilog, UINT64_MAX, ZVOL_OBJ); + + g_io_deliver(bp, bp->bio_error); } } diff --git a/sys/contrib/opensolaris/uts/common/fs/zfs/zvol.c b/sys/contrib/opensolaris/uts/common/fs/zfs/zvol.c index 38d164ec21f6..fedae03e5107 100644 --- a/sys/contrib/opensolaris/uts/common/fs/zfs/zvol.c +++ b/sys/contrib/opensolaris/uts/common/fs/zfs/zvol.c @@ -335,13 +335,6 @@ zvol_serve_one(zvol_state_t *zv, struct bio *bp) bp->bio_completed = bp->bio_length - resid; if (bp->bio_completed < bp->bio_length) bp->bio_error = (off > volsize ? EINVAL : error); - - /* - * XXX: We are devilering here? - * Looks like I don't understand something here, but I was sure it was - * an async request. - */ - g_io_deliver(bp, bp->bio_error); } static void @@ -366,12 +359,19 @@ zvol_worker(void *arg) continue; } mtx_unlock(&zv->zv_queue_mtx); - if (bp->bio_cmd == BIO_FLUSH) { - zil_commit(zv->zv_zilog, UINT64_MAX, ZVOL_OBJ); - g_io_deliver(bp, 0); - } else { + switch (bp->bio_cmd) { + case BIO_FLUSH: + break; + case BIO_READ: + case BIO_WRITE: zvol_serve_one(zv, bp); + break; } + + if (bp->bio_cmd != BIO_READ && !zil_disable) + zil_commit(zv->zv_zilog, UINT64_MAX, ZVOL_OBJ); + + g_io_deliver(bp, bp->bio_error); } }