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

Function arc_write_ready

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

Source from the content-addressed store, hash-verified

6787#endif
6788
6789static void
6790arc_write_ready(zio_t *zio)
6791{
6792 arc_write_callback_t *callback = zio->io_private;
6793 arc_buf_t *buf = callback->awcb_buf;
6794 arc_buf_hdr_t *hdr = buf->b_hdr;
6795 blkptr_t *bp = zio->io_bp;
6796 uint64_t psize = BP_IS_HOLE(bp) ? 0 : BP_GET_PSIZE(bp);
6797 fstrans_cookie_t cookie = spl_fstrans_mark();
6798
6799 ASSERT(HDR_HAS_L1HDR(hdr));
6800 ASSERT(!zfs_refcount_is_zero(&buf->b_hdr->b_l1hdr.b_refcnt));
6801 ASSERT(hdr->b_l1hdr.b_bufcnt > 0);
6802
6803 /*
6804 * If we're reexecuting this zio because the pool suspended, then
6805 * cleanup any state that was previously set the first time the
6806 * callback was invoked.
6807 */
6808 if (zio->io_flags & ZIO_FLAG_REEXECUTED) {
6809 arc_cksum_free(hdr);
6810 arc_buf_unwatch(buf);
6811 if (hdr->b_l1hdr.b_pabd != NULL) {
6812 if (arc_buf_is_shared(buf)) {
6813 arc_unshare_buf(hdr, buf);
6814 } else {
6815 arc_hdr_free_abd(hdr, B_FALSE);
6816 }
6817 }
6818
6819 if (HDR_HAS_RABD(hdr))
6820 arc_hdr_free_abd(hdr, B_TRUE);
6821 }
6822 ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL);
6823 ASSERT(!HDR_HAS_RABD(hdr));
6824 ASSERT(!HDR_SHARED_DATA(hdr));
6825 ASSERT(!arc_buf_is_shared(buf));
6826
6827 callback->awcb_ready(zio, buf, callback->awcb_private);
6828
6829 if (HDR_IO_IN_PROGRESS(hdr))
6830 ASSERT(zio->io_flags & ZIO_FLAG_REEXECUTED);
6831
6832 arc_hdr_set_flags(hdr, ARC_FLAG_IO_IN_PROGRESS);
6833
6834 if (BP_IS_PROTECTED(bp) != !!HDR_PROTECTED(hdr))
6835 hdr = arc_hdr_realloc_crypt(hdr, BP_IS_PROTECTED(bp));
6836
6837 if (BP_IS_PROTECTED(bp)) {
6838 /* ZIL blocks are written through zio_rewrite */
6839 ASSERT3U(BP_GET_TYPE(bp), !=, DMU_OT_INTENT_LOG);
6840 ASSERT(HDR_PROTECTED(hdr));
6841
6842 if (BP_SHOULD_BYTESWAP(bp)) {
6843 if (BP_GET_LEVEL(bp) > 0) {
6844 hdr->b_l1hdr.b_byteswap = DMU_BSWAP_UINT64;
6845 } else {
6846 hdr->b_l1hdr.b_byteswap =

Callers

nothing calls this directly

Calls 15

zfs_refcount_is_zeroFunction · 0.85
arc_cksum_freeFunction · 0.85
arc_buf_unwatchFunction · 0.85
arc_buf_is_sharedFunction · 0.85
arc_unshare_bufFunction · 0.85
arc_hdr_free_abdFunction · 0.85
arc_hdr_set_flagsFunction · 0.85
arc_hdr_realloc_cryptFunction · 0.85
arc_cksum_computeFunction · 0.85
arc_hdr_set_compressFunction · 0.85
arc_hdr_alloc_abdFunction · 0.85
abd_copyFunction · 0.85

Tested by

no test coverage detected