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

Function arc_write

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

Source from the content-addressed store, hash-verified

7048}
7049
7050zio_t *
7051arc_write(zio_t *pio, spa_t *spa, uint64_t txg,
7052 blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc,
7053 const zio_prop_t *zp, arc_write_done_func_t *ready,
7054 arc_write_done_func_t *children_ready, arc_write_done_func_t *physdone,
7055 arc_write_done_func_t *done, void *private, zio_priority_t priority,
7056 int zio_flags, const zbookmark_phys_t *zb)
7057{
7058 arc_buf_hdr_t *hdr = buf->b_hdr;
7059 arc_write_callback_t *callback;
7060 zio_t *zio;
7061 zio_prop_t localprop = *zp;
7062
7063 ASSERT3P(ready, !=, NULL);
7064 ASSERT3P(done, !=, NULL);
7065 ASSERT(!HDR_IO_ERROR(hdr));
7066 ASSERT(!HDR_IO_IN_PROGRESS(hdr));
7067 ASSERT3P(hdr->b_l1hdr.b_acb, ==, NULL);
7068 ASSERT3U(hdr->b_l1hdr.b_bufcnt, >, 0);
7069 if (l2arc)
7070 arc_hdr_set_flags(hdr, ARC_FLAG_L2CACHE);
7071
7072 if (ARC_BUF_ENCRYPTED(buf)) {
7073 ASSERT(ARC_BUF_COMPRESSED(buf));
7074 localprop.zp_encrypt = B_TRUE;
7075 localprop.zp_compress = HDR_GET_COMPRESS(hdr);
7076 localprop.zp_complevel = hdr->b_complevel;
7077 localprop.zp_byteorder =
7078 (hdr->b_l1hdr.b_byteswap == DMU_BSWAP_NUMFUNCS) ?
7079 ZFS_HOST_BYTEORDER : !ZFS_HOST_BYTEORDER;
7080 bcopy(hdr->b_crypt_hdr.b_salt, localprop.zp_salt,
7081 ZIO_DATA_SALT_LEN);
7082 bcopy(hdr->b_crypt_hdr.b_iv, localprop.zp_iv,
7083 ZIO_DATA_IV_LEN);
7084 bcopy(hdr->b_crypt_hdr.b_mac, localprop.zp_mac,
7085 ZIO_DATA_MAC_LEN);
7086 if (DMU_OT_IS_ENCRYPTED(localprop.zp_type)) {
7087 localprop.zp_nopwrite = B_FALSE;
7088 localprop.zp_copies =
7089 MIN(localprop.zp_copies, SPA_DVAS_PER_BP - 1);
7090 }
7091 zio_flags |= ZIO_FLAG_RAW;
7092 } else if (ARC_BUF_COMPRESSED(buf)) {
7093 ASSERT3U(HDR_GET_LSIZE(hdr), !=, arc_buf_size(buf));
7094 localprop.zp_compress = HDR_GET_COMPRESS(hdr);
7095 localprop.zp_complevel = hdr->b_complevel;
7096 zio_flags |= ZIO_FLAG_RAW_COMPRESS;
7097 }
7098 callback = kmem_zalloc(sizeof (arc_write_callback_t), KM_SLEEP);
7099 callback->awcb_ready = ready;
7100 callback->awcb_children_ready = children_ready;
7101 callback->awcb_physdone = physdone;
7102 callback->awcb_done = done;
7103 callback->awcb_private = private;
7104 callback->awcb_buf = buf;
7105
7106 /*
7107 * The hdr's b_pabd is now stale, free it now. A new data block

Callers 3

dbuf_writeFunction · 0.85
dmu_objset_syncFunction · 0.85
dmu_syncFunction · 0.85

Calls 8

arc_hdr_set_flagsFunction · 0.85
arc_buf_sizeFunction · 0.85
arc_buf_is_sharedFunction · 0.85
arc_unshare_bufFunction · 0.85
arc_hdr_free_abdFunction · 0.85
arc_hdr_set_compressFunction · 0.85
zio_writeFunction · 0.85
abd_get_from_bufFunction · 0.85

Tested by

no test coverage detected