Re-apply onnv-gate revisions 7994 and 8986 (corresponds to FreeBSD

revision 200726 and 200727).  It looks like that the two revisions
were not applied in the right sequence, I found this when comparing
with the OpenSolaris code.

MFC after:	3 days
Reviewed by:	mm@
This commit is contained in:
Xin LI 2010-01-07 20:10:22 +00:00
parent 789ad2d46a
commit 017b01f662

View File

@ -847,6 +847,12 @@ restore_object(struct restorearg *ra, objset_t *os, struct drr_object *drro)
if (err != 0 && err != ENOENT)
return (EINVAL);
if (drro->drr_bonuslen) {
data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8));
if (ra->err)
return (ra->err);
}
if (err == ENOENT) {
/* currently free, want to be allocated */
tx = dmu_tx_create(os);
@ -862,7 +868,6 @@ restore_object(struct restorearg *ra, objset_t *os, struct drr_object *drro)
dmu_tx_commit(tx);
} else {
/* currently allocated, want to be allocated */
err = dmu_object_reclaim(os, drro->drr_object,
drro->drr_type, drro->drr_blksz,
drro->drr_bonustype, drro->drr_bonuslen);
@ -870,12 +875,6 @@ restore_object(struct restorearg *ra, objset_t *os, struct drr_object *drro)
if (err)
return (EINVAL);
if (drro->drr_bonuslen) {
data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8));
if (ra->err)
return (ra->err);
}
tx = dmu_tx_create(os);
dmu_tx_hold_bonus(tx, drro->drr_object);
err = dmu_tx_assign(tx, TXG_WAIT);