summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2012-03-21 11:51:27 -0700
committerBrian Behlendorf <[email protected]>2012-03-21 14:51:01 -0700
commitc8df41538db3723edf3536379a78fbaf68f037d0 (patch)
tree79d7a3c6b3631a5f26314c8a597d93573da20945
parent43c8454724e0ba70b13e40cd2f63ad0d68942776 (diff)
Revert "Add zio constructor/destructor"
This patch was slightly flawed and allowed for zio->io_logical to potentially not be reinitialized for a new zio. This could lead to assertion failures in specific cases when debugging is enabled (--enable-debug) and I/O errors are encountered. It may also have caused problems when issues logical I/Os. Since we want to make sure this workaround can be easily removed in the future (when we have the real fix). I'm reverting this change and applying a new version of the patch which includes the zio->io_logical fix. This reverts commit 2c6d0b1e07b0265f0661ed7851d3aa8d3e75e7a9. Signed-off-by: Brian Behlendorf <[email protected]> Issue #602 Issue #604
-rw-r--r--module/zfs/zio.c77
1 files changed, 15 insertions, 62 deletions
diff --git a/module/zfs/zio.c b/module/zfs/zio.c
index 69a661201..c96442d0b 100644
--- a/module/zfs/zio.c
+++ b/module/zfs/zio.c
@@ -99,35 +99,6 @@ int zio_buf_debug_limit = 0;
static inline void __zio_execute(zio_t *zio);
-static int
-zio_cons(void *arg, void *unused, int kmflag)
-{
- zio_t *zio = arg;
-
- bzero(zio, sizeof (zio_t));
-
- mutex_init(&zio->io_lock, NULL, MUTEX_DEFAULT, NULL);
- cv_init(&zio->io_cv, NULL, CV_DEFAULT, NULL);
-
- list_create(&zio->io_parent_list, sizeof (zio_link_t),
- offsetof(zio_link_t, zl_parent_node));
- list_create(&zio->io_child_list, sizeof (zio_link_t),
- offsetof(zio_link_t, zl_child_node));
-
- return (0);
-}
-
-static void
-zio_dest(void *arg, void *unused)
-{
- zio_t *zio = arg;
-
- mutex_destroy(&zio->io_lock);
- cv_destroy(&zio->io_cv);
- list_destroy(&zio->io_parent_list);
- list_destroy(&zio->io_child_list);
-}
-
void
zio_init(void)
{
@@ -137,8 +108,8 @@ zio_init(void)
#ifdef _KERNEL
data_alloc_arena = zio_alloc_arena;
#endif
- zio_cache = kmem_cache_create("zio_cache", sizeof (zio_t), 0,
- zio_cons, zio_dest, NULL, NULL, NULL, KMC_KMEM);
+ zio_cache = kmem_cache_create("zio_cache",
+ sizeof (zio_t), 0, NULL, NULL, NULL, NULL, NULL, KMC_KMEM);
zio_link_cache = kmem_cache_create("zio_link_cache",
sizeof (zio_link_t), 0, NULL, NULL, NULL, NULL, NULL, KMC_KMEM);
@@ -540,6 +511,15 @@ zio_create(zio_t *pio, spa_t *spa, uint64_t txg, const blkptr_t *bp,
ASSERT(vd || stage == ZIO_STAGE_OPEN);
zio = kmem_cache_alloc(zio_cache, KM_PUSHPAGE);
+ bzero(zio, sizeof (zio_t));
+
+ mutex_init(&zio->io_lock, NULL, MUTEX_DEFAULT, NULL);
+ cv_init(&zio->io_cv, NULL, CV_DEFAULT, NULL);
+
+ list_create(&zio->io_parent_list, sizeof (zio_link_t),
+ offsetof(zio_link_t, zl_parent_node));
+ list_create(&zio->io_child_list, sizeof (zio_link_t),
+ offsetof(zio_link_t, zl_child_node));
if (vd != NULL)
zio->io_child_type = ZIO_CHILD_VDEV;
@@ -561,52 +541,21 @@ zio_create(zio_t *pio, spa_t *spa, uint64_t txg, const blkptr_t *bp,
zio->io_logical = zio;
if (zio->io_child_type > ZIO_CHILD_GANG && BP_IS_GANG(bp))
pipeline |= ZIO_GANG_STAGES;
- } else {
- zio->io_logical = NULL;
- zio->io_bp = NULL;
- bzero(&zio->io_bp_copy, sizeof (blkptr_t));
- bzero(&zio->io_bp_orig, sizeof (blkptr_t));
}
zio->io_spa = spa;
zio->io_txg = txg;
- zio->io_ready = NULL;
zio->io_done = done;
zio->io_private = private;
- zio->io_prev_space_delta = 0;
zio->io_type = type;
zio->io_priority = priority;
zio->io_vd = vd;
- zio->io_vsd = NULL;
- zio->io_vsd_ops = NULL;
zio->io_offset = offset;
- zio->io_deadline = 0;
zio->io_orig_data = zio->io_data = data;
zio->io_orig_size = zio->io_size = size;
zio->io_orig_flags = zio->io_flags = flags;
zio->io_orig_stage = zio->io_stage = stage;
zio->io_orig_pipeline = zio->io_pipeline = pipeline;
- bzero(&zio->io_prop, sizeof (zio_prop_t));
- zio->io_cmd = 0;
- zio->io_reexecute = 0;
- zio->io_bp_override = NULL;
- zio->io_walk_link = NULL;
- zio->io_transform_stack = NULL;
- zio->io_delay = 0;
- zio->io_error = 0;
- zio->io_child_count = 0;
- zio->io_parent_count = 0;
- zio->io_stall = NULL;
- zio->io_gang_leader = NULL;
- zio->io_gang_tree = NULL;
- zio->io_executor = NULL;
- zio->io_waiter = NULL;
- zio->io_cksum_report = NULL;
- zio->io_ena = 0;
- bzero(zio->io_child_error, sizeof (int) * ZIO_CHILD_TYPES);
- bzero(zio->io_children,
- sizeof (uint64_t) * ZIO_CHILD_TYPES * ZIO_WAIT_TYPES);
- bzero(&zio->io_bookmark, sizeof (zbookmark_t));
zio->io_state[ZIO_WAIT_READY] = (stage >= ZIO_STAGE_READY);
zio->io_state[ZIO_WAIT_DONE] = (stage >= ZIO_STAGE_DONE);
@@ -630,6 +579,10 @@ zio_create(zio_t *pio, spa_t *spa, uint64_t txg, const blkptr_t *bp,
static void
zio_destroy(zio_t *zio)
{
+ list_destroy(&zio->io_parent_list);
+ list_destroy(&zio->io_child_list);
+ mutex_destroy(&zio->io_lock);
+ cv_destroy(&zio->io_cv);
kmem_cache_free(zio_cache, zio);
}