Deleted Added
full compact
dmu_send.c (200727) dmu_send.c (201756)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 833 unchanged lines hidden (view full) ---

842 return (EINVAL);
843 }
844
845 err = dmu_object_info(os, drro->drr_object, NULL);
846
847 if (err != 0 && err != ENOENT)
848 return (EINVAL);
849
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 833 unchanged lines hidden (view full) ---

842 return (EINVAL);
843 }
844
845 err = dmu_object_info(os, drro->drr_object, NULL);
846
847 if (err != 0 && err != ENOENT)
848 return (EINVAL);
849
850 if (drro->drr_bonuslen) {
851 data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8));
852 if (ra->err)
853 return (ra->err);
854 }
855
850 if (err == ENOENT) {
851 /* currently free, want to be allocated */
852 tx = dmu_tx_create(os);
853 dmu_tx_hold_bonus(tx, DMU_NEW_OBJECT);
854 err = dmu_tx_assign(tx, TXG_WAIT);
855 if (err) {
856 dmu_tx_abort(tx);
857 return (err);
858 }
859 err = dmu_object_claim(os, drro->drr_object,
860 drro->drr_type, drro->drr_blksz,
861 drro->drr_bonustype, drro->drr_bonuslen, tx);
862 dmu_tx_commit(tx);
863 } else {
864 /* currently allocated, want to be allocated */
856 if (err == ENOENT) {
857 /* currently free, want to be allocated */
858 tx = dmu_tx_create(os);
859 dmu_tx_hold_bonus(tx, DMU_NEW_OBJECT);
860 err = dmu_tx_assign(tx, TXG_WAIT);
861 if (err) {
862 dmu_tx_abort(tx);
863 return (err);
864 }
865 err = dmu_object_claim(os, drro->drr_object,
866 drro->drr_type, drro->drr_blksz,
867 drro->drr_bonustype, drro->drr_bonuslen, tx);
868 dmu_tx_commit(tx);
869 } else {
870 /* currently allocated, want to be allocated */
865
866 err = dmu_object_reclaim(os, drro->drr_object,
867 drro->drr_type, drro->drr_blksz,
868 drro->drr_bonustype, drro->drr_bonuslen);
869 }
870 if (err)
871 return (EINVAL);
872
871 err = dmu_object_reclaim(os, drro->drr_object,
872 drro->drr_type, drro->drr_blksz,
873 drro->drr_bonustype, drro->drr_bonuslen);
874 }
875 if (err)
876 return (EINVAL);
877
873 if (drro->drr_bonuslen) {
874 data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8));
875 if (ra->err)
876 return (ra->err);
877 }
878
879 tx = dmu_tx_create(os);
880 dmu_tx_hold_bonus(tx, drro->drr_object);
881 err = dmu_tx_assign(tx, TXG_WAIT);
882 if (err) {
883 dmu_tx_abort(tx);
884 return (err);
885 }
886

--- 346 unchanged lines hidden ---
878 tx = dmu_tx_create(os);
879 dmu_tx_hold_bonus(tx, drro->drr_object);
880 err = dmu_tx_assign(tx, TXG_WAIT);
881 if (err) {
882 dmu_tx_abort(tx);
883 return (err);
884 }
885

--- 346 unchanged lines hidden ---