Skip to content

Commit b22d109

Browse files
committed
zio: introduce zio_bp_cache
Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <[email protected]>
1 parent a9410cc commit b22d109

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

module/zfs/zio.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ static int zio_deadman_log_all = B_FALSE;
7878
*/
7979
static kmem_cache_t *zio_cache;
8080
static kmem_cache_t *zio_link_cache;
81+
static kmem_cache_t *zio_bp_cache;
8182
kmem_cache_t *zio_buf_cache[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT];
8283
kmem_cache_t *zio_data_buf_cache[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT];
8384
#if defined(ZFS_DEBUG) && !defined(_KERNEL)
@@ -202,6 +203,8 @@ zio_init(void)
202203
sizeof (zio_t), 0, NULL, NULL, NULL, NULL, NULL, 0);
203204
zio_link_cache = kmem_cache_create("zio_link_cache",
204205
sizeof (zio_link_t), 0, NULL, NULL, NULL, NULL, NULL, 0);
206+
zio_bp_cache = kmem_cache_create("zio_bp_cache",
207+
sizeof (blkptr_t), 0, NULL, NULL, NULL, NULL, NULL, 0);
205208

206209
wmsum_init(&ziostat_sums.ziostat_total_allocations, 0);
207210
wmsum_init(&ziostat_sums.ziostat_alloc_class_fallbacks, 0);
@@ -353,6 +356,7 @@ zio_fini(void)
353356
wmsum_fini(&ziostat_sums.ziostat_gang_writes);
354357
wmsum_fini(&ziostat_sums.ziostat_gang_multilevel);
355358

359+
kmem_cache_destroy(zio_bp_cache);
356360
kmem_cache_destroy(zio_link_cache);
357361
kmem_cache_destroy(zio_cache);
358362

@@ -939,6 +943,14 @@ zio_bookmark_compare(const void *x1, const void *x2)
939943
return (0);
940944
}
941945

946+
static inline blkptr_t *
947+
zio_dup_bp(const blkptr_t *bp)
948+
{
949+
blkptr_t *nbp = kmem_cache_alloc(zio_bp_cache, KM_SLEEP);
950+
*nbp = *bp;
951+
return (nbp);
952+
}
953+
942954
/*
943955
* ==========================================================================
944956
* Create the various types of I/O (read, write, free, etc)

0 commit comments

Comments
 (0)