dmu_send.c (235222) | dmu_send.c (236884) |
---|---|
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 --- 6 unchanged lines hidden (view full) --- 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. | 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 --- 6 unchanged lines hidden (view full) --- 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
23 * Copyright (c) 2011 by Delphix. All rights reserved. 24 */ 25/* | |
26 * Copyright 2011 Nexenta Systems, Inc. All rights reserved. | 23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved. |
27 * Copyright (c) 2011 by Delphix. All rights reserved. | 24 * Copyright (c) 2012 by Delphix. All rights reserved. |
28 * Copyright (c) 2012, Joyent, Inc. All rights reserved. 29 * Copyright (c) 2012, Martin Matuska <mm@FreeBSD.org>. All rights reserved. 30 */ 31 32#include <sys/dmu.h> 33#include <sys/dmu_impl.h> 34#include <sys/dmu_tx.h> 35#include <sys/dbuf.h> --- 1076 unchanged lines hidden (view full) --- 1112static int 1113restore_object(struct restorearg *ra, objset_t *os, struct drr_object *drro) 1114{ 1115 int err; 1116 dmu_tx_t *tx; 1117 void *data = NULL; 1118 1119 if (drro->drr_type == DMU_OT_NONE || | 25 * Copyright (c) 2012, Joyent, Inc. All rights reserved. 26 * Copyright (c) 2012, Martin Matuska <mm@FreeBSD.org>. All rights reserved. 27 */ 28 29#include <sys/dmu.h> 30#include <sys/dmu_impl.h> 31#include <sys/dmu_tx.h> 32#include <sys/dbuf.h> --- 1076 unchanged lines hidden (view full) --- 1109static int 1110restore_object(struct restorearg *ra, objset_t *os, struct drr_object *drro) 1111{ 1112 int err; 1113 dmu_tx_t *tx; 1114 void *data = NULL; 1115 1116 if (drro->drr_type == DMU_OT_NONE || |
1120 drro->drr_type >= DMU_OT_NUMTYPES || 1121 drro->drr_bonustype >= DMU_OT_NUMTYPES || | 1117 !DMU_OT_IS_VALID(drro->drr_type) || 1118 !DMU_OT_IS_VALID(drro->drr_bonustype) || |
1122 drro->drr_checksumtype >= ZIO_CHECKSUM_FUNCTIONS || 1123 drro->drr_compress >= ZIO_COMPRESS_FUNCTIONS || 1124 P2PHASE(drro->drr_blksz, SPA_MINBLOCKSIZE) || 1125 drro->drr_blksz < SPA_MINBLOCKSIZE || 1126 drro->drr_blksz > SPA_MAXBLOCKSIZE || 1127 drro->drr_bonuslen > DN_MAX_BONUSLEN) { 1128 return (EINVAL); 1129 } --- 48 unchanged lines hidden (view full) --- 1178 dmu_buf_t *db; 1179 1180 VERIFY(0 == dmu_bonus_hold(os, drro->drr_object, FTAG, &db)); 1181 dmu_buf_will_dirty(db, tx); 1182 1183 ASSERT3U(db->db_size, >=, drro->drr_bonuslen); 1184 bcopy(data, db->db_data, drro->drr_bonuslen); 1185 if (ra->byteswap) { | 1119 drro->drr_checksumtype >= ZIO_CHECKSUM_FUNCTIONS || 1120 drro->drr_compress >= ZIO_COMPRESS_FUNCTIONS || 1121 P2PHASE(drro->drr_blksz, SPA_MINBLOCKSIZE) || 1122 drro->drr_blksz < SPA_MINBLOCKSIZE || 1123 drro->drr_blksz > SPA_MAXBLOCKSIZE || 1124 drro->drr_bonuslen > DN_MAX_BONUSLEN) { 1125 return (EINVAL); 1126 } --- 48 unchanged lines hidden (view full) --- 1175 dmu_buf_t *db; 1176 1177 VERIFY(0 == dmu_bonus_hold(os, drro->drr_object, FTAG, &db)); 1178 dmu_buf_will_dirty(db, tx); 1179 1180 ASSERT3U(db->db_size, >=, drro->drr_bonuslen); 1181 bcopy(data, db->db_data, drro->drr_bonuslen); 1182 if (ra->byteswap) { |
1186 dmu_ot[drro->drr_bonustype].ot_byteswap(db->db_data, | 1183 dmu_object_byteswap_t byteswap = 1184 DMU_OT_BYTESWAP(drro->drr_bonustype); 1185 dmu_ot_byteswap[byteswap].ob_func(db->db_data, |
1187 drro->drr_bonuslen); 1188 } 1189 dmu_buf_rele(db, FTAG); 1190 } 1191 dmu_tx_commit(tx); 1192 return (0); 1193} 1194 --- 26 unchanged lines hidden (view full) --- 1221restore_write(struct restorearg *ra, objset_t *os, 1222 struct drr_write *drrw) 1223{ 1224 dmu_tx_t *tx; 1225 void *data; 1226 int err; 1227 1228 if (drrw->drr_offset + drrw->drr_length < drrw->drr_offset || | 1186 drro->drr_bonuslen); 1187 } 1188 dmu_buf_rele(db, FTAG); 1189 } 1190 dmu_tx_commit(tx); 1191 return (0); 1192} 1193 --- 26 unchanged lines hidden (view full) --- 1220restore_write(struct restorearg *ra, objset_t *os, 1221 struct drr_write *drrw) 1222{ 1223 dmu_tx_t *tx; 1224 void *data; 1225 int err; 1226 1227 if (drrw->drr_offset + drrw->drr_length < drrw->drr_offset || |
1229 drrw->drr_type >= DMU_OT_NUMTYPES) | 1228 !DMU_OT_IS_VALID(drrw->drr_type)) |
1230 return (EINVAL); 1231 1232 data = restore_read(ra, drrw->drr_length); 1233 if (data == NULL) 1234 return (ra->err); 1235 1236 if (dmu_object_info(os, drrw->drr_object, NULL) != 0) 1237 return (EINVAL); 1238 1239 tx = dmu_tx_create(os); 1240 1241 dmu_tx_hold_write(tx, drrw->drr_object, 1242 drrw->drr_offset, drrw->drr_length); 1243 err = dmu_tx_assign(tx, TXG_WAIT); 1244 if (err) { 1245 dmu_tx_abort(tx); 1246 return (err); 1247 } | 1229 return (EINVAL); 1230 1231 data = restore_read(ra, drrw->drr_length); 1232 if (data == NULL) 1233 return (ra->err); 1234 1235 if (dmu_object_info(os, drrw->drr_object, NULL) != 0) 1236 return (EINVAL); 1237 1238 tx = dmu_tx_create(os); 1239 1240 dmu_tx_hold_write(tx, drrw->drr_object, 1241 drrw->drr_offset, drrw->drr_length); 1242 err = dmu_tx_assign(tx, TXG_WAIT); 1243 if (err) { 1244 dmu_tx_abort(tx); 1245 return (err); 1246 } |
1248 if (ra->byteswap) 1249 dmu_ot[drrw->drr_type].ot_byteswap(data, drrw->drr_length); | 1247 if (ra->byteswap) { 1248 dmu_object_byteswap_t byteswap = 1249 DMU_OT_BYTESWAP(drrw->drr_type); 1250 dmu_ot_byteswap[byteswap].ob_func(data, drrw->drr_length); 1251 } |
1250 dmu_write(os, drrw->drr_object, 1251 drrw->drr_offset, drrw->drr_length, data, tx); 1252 dmu_tx_commit(tx); 1253 return (0); 1254} 1255 1256/* 1257 * Handle a DRR_WRITE_BYREF record. This record is used in dedup'ed --- 470 unchanged lines hidden --- | 1252 dmu_write(os, drrw->drr_object, 1253 drrw->drr_offset, drrw->drr_length, data, tx); 1254 dmu_tx_commit(tx); 1255 return (0); 1256} 1257 1258/* 1259 * Handle a DRR_WRITE_BYREF record. This record is used in dedup'ed --- 470 unchanged lines hidden --- |