diff options
Diffstat (limited to 'sys/contrib/opensolaris/uts/common/fs/zfs/zio.c')
-rw-r--r-- | sys/contrib/opensolaris/uts/common/fs/zfs/zio.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/contrib/opensolaris/uts/common/fs/zfs/zio.c b/sys/contrib/opensolaris/uts/common/fs/zfs/zio.c index 6bc4a36..99c0dd3 100644 --- a/sys/contrib/opensolaris/uts/common/fs/zfs/zio.c +++ b/sys/contrib/opensolaris/uts/common/fs/zfs/zio.c @@ -79,12 +79,13 @@ zio_sync_pass_t zio_sync_pass = { 1, /* zp_rewrite */ }; -#ifdef ZIO_USE_UMA /* * ========================================================================== * I/O kmem caches * ========================================================================== */ +kmem_cache_t *zio_cache; +#ifdef ZIO_USE_UMA kmem_cache_t *zio_buf_cache[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT]; kmem_cache_t *zio_data_buf_cache[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT]; #endif @@ -107,6 +108,9 @@ zio_init(void) #endif #endif + zio_cache = kmem_cache_create("zio_cache", sizeof (zio_t), 0, + NULL, NULL, NULL, NULL, NULL, 0); + #ifdef ZIO_USE_UMA /* * For small buffers, we want a cache for each multiple of @@ -183,6 +187,8 @@ zio_fini(void) } #endif + kmem_cache_destroy(zio_cache); + zio_inject_fini(); } @@ -329,7 +335,8 @@ zio_create(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, ASSERT3U(size, <=, SPA_MAXBLOCKSIZE); ASSERT(P2PHASE(size, SPA_MINBLOCKSIZE) == 0); - zio = kmem_zalloc(sizeof (zio_t), KM_SLEEP); + zio = kmem_cache_alloc(zio_cache, KM_SLEEP); + bzero(zio, sizeof (zio_t)); zio->io_parent = pio; zio->io_spa = spa; zio->io_txg = txg; @@ -777,7 +784,7 @@ zio_wait(zio_t *zio) error = zio->io_error; cv_destroy(&zio->io_cv); mutex_destroy(&zio->io_lock); - kmem_free(zio, sizeof (zio_t)); + kmem_cache_free(zio_cache, zio); return (error); } @@ -957,9 +964,8 @@ zio_done(zio_t *zio) } /* - * Note: this I/O is now done, and will shortly be - * kmem_free()'d, so there is no need to clear this (or any - * other) flag. + * Note: this I/O is now done, and will shortly be freed, so there is no + * need to clear this (or any other) flag. */ if (zio->io_flags & ZIO_FLAG_CONFIG_GRABBED) spa_config_exit(spa, zio); @@ -971,7 +977,7 @@ zio_done(zio_t *zio) cv_broadcast(&zio->io_cv); mutex_exit(&zio->io_lock); } else { - kmem_free(zio, sizeof (zio_t)); + kmem_cache_free(zio_cache, zio); } } |