]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Report ashift of L2ARC devices in zdb
authorGeorge Amanakis <gamanakis@gmail.com>
Mon, 2 Oct 2023 23:57:09 +0000 (01:57 +0200)
committerGitHub <noreply@github.com>
Mon, 2 Oct 2023 23:57:09 +0000 (16:57 -0700)
Commit 8af1104f does not actually store the ashift of cache devices in
their label. However, in order to facilitate reporting the ashift
through zdb, we enable this in the present commit. We also document
how the retrieval of the ashift is done.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: George Amanakis <gamanakis@gmail.com>
Closes #15331

cmd/zdb/zdb.c
module/zfs/vdev_label.c

index 87499cdc95cb82d3fdbfbc186719f89a751e3879..b39a0e8825fb15c53ef2a4cf80e4e3bfe2769339 100644 (file)
@@ -5179,7 +5179,7 @@ dump_label(const char *dev)
                        if (nvlist_size(config, &size, NV_ENCODE_XDR) != 0)
                                size = buflen;
 
-                       /* If the device is a cache device clear the header. */
+                       /* If the device is a cache device read the header. */
                        if (!read_l2arc_header) {
                                if (nvlist_lookup_uint64(config,
                                    ZPOOL_CONFIG_POOL_STATE, &l2cache) == 0 &&
index a5c76808f2d2b433977cb4aa7f5f99de3ad4fecd..a2e5524a8391ec68910a7568bbb104eda8ed8b1f 100644 (file)
@@ -1138,6 +1138,16 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason)
                    POOL_STATE_L2CACHE) == 0);
                VERIFY(nvlist_add_uint64(label, ZPOOL_CONFIG_GUID,
                    vd->vdev_guid) == 0);
+
+               /*
+                * This is merely to facilitate reporting the ashift of the
+                * cache device through zdb. The actual retrieval of the
+                * ashift (in vdev_alloc()) uses the nvlist
+                * spa->spa_l2cache->sav_config (populated in
+                * spa_ld_open_aux_vdevs()).
+                */
+               VERIFY(nvlist_add_uint64(label, ZPOOL_CONFIG_ASHIFT,
+                   vd->vdev_ashift) == 0);
        } else {
                uint64_t txg = 0ULL;