1 // SPDX-License-Identifier: CDDL-1.0 2 /* 3 * CDDL HEADER START 4 * 5 * The contents of this file are subject to the terms of the 6 * Common Development and Distribution License (the "License"). 7 * You may not use this file except in compliance with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or https://opensource.org/licenses/CDDL-1.0. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright (c) 2020, 2021, 2022 by Pawel Jakub Dawidek 24 */ 25 26 #ifndef _SYS_BRT_H 27 #define _SYS_BRT_H 28 29 #include <sys/sysmacros.h> 30 #include <sys/types.h> 31 #include <sys/fs/zfs.h> 32 #include <sys/zio.h> 33 #include <sys/dmu.h> 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 extern boolean_t brt_entry_decref(spa_t *spa, const blkptr_t *bp); 40 extern uint64_t brt_entry_get_refcount(spa_t *spa, const blkptr_t *bp); 41 42 extern uint64_t brt_get_dspace(spa_t *spa); 43 extern uint64_t brt_get_used(spa_t *spa); 44 extern uint64_t brt_get_saved(spa_t *spa); 45 extern uint64_t brt_get_ratio(spa_t *spa); 46 47 extern boolean_t brt_maybe_exists(spa_t *spa, const blkptr_t *bp); 48 extern void brt_init(void); 49 extern void brt_fini(void); 50 51 extern void brt_pending_add(spa_t *spa, const blkptr_t *bp, dmu_tx_t *tx); 52 extern void brt_pending_remove(spa_t *spa, const blkptr_t *bp, dmu_tx_t *tx); 53 extern void brt_pending_apply(spa_t *spa, uint64_t txg); 54 55 extern void brt_create(spa_t *spa); 56 extern int brt_load(spa_t *spa); 57 extern void brt_unload(spa_t *spa); 58 extern void brt_sync(spa_t *spa, uint64_t txg); 59 60 #ifdef __cplusplus 61 } 62 #endif 63 64 #endif /* _SYS_BRT_H */ 65