1 // SPDX-License-Identifier: CDDL-1.0 2 /* 3 * CDDL HEADER START 4 * 5 * This file and its contents are supplied under the terms of the 6 * Common Development and Distribution License ("CDDL"), version 1.0. 7 * You may only use this file in accordance with the terms of version 8 * 1.0 of the CDDL. 9 * 10 * A full copy of the text of the CDDL should have accompanied this 11 * source. A copy of the CDDL is also available via the Internet at 12 * http://www.illumos.org/license/CDDL. 13 * 14 * CDDL HEADER END 15 */ 16 17 /* 18 * Copyright (c) 2015 by Delphix. All rights reserved. 19 */ 20 21 #ifndef _SYS_VDEV_INDIRECT_BIRTHS_H 22 #define _SYS_VDEV_INDIRECT_BIRTHS_H 23 24 #include <sys/dmu.h> 25 #include <sys/spa.h> 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 typedef struct vdev_indirect_birth_entry_phys { 32 uint64_t vibe_offset; 33 uint64_t vibe_phys_birth_txg; 34 } vdev_indirect_birth_entry_phys_t; 35 36 typedef struct vdev_indirect_birth_phys { 37 uint64_t vib_count; /* count of v_i_b_entry_phys_t's */ 38 } vdev_indirect_birth_phys_t; 39 40 typedef struct vdev_indirect_births { 41 uint64_t vib_object; 42 43 /* 44 * Each entry indicates that everything up to but not including 45 * vibe_offset was copied in vibe_phys_birth_txg. Entries are sorted 46 * by increasing phys_birth, and also by increasing offset. See 47 * vdev_indirect_births_physbirth for usage. 48 */ 49 vdev_indirect_birth_entry_phys_t *vib_entries; 50 51 objset_t *vib_objset; 52 53 dmu_buf_t *vib_dbuf; 54 vdev_indirect_birth_phys_t *vib_phys; 55 } vdev_indirect_births_t; 56 57 extern vdev_indirect_births_t *vdev_indirect_births_open(objset_t *os, 58 uint64_t object); 59 extern void vdev_indirect_births_close(vdev_indirect_births_t *vib); 60 extern boolean_t vdev_indirect_births_is_open(vdev_indirect_births_t *vib); 61 extern uint64_t vdev_indirect_births_alloc(objset_t *os, dmu_tx_t *tx); 62 extern void vdev_indirect_births_free(objset_t *os, uint64_t object, 63 dmu_tx_t *tx); 64 65 extern uint64_t vdev_indirect_births_count(vdev_indirect_births_t *vib); 66 extern uint64_t vdev_indirect_births_object(vdev_indirect_births_t *vib); 67 68 extern void vdev_indirect_births_add_entry(vdev_indirect_births_t *vib, 69 uint64_t offset, uint64_t txg, dmu_tx_t *tx); 70 71 extern uint64_t vdev_indirect_births_physbirth(vdev_indirect_births_t *vib, 72 uint64_t offset, uint64_t asize); 73 74 extern uint64_t vdev_indirect_births_last_entry_txg( 75 vdev_indirect_births_t *vib); 76 77 #ifdef __cplusplus 78 } 79 #endif 80 81 #endif /* _SYS_VDEV_INDIRECT_BIRTHS_H */ 82