Merge commit 'refs/top-bases/linux-zpios' into linux-zpios

This commit is contained in:
Brian Behlendorf 2008-12-18 13:44:51 -08:00
commit 2f10910f57
1 changed files with 23 additions and 16 deletions

View File

@ -956,6 +956,28 @@ dmu_recv_abort_cleanup(dmu_recv_cookie_t *drc)
} }
} }
/*
* Compute checksum of drr_begin record
*/
static void
dmu_recv_stream_cksum(struct restorearg *ra)
{
dmu_replay_record_t *drr;
drr = kmem_zalloc(sizeof (dmu_replay_record_t), KM_SLEEP);
drr->drr_type = DRR_BEGIN;
drr->drr_u.drr_begin = *drc->drc_drrb;
if (ra->byteswap) {
fletcher_4_incremental_byteswap(drr,
sizeof (dmu_replay_record_t), &(ra->cksum));
} else {
fletcher_4_incremental_native(drr,
sizeof (dmu_replay_record_t), &(ra->cksum));
}
kmem_free(drr, sizeof (dmu_replay_record_t));
}
/* /*
* NB: callers *must* call dmu_recv_end() if this succeeds. * NB: callers *must* call dmu_recv_end() if this succeeds.
*/ */
@ -970,22 +992,7 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, vnode_t *vp, offset_t *voffp)
if (drc->drc_drrb->drr_magic == BSWAP_64(DMU_BACKUP_MAGIC)) if (drc->drc_drrb->drr_magic == BSWAP_64(DMU_BACKUP_MAGIC))
ra.byteswap = TRUE; ra.byteswap = TRUE;
{ dmu_recv_stream_cksum(&ra);
/* compute checksum of drr_begin record */
dmu_replay_record_t *drr;
drr = kmem_zalloc(sizeof (dmu_replay_record_t), KM_SLEEP);
drr->drr_type = DRR_BEGIN;
drr->drr_u.drr_begin = *drc->drc_drrb;
if (ra.byteswap) {
fletcher_4_incremental_byteswap(drr,
sizeof (dmu_replay_record_t), &ra.cksum);
} else {
fletcher_4_incremental_native(drr,
sizeof (dmu_replay_record_t), &ra.cksum);
}
kmem_free(drr, sizeof (dmu_replay_record_t));
}
if (ra.byteswap) { if (ra.byteswap) {
struct drr_begin *drrb = drc->drc_drrb; struct drr_begin *drrb = drc->drc_drrb;