60 ASSERT3U(len % 8, ==, 0); 61 62 fletcher_4_incremental_native(buf, len, &dsp->dsa_zc); 63 dsp->dsa_err = vn_rdwr(UIO_WRITE, dsp->dsa_vp, 64 (caddr_t)buf, len, 65 0, UIO_SYSSPACE, FAPPEND, RLIM64_INFINITY, CRED(), &resid); 66 67 mutex_enter(&ds->ds_sendstream_lock); 68 *dsp->dsa_off += len; 69 mutex_exit(&ds->ds_sendstream_lock); 70 71 return (dsp->dsa_err); 72 } 73 74 static int 75 dump_free(dmu_sendarg_t *dsp, uint64_t object, uint64_t offset, 76 uint64_t length) 77 { 78 struct drr_free *drrf = &(dsp->dsa_drr->drr_u.drr_free); 79 80 /* 81 * If there is a pending op, but it's not PENDING_FREE, push it out, 82 * since free block aggregation can only be done for blocks of the 83 * same type (i.e., DRR_FREE records can only be aggregated with 84 * other DRR_FREE records. DRR_FREEOBJECTS records can only be 85 * aggregated with other DRR_FREEOBJECTS records. 86 */ 87 if (dsp->dsa_pending_op != PENDING_NONE && 88 dsp->dsa_pending_op != PENDING_FREE) { 89 if (dump_bytes(dsp, dsp->dsa_drr, 90 sizeof (dmu_replay_record_t)) != 0) 91 return (EINTR); 92 dsp->dsa_pending_op = PENDING_NONE; 93 } 94 95 if (dsp->dsa_pending_op == PENDING_FREE) { 96 /* 97 * There should never be a PENDING_FREE if length is -1 98 * (because dump_dnode is the only place where this 99 * function is called with a -1, and only after flushing | 60 ASSERT3U(len % 8, ==, 0); 61 62 fletcher_4_incremental_native(buf, len, &dsp->dsa_zc); 63 dsp->dsa_err = vn_rdwr(UIO_WRITE, dsp->dsa_vp, 64 (caddr_t)buf, len, 65 0, UIO_SYSSPACE, FAPPEND, RLIM64_INFINITY, CRED(), &resid); 66 67 mutex_enter(&ds->ds_sendstream_lock); 68 *dsp->dsa_off += len; 69 mutex_exit(&ds->ds_sendstream_lock); 70 71 return (dsp->dsa_err); 72 } 73 74 static int 75 dump_free(dmu_sendarg_t *dsp, uint64_t object, uint64_t offset, 76 uint64_t length) 77 { 78 struct drr_free *drrf = &(dsp->dsa_drr->drr_u.drr_free); 79 80 if (length != -1ULL && offset + length < offset) 81 length = -1ULL; 82 83 /* 84 * If there is a pending op, but it's not PENDING_FREE, push it out, 85 * since free block aggregation can only be done for blocks of the 86 * same type (i.e., DRR_FREE records can only be aggregated with 87 * other DRR_FREE records. DRR_FREEOBJECTS records can only be 88 * aggregated with other DRR_FREEOBJECTS records. 89 */ 90 if (dsp->dsa_pending_op != PENDING_NONE && 91 dsp->dsa_pending_op != PENDING_FREE) { 92 if (dump_bytes(dsp, dsp->dsa_drr, 93 sizeof (dmu_replay_record_t)) != 0) 94 return (EINTR); 95 dsp->dsa_pending_op = PENDING_NONE; 96 } 97 98 if (dsp->dsa_pending_op == PENDING_FREE) { 99 /* 100 * There should never be a PENDING_FREE if length is -1 101 * (because dump_dnode is the only place where this 102 * function is called with a -1, and only after flushing |