Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Dagnelie <[email protected]>
  • Loading branch information
Paul Dagnelie committed Jan 30, 2025
1 parent 6ae9b68 commit e7a07af
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions module/zfs/zio.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,21 @@ static const int zio_buf_debug_limit = 0;

typedef struct zio_stats {
kstat_named_t ziostat_total_allocations;
kstat_named_t ziostat_normal_fallbacks;
kstat_named_t ziostat_alloc_class_fallbacks;
kstat_named_t ziostat_gang_writes;
kstat_named_t ziostat_gang_multilevel;
} zio_stats_t;

static zio_stats_t zio_stats = {
{ "total_allocations", KSTAT_DATA_UINT64 },
{ "normal_fallbacks", KSTAT_DATA_UINT64 },
{ "alloc_class_fallbacks", KSTAT_DATA_UINT64 },
{ "gang_writes", KSTAT_DATA_UINT64 },
{ "gang_multilevel", KSTAT_DATA_UINT64 },
};

struct {
wmsum_t ziostat_total_allocations;
wmsum_t ziostat_normal_fallbacks;
wmsum_t ziostat_alloc_class_fallbacks;
wmsum_t ziostat_gang_writes;
wmsum_t ziostat_gang_multilevel;
} ziostat_sums;
Expand All @@ -183,13 +183,13 @@ zio_kstats_update(kstat_t *ksp, int rw)

zs->ziostat_total_allocations.value.ui64 =
wmsum_value(&ziostat_sums.ziostat_total_allocations);
zs->ziostat_normal_fallbacks.value.ui64 =
wmsum_value(&ziostat_sums.ziostat_normal_fallbacks);
zs->ziostat_alloc_class_fallbacks.value.ui64 =
wmsum_value(&ziostat_sums.ziostat_alloc_class_fallbacks);
zs->ziostat_gang_writes.value.ui64 =
wmsum_value(&ziostat_sums.ziostat_gang_writes);
zs->ziostat_gang_multilevel.value.ui64 =
wmsum_value(&ziostat_sums.ziostat_gang_multilevel);
return (0);
return (0);
}

void
Expand All @@ -203,7 +203,7 @@ zio_init(void)
sizeof (zio_link_t), 0, NULL, NULL, NULL, NULL, NULL, 0);

wmsum_init(&ziostat_sums.ziostat_total_allocations, 0);
wmsum_init(&ziostat_sums.ziostat_normal_fallbacks, 0);
wmsum_init(&ziostat_sums.ziostat_alloc_class_fallbacks, 0);
wmsum_init(&ziostat_sums.ziostat_gang_writes, 0);
wmsum_init(&ziostat_sums.ziostat_gang_multilevel, 0);
zio_ksp = kstat_create("zfs", 0, "zio_stats",
Expand Down Expand Up @@ -348,7 +348,7 @@ zio_fini(void)
}

wmsum_fini(&ziostat_sums.ziostat_total_allocations);
wmsum_fini(&ziostat_sums.ziostat_normal_fallbacks);
wmsum_fini(&ziostat_sums.ziostat_alloc_class_fallbacks);
wmsum_fini(&ziostat_sums.ziostat_gang_writes);
wmsum_fini(&ziostat_sums.ziostat_gang_multilevel);

Expand Down Expand Up @@ -4169,7 +4169,7 @@ zio_dva_allocate(zio_t *zio)
error);
}

ZIOSTAT_BUMP(ziostat_normal_fallbacks);
ZIOSTAT_BUMP(ziostat_alloc_class_fallbacks);
error = metaslab_alloc(spa, mc, zio->io_size, bp,
zio->io_prop.zp_copies, zio->io_txg, NULL, flags,
&zio->io_alloc_list, zio, zio->io_allocator);
Expand Down Expand Up @@ -4276,6 +4276,7 @@ zio_alloc_zil(spa_t *spa, objset_t *os, uint64_t txg, blkptr_t *new_bp,
int flags = METASLAB_ZIL;
int allocator = (uint_t)cityhash1(os->os_dsl_dataset->ds_object)
% spa->spa_alloc_count;
ZIOSTAT_BUMP(ziostat_total_allocations);
error = metaslab_alloc(spa, spa_log_class(spa), size, new_bp, 1,
txg, NULL, flags, &io_alloc_list, NULL, allocator);
*slog = (error == 0);
Expand All @@ -4285,6 +4286,7 @@ zio_alloc_zil(spa_t *spa, objset_t *os, uint64_t txg, blkptr_t *new_bp,
&io_alloc_list, NULL, allocator);
}
if (error != 0) {
ZIOSTAT_BUMP(ziostat_alloc_class_fallbacks);
error = metaslab_alloc(spa, spa_normal_class(spa), size,
new_bp, 1, txg, NULL, flags,
&io_alloc_list, NULL, allocator);
Expand Down

0 comments on commit e7a07af

Please sign in to comment.