7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
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 /*
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25 /*
26 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
27 */
28
29 #ifndef _ZIO_H
30 #define _ZIO_H
31
32 #include <sys/zfs_context.h>
33 #include <sys/spa.h>
34 #include <sys/txg.h>
35 #include <sys/avl.h>
36 #include <sys/fs/zfs.h>
37 #include <sys/zio_impl.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /*
44 * Embedded checksum
45 */
46 #define ZEC_MAGIC 0x210da7ab10c7a11ULL
255 uint64_t zb_blkid;
256 } zbookmark_t;
257
258 #define SET_BOOKMARK(zb, objset, object, level, blkid) \
259 { \
260 (zb)->zb_objset = objset; \
261 (zb)->zb_object = object; \
262 (zb)->zb_level = level; \
263 (zb)->zb_blkid = blkid; \
264 }
265
266 #define ZB_DESTROYED_OBJSET (-1ULL)
267
268 #define ZB_ROOT_OBJECT (0ULL)
269 #define ZB_ROOT_LEVEL (-1LL)
270 #define ZB_ROOT_BLKID (0ULL)
271
272 #define ZB_ZIL_OBJECT (0ULL)
273 #define ZB_ZIL_LEVEL (-2LL)
274
275 typedef struct zio_prop {
276 enum zio_checksum zp_checksum;
277 enum zio_compress zp_compress;
278 dmu_object_type_t zp_type;
279 uint8_t zp_level;
280 uint8_t zp_copies;
281 uint8_t zp_dedup;
282 uint8_t zp_dedup_verify;
283 } zio_prop_t;
284
285 typedef struct zio_cksum_report zio_cksum_report_t;
286
287 typedef void zio_cksum_finish_f(zio_cksum_report_t *rep,
288 const void *good_data);
289 typedef void zio_cksum_free_f(void *cbdata, size_t size);
290
291 struct zio_bad_cksum; /* defined in zio_checksum.h */
292
293 struct zio_cksum_report {
294 struct zio_cksum_report *zcr_next;
295 nvlist_t *zcr_ereport;
296 nvlist_t *zcr_detector;
297 void *zcr_cbdata;
298 size_t zcr_cbinfo; /* passed to zcr_free() */
299 uint64_t zcr_align;
300 uint64_t zcr_length;
301 zio_cksum_finish_f *zcr_finish;
302 zio_cksum_free_f *zcr_free;
303
304 /* internal use only */
305 struct zio_bad_cksum *zcr_ckinfo; /* information from failure */
306 };
307
308 typedef void zio_vsd_cksum_report_f(zio_t *zio, zio_cksum_report_t *zcr,
309 void *arg);
310
311 zio_vsd_cksum_report_f zio_vsd_default_cksum_report;
541
542 /*
543 * Checksum ereport functions
544 */
545 extern void zfs_ereport_start_checksum(spa_t *spa, vdev_t *vd, struct zio *zio,
546 uint64_t offset, uint64_t length, void *arg, struct zio_bad_cksum *info);
547 extern void zfs_ereport_finish_checksum(zio_cksum_report_t *report,
548 const void *good_data, const void *bad_data, boolean_t drop_if_identical);
549
550 extern void zfs_ereport_send_interim_checksum(zio_cksum_report_t *report);
551 extern void zfs_ereport_free_checksum(zio_cksum_report_t *report);
552
553 /* If we have the good data in hand, this function can be used */
554 extern void zfs_ereport_post_checksum(spa_t *spa, vdev_t *vd,
555 struct zio *zio, uint64_t offset, uint64_t length,
556 const void *good_data, const void *bad_data, struct zio_bad_cksum *info);
557
558 /* Called from spa_sync(), but primarily an injection handler */
559 extern void spa_handle_ignored_writes(spa_t *spa);
560
561 #ifdef __cplusplus
562 }
563 #endif
564
565 #endif /* _ZIO_H */
|
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
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 /*
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25 /*
26 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
27 * Copyright (c) 2012 by Delphix. All rights reserved.
28 */
29
30 #ifndef _ZIO_H
31 #define _ZIO_H
32
33 #include <sys/zfs_context.h>
34 #include <sys/spa.h>
35 #include <sys/txg.h>
36 #include <sys/avl.h>
37 #include <sys/fs/zfs.h>
38 #include <sys/zio_impl.h>
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 /*
45 * Embedded checksum
46 */
47 #define ZEC_MAGIC 0x210da7ab10c7a11ULL
256 uint64_t zb_blkid;
257 } zbookmark_t;
258
259 #define SET_BOOKMARK(zb, objset, object, level, blkid) \
260 { \
261 (zb)->zb_objset = objset; \
262 (zb)->zb_object = object; \
263 (zb)->zb_level = level; \
264 (zb)->zb_blkid = blkid; \
265 }
266
267 #define ZB_DESTROYED_OBJSET (-1ULL)
268
269 #define ZB_ROOT_OBJECT (0ULL)
270 #define ZB_ROOT_LEVEL (-1LL)
271 #define ZB_ROOT_BLKID (0ULL)
272
273 #define ZB_ZIL_OBJECT (0ULL)
274 #define ZB_ZIL_LEVEL (-2LL)
275
276 #define ZB_IS_ZERO(zb) \
277 ((zb)->zb_objset == 0 && (zb)->zb_object == 0 && \
278 (zb)->zb_level == 0 && (zb)->zb_blkid == 0)
279 #define ZB_IS_ROOT(zb) \
280 ((zb)->zb_object == ZB_ROOT_OBJECT && \
281 (zb)->zb_level == ZB_ROOT_LEVEL && \
282 (zb)->zb_blkid == ZB_ROOT_BLKID)
283
284 typedef struct zio_prop {
285 enum zio_checksum zp_checksum;
286 enum zio_compress zp_compress;
287 dmu_object_type_t zp_type;
288 uint8_t zp_level;
289 uint8_t zp_copies;
290 uint8_t zp_dedup;
291 uint8_t zp_dedup_verify;
292 } zio_prop_t;
293
294 typedef struct zio_cksum_report zio_cksum_report_t;
295
296 typedef void zio_cksum_finish_f(zio_cksum_report_t *rep,
297 const void *good_data);
298 typedef void zio_cksum_free_f(void *cbdata, size_t size);
299
300 struct zio_bad_cksum; /* defined in zio_checksum.h */
301 struct dnode_phys;
302
303 struct zio_cksum_report {
304 struct zio_cksum_report *zcr_next;
305 nvlist_t *zcr_ereport;
306 nvlist_t *zcr_detector;
307 void *zcr_cbdata;
308 size_t zcr_cbinfo; /* passed to zcr_free() */
309 uint64_t zcr_align;
310 uint64_t zcr_length;
311 zio_cksum_finish_f *zcr_finish;
312 zio_cksum_free_f *zcr_free;
313
314 /* internal use only */
315 struct zio_bad_cksum *zcr_ckinfo; /* information from failure */
316 };
317
318 typedef void zio_vsd_cksum_report_f(zio_t *zio, zio_cksum_report_t *zcr,
319 void *arg);
320
321 zio_vsd_cksum_report_f zio_vsd_default_cksum_report;
551
552 /*
553 * Checksum ereport functions
554 */
555 extern void zfs_ereport_start_checksum(spa_t *spa, vdev_t *vd, struct zio *zio,
556 uint64_t offset, uint64_t length, void *arg, struct zio_bad_cksum *info);
557 extern void zfs_ereport_finish_checksum(zio_cksum_report_t *report,
558 const void *good_data, const void *bad_data, boolean_t drop_if_identical);
559
560 extern void zfs_ereport_send_interim_checksum(zio_cksum_report_t *report);
561 extern void zfs_ereport_free_checksum(zio_cksum_report_t *report);
562
563 /* If we have the good data in hand, this function can be used */
564 extern void zfs_ereport_post_checksum(spa_t *spa, vdev_t *vd,
565 struct zio *zio, uint64_t offset, uint64_t length,
566 const void *good_data, const void *bad_data, struct zio_bad_cksum *info);
567
568 /* Called from spa_sync(), but primarily an injection handler */
569 extern void spa_handle_ignored_writes(spa_t *spa);
570
571 /* zbookmark functions */
572 boolean_t zbookmark_is_before(const struct dnode_phys *dnp,
573 const zbookmark_t *zb1, const zbookmark_t *zb2);
574
575 #ifdef __cplusplus
576 }
577 #endif
578
579 #endif /* _ZIO_H */
|