MCPcopy Create free account
hub / github.com/F-Stack/f-stack / l2arc_dev_hdr_update

Function l2arc_dev_hdr_update

freebsd/contrib/openzfs/module/zfs/arc.c:10352–10390  ·  view source on GitHub ↗

* Creates a zio to update the device header on an l2arc device. */

Source from the content-addressed store, hash-verified

10350 * Creates a zio to update the device header on an l2arc device.
10351 */
10352void
10353l2arc_dev_hdr_update(l2arc_dev_t *dev)
10354{
10355 l2arc_dev_hdr_phys_t *l2dhdr = dev->l2ad_dev_hdr;
10356 const uint64_t l2dhdr_asize = dev->l2ad_dev_hdr_asize;
10357 abd_t *abd;
10358 int err;
10359
10360 VERIFY(spa_config_held(dev->l2ad_spa, SCL_STATE_ALL, RW_READER));
10361
10362 l2dhdr->dh_magic = L2ARC_DEV_HDR_MAGIC;
10363 l2dhdr->dh_version = L2ARC_PERSISTENT_VERSION;
10364 l2dhdr->dh_spa_guid = spa_guid(dev->l2ad_vdev->vdev_spa);
10365 l2dhdr->dh_vdev_guid = dev->l2ad_vdev->vdev_guid;
10366 l2dhdr->dh_log_entries = dev->l2ad_log_entries;
10367 l2dhdr->dh_evict = dev->l2ad_evict;
10368 l2dhdr->dh_start = dev->l2ad_start;
10369 l2dhdr->dh_end = dev->l2ad_end;
10370 l2dhdr->dh_lb_asize = zfs_refcount_count(&dev->l2ad_lb_asize);
10371 l2dhdr->dh_lb_count = zfs_refcount_count(&dev->l2ad_lb_count);
10372 l2dhdr->dh_flags = 0;
10373 l2dhdr->dh_trim_action_time = dev->l2ad_vdev->vdev_trim_action_time;
10374 l2dhdr->dh_trim_state = dev->l2ad_vdev->vdev_trim_state;
10375 if (dev->l2ad_first)
10376 l2dhdr->dh_flags |= L2ARC_DEV_HDR_EVICT_FIRST;
10377
10378 abd = abd_get_from_buf(l2dhdr, l2dhdr_asize);
10379
10380 err = zio_wait(zio_write_phys(NULL, dev->l2ad_vdev,
10381 VDEV_LABEL_START_SIZE, l2dhdr_asize, abd, ZIO_CHECKSUM_LABEL, NULL,
10382 NULL, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_CANFAIL, B_FALSE));
10383
10384 abd_put(abd);
10385
10386 if (err != 0) {
10387 zfs_dbgmsg("L2ARC IO error (%d) while writing device header, "
10388 "vdev guid: %llu", err, dev->l2ad_vdev->vdev_guid);
10389 }
10390}
10391
10392/*
10393 * Commits a log block to the L2ARC device. This routine is invoked from

Callers 4

vdev_trim_l2arc_threadFunction · 0.85
l2arc_write_buffersFunction · 0.85
l2arc_rebuild_vdevFunction · 0.85
l2arc_rebuildFunction · 0.85

Calls 8

spa_config_heldFunction · 0.85
spa_guidFunction · 0.85
zfs_refcount_countFunction · 0.85
abd_get_from_bufFunction · 0.85
zio_waitFunction · 0.85
zio_write_physFunction · 0.85
abd_putFunction · 0.85
zfs_dbgmsgClass · 0.50

Tested by

no test coverage detected