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

Function arc_read_done

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

Source from the content-addressed store, hash-verified

5656}
5657
5658static void
5659arc_read_done(zio_t *zio)
5660{
5661 blkptr_t *bp = zio->io_bp;
5662 arc_buf_hdr_t *hdr = zio->io_private;
5663 kmutex_t *hash_lock = NULL;
5664 arc_callback_t *callback_list;
5665 arc_callback_t *acb;
5666 boolean_t freeable = B_FALSE;
5667
5668 /*
5669 * The hdr was inserted into hash-table and removed from lists
5670 * prior to starting I/O. We should find this header, since
5671 * it's in the hash table, and it should be legit since it's
5672 * not possible to evict it during the I/O. The only possible
5673 * reason for it not to be found is if we were freed during the
5674 * read.
5675 */
5676 if (HDR_IN_HASH_TABLE(hdr)) {
5677 arc_buf_hdr_t *found;
5678
5679 ASSERT3U(hdr->b_birth, ==, BP_PHYSICAL_BIRTH(zio->io_bp));
5680 ASSERT3U(hdr->b_dva.dva_word[0], ==,
5681 BP_IDENTITY(zio->io_bp)->dva_word[0]);
5682 ASSERT3U(hdr->b_dva.dva_word[1], ==,
5683 BP_IDENTITY(zio->io_bp)->dva_word[1]);
5684
5685 found = buf_hash_find(hdr->b_spa, zio->io_bp, &hash_lock);
5686
5687 ASSERT((found == hdr &&
5688 DVA_EQUAL(&hdr->b_dva, BP_IDENTITY(zio->io_bp))) ||
5689 (found == hdr && HDR_L2_READING(hdr)));
5690 ASSERT3P(hash_lock, !=, NULL);
5691 }
5692
5693 if (BP_IS_PROTECTED(bp)) {
5694 hdr->b_crypt_hdr.b_ot = BP_GET_TYPE(bp);
5695 hdr->b_crypt_hdr.b_dsobj = zio->io_bookmark.zb_objset;
5696 zio_crypt_decode_params_bp(bp, hdr->b_crypt_hdr.b_salt,
5697 hdr->b_crypt_hdr.b_iv);
5698
5699 if (BP_GET_TYPE(bp) == DMU_OT_INTENT_LOG) {
5700 void *tmpbuf;
5701
5702 tmpbuf = abd_borrow_buf_copy(zio->io_abd,
5703 sizeof (zil_chain_t));
5704 zio_crypt_decode_mac_zil(tmpbuf,
5705 hdr->b_crypt_hdr.b_mac);
5706 abd_return_buf(zio->io_abd, tmpbuf,
5707 sizeof (zil_chain_t));
5708 } else {
5709 zio_crypt_decode_mac_bp(bp, hdr->b_crypt_hdr.b_mac);
5710 }
5711 }
5712
5713 if (zio->io_error == 0) {
5714 /* byteswap if necessary */
5715 if (BP_SHOULD_BYTESWAP(zio->io_bp)) {

Callers 1

l2arc_read_doneFunction · 0.85

Calls 15

buf_hash_findFunction · 0.85
abd_borrow_buf_copyFunction · 0.85
abd_return_bufFunction · 0.85
arc_hdr_clear_flagsFunction · 0.85
arc_accessFunction · 0.85
arc_buf_alloc_implFunction · 0.85
spa_log_errorFunction · 0.85
zfs_ereport_postFunction · 0.85
zfs_refcount_is_zeroFunction · 0.85
arc_hdr_verifyFunction · 0.85
arc_hdr_set_flagsFunction · 0.85
arc_change_stateFunction · 0.85

Tested by

no test coverage detected