1fa9e4066Sahrens /* 2fa9e4066Sahrens * CDDL HEADER START 3fa9e4066Sahrens * 4fa9e4066Sahrens * The contents of this file are subject to the terms of the 5ea8dc4b6Seschrock * Common Development and Distribution License (the "License"). 6ea8dc4b6Seschrock * You may not use this file except in compliance with the License. 7fa9e4066Sahrens * 8fa9e4066Sahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9fa9e4066Sahrens * or http://www.opensolaris.org/os/licensing. 10fa9e4066Sahrens * See the License for the specific language governing permissions 11fa9e4066Sahrens * and limitations under the License. 12fa9e4066Sahrens * 13fa9e4066Sahrens * When distributing Covered Code, include this CDDL HEADER in each 14fa9e4066Sahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15fa9e4066Sahrens * If applicable, add the following below this CDDL HEADER, with the 16fa9e4066Sahrens * fields enclosed by brackets "[]" replaced with your own identifying 17fa9e4066Sahrens * information: Portions Copyright [yyyy] [name of copyright owner] 18fa9e4066Sahrens * 19fa9e4066Sahrens * CDDL HEADER END 20fa9e4066Sahrens */ 21fa9e4066Sahrens /* 223f9d6ad7SLin Ling * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 23238fb8bbSMatthew Ahrens * Copyright (c) 2012, 2015 by Delphix. All rights reserved. 24aad02571SSaso Kiselkov * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. 250521c5ebSJustin Gibbs * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. 26fa9e4066Sahrens */ 27fa9e4066Sahrens 28fa9e4066Sahrens #ifndef _SYS_DBUF_H 29fa9e4066Sahrens #define _SYS_DBUF_H 30fa9e4066Sahrens 31fa9e4066Sahrens #include <sys/dmu.h> 32fa9e4066Sahrens #include <sys/spa.h> 33fa9e4066Sahrens #include <sys/txg.h> 34fa9e4066Sahrens #include <sys/zio.h> 35fa9e4066Sahrens #include <sys/arc.h> 36fa9e4066Sahrens #include <sys/zfs_context.h> 37fa9e4066Sahrens #include <sys/refcount.h> 38744947dcSTom Erickson #include <sys/zrlock.h> 39fa9e4066Sahrens 40fa9e4066Sahrens #ifdef __cplusplus 41fa9e4066Sahrens extern "C" { 42fa9e4066Sahrens #endif 43fa9e4066Sahrens 44c717a561Smaybee #define IN_DMU_SYNC 2 45fa9e4066Sahrens 46fa9e4066Sahrens /* 47ea8dc4b6Seschrock * define flags for dbuf_read 48fa9e4066Sahrens */ 49fa9e4066Sahrens 5013506d1eSmaybee #define DB_RF_MUST_SUCCEED (1 << 0) 51fa9e4066Sahrens #define DB_RF_CANFAIL (1 << 1) 52fa9e4066Sahrens #define DB_RF_HAVESTRUCT (1 << 2) 53fa9e4066Sahrens #define DB_RF_NOPREFETCH (1 << 3) 54ea8dc4b6Seschrock #define DB_RF_NEVERWAIT (1 << 4) 5513506d1eSmaybee #define DB_RF_CACHED (1 << 5) 56fa9e4066Sahrens 57fa9e4066Sahrens /* 5882c9918fSTim Haley * The simplified state transition diagram for dbufs looks like: 59fa9e4066Sahrens * 60fa9e4066Sahrens * +----> READ ----+ 61fa9e4066Sahrens * | | 62fa9e4066Sahrens * | V 63ea8dc4b6Seschrock * (alloc)-->UNCACHED CACHED-->EVICTING-->(free) 6482c9918fSTim Haley * | ^ ^ 6582c9918fSTim Haley * | | | 6682c9918fSTim Haley * +----> FILL ----+ | 67fa9e4066Sahrens * | | 6882c9918fSTim Haley * | | 6982c9918fSTim Haley * +--------> NOFILL -------+ 7080ff00d7SAlex Reece * 7180ff00d7SAlex Reece * DB_SEARCH is an invalid state for a dbuf. It is used by dbuf_free_range 7280ff00d7SAlex Reece * to find all dbufs in a range of a dnode and must be less than any other 7380ff00d7SAlex Reece * dbuf_states_t (see comment on dn_dbufs in dnode.h). 74fa9e4066Sahrens */ 75fa9e4066Sahrens typedef enum dbuf_states { 7680ff00d7SAlex Reece DB_SEARCH = -1, 77fa9e4066Sahrens DB_UNCACHED, 78fa9e4066Sahrens DB_FILL, 7982c9918fSTim Haley DB_NOFILL, 80fa9e4066Sahrens DB_READ, 81ea8dc4b6Seschrock DB_CACHED, 82ea8dc4b6Seschrock DB_EVICTING 83fa9e4066Sahrens } dbuf_states_t; 84fa9e4066Sahrens 85fa9e4066Sahrens struct dnode; 86fa9e4066Sahrens struct dmu_tx; 87fa9e4066Sahrens 88fa9e4066Sahrens /* 89fa9e4066Sahrens * level = 0 means the user data 90fa9e4066Sahrens * level = 1 means the single indirect block 91fa9e4066Sahrens * etc. 92fa9e4066Sahrens */ 93fa9e4066Sahrens 94c717a561Smaybee struct dmu_buf_impl; 95c717a561Smaybee 96c717a561Smaybee typedef enum override_states { 97c717a561Smaybee DR_NOT_OVERRIDDEN, 98c717a561Smaybee DR_IN_DMU_SYNC, 99c717a561Smaybee DR_OVERRIDDEN 100c717a561Smaybee } override_states_t; 101c717a561Smaybee 102c717a561Smaybee typedef struct dbuf_dirty_record { 103c717a561Smaybee /* link on our parents dirty list */ 104c717a561Smaybee list_node_t dr_dirty_node; 105c717a561Smaybee 106c717a561Smaybee /* transaction group this data will sync in */ 107c717a561Smaybee uint64_t dr_txg; 108c717a561Smaybee 109c717a561Smaybee /* zio of outstanding write IO */ 110c717a561Smaybee zio_t *dr_zio; 111c717a561Smaybee 112c717a561Smaybee /* pointer back to our dbuf */ 113c717a561Smaybee struct dmu_buf_impl *dr_dbuf; 114c717a561Smaybee 115c717a561Smaybee /* pointer to next dirty record */ 116c717a561Smaybee struct dbuf_dirty_record *dr_next; 117c717a561Smaybee 118c717a561Smaybee /* pointer to parent dirty record */ 119c717a561Smaybee struct dbuf_dirty_record *dr_parent; 120c717a561Smaybee 12169962b56SMatthew Ahrens /* How much space was changed to dsl_pool_dirty_space() for this? */ 12269962b56SMatthew Ahrens unsigned int dr_accounted; 12369962b56SMatthew Ahrens 124c717a561Smaybee union dirty_types { 125c717a561Smaybee struct dirty_indirect { 126c717a561Smaybee 127c717a561Smaybee /* protect access to list */ 128c717a561Smaybee kmutex_t dr_mtx; 129c717a561Smaybee 130c717a561Smaybee /* Our list of dirty children */ 131c717a561Smaybee list_t dr_children; 132c717a561Smaybee } di; 133c717a561Smaybee struct dirty_leaf { 134c717a561Smaybee 135c717a561Smaybee /* 136c717a561Smaybee * dr_data is set when we dirty the buffer 137c717a561Smaybee * so that we can retain the pointer even if it 138c717a561Smaybee * gets COW'd in a subsequent transaction group. 139c717a561Smaybee */ 140c717a561Smaybee arc_buf_t *dr_data; 141c717a561Smaybee blkptr_t dr_overridden_by; 142c717a561Smaybee override_states_t dr_override_state; 143b24ab676SJeff Bonwick uint8_t dr_copies; 14480901aeaSGeorge Wilson boolean_t dr_nopwrite; 145c717a561Smaybee } dl; 146c717a561Smaybee } dt; 147c717a561Smaybee } dbuf_dirty_record_t; 148c717a561Smaybee 149fa9e4066Sahrens typedef struct dmu_buf_impl { 150fa9e4066Sahrens /* 151fa9e4066Sahrens * The following members are immutable, with the exception of 152fa9e4066Sahrens * db.db_data, which is protected by db_mtx. 153fa9e4066Sahrens */ 154fa9e4066Sahrens 155fa9e4066Sahrens /* the publicly visible structure */ 156fa9e4066Sahrens dmu_buf_t db; 157fa9e4066Sahrens 158fa9e4066Sahrens /* the objset we belong to */ 159503ad85cSMatthew Ahrens struct objset *db_objset; 160fa9e4066Sahrens 161fa9e4066Sahrens /* 162744947dcSTom Erickson * handle to safely access the dnode we belong to (NULL when evicted) 163fa9e4066Sahrens */ 164744947dcSTom Erickson struct dnode_handle *db_dnode_handle; 165fa9e4066Sahrens 166fa9e4066Sahrens /* 167fa9e4066Sahrens * our parent buffer; if the dnode points to us directly, 168744947dcSTom Erickson * db_parent == db_dnode_handle->dnh_dnode->dn_dbuf 169fa9e4066Sahrens * only accessed by sync thread ??? 170fa9e4066Sahrens * (NULL when evicted) 171744947dcSTom Erickson * May change from NULL to non-NULL under the protection of db_mtx 172744947dcSTom Erickson * (see dbuf_check_blkptr()) 173fa9e4066Sahrens */ 174fa9e4066Sahrens struct dmu_buf_impl *db_parent; 175fa9e4066Sahrens 176fa9e4066Sahrens /* 177fa9e4066Sahrens * link for hash table of all dmu_buf_impl_t's 178fa9e4066Sahrens */ 179fa9e4066Sahrens struct dmu_buf_impl *db_hash_next; 180fa9e4066Sahrens 181fa9e4066Sahrens /* our block number */ 182fa9e4066Sahrens uint64_t db_blkid; 183fa9e4066Sahrens 184fa9e4066Sahrens /* 185fa9e4066Sahrens * Pointer to the blkptr_t which points to us. May be NULL if we 186fa9e4066Sahrens * don't have one yet. (NULL when evicted) 187fa9e4066Sahrens */ 188fa9e4066Sahrens blkptr_t *db_blkptr; 189fa9e4066Sahrens 190fa9e4066Sahrens /* 191fa9e4066Sahrens * Our indirection level. Data buffers have db_level==0. 192fa9e4066Sahrens * Indirect buffers which point to data buffers have 193fa9e4066Sahrens * db_level==1. etc. Buffers which contain dnodes have 194fa9e4066Sahrens * db_level==0, since the dnodes are stored in a file. 195fa9e4066Sahrens */ 196fa9e4066Sahrens uint8_t db_level; 197fa9e4066Sahrens 198fa9e4066Sahrens /* db_mtx protects the members below */ 199fa9e4066Sahrens kmutex_t db_mtx; 200fa9e4066Sahrens 201fa9e4066Sahrens /* 202fa9e4066Sahrens * Current state of the buffer 203fa9e4066Sahrens */ 204fa9e4066Sahrens dbuf_states_t db_state; 205fa9e4066Sahrens 206fa9e4066Sahrens /* 207fa9e4066Sahrens * Refcount accessed by dmu_buf_{hold,rele}. 208fa9e4066Sahrens * If nonzero, the buffer can't be destroyed. 209fa9e4066Sahrens * Protected by db_mtx. 210fa9e4066Sahrens */ 211fa9e4066Sahrens refcount_t db_holds; 212fa9e4066Sahrens 213fa9e4066Sahrens /* buffer holding our data */ 214fa9e4066Sahrens arc_buf_t *db_buf; 215fa9e4066Sahrens 216fa9e4066Sahrens kcondvar_t db_changed; 217c717a561Smaybee dbuf_dirty_record_t *db_data_pending; 218c717a561Smaybee 219c717a561Smaybee /* pointer to most recent dirty record for this buffer */ 220c717a561Smaybee dbuf_dirty_record_t *db_last_dirty; 221fa9e4066Sahrens 222fa9e4066Sahrens /* 223c717a561Smaybee * Our link on the owner dnodes's dn_dbufs list. 224ea8dc4b6Seschrock * Protected by its dn_dbufs_mtx. 225fa9e4066Sahrens */ 226d080a709SAlex Reece avl_node_t db_link; 227fa9e4066Sahrens 228c717a561Smaybee /* Data which is unique to data (leaf) blocks: */ 229fa9e4066Sahrens 2300521c5ebSJustin Gibbs /* User callback information. */ 2310521c5ebSJustin Gibbs dmu_buf_user_t *db_user; 232c717a561Smaybee 233*1666a561SJustin T. Gibbs /* 234*1666a561SJustin T. Gibbs * Evict user data as soon as the dirty and reference 235*1666a561SJustin T. Gibbs * counts are equal. 236*1666a561SJustin T. Gibbs */ 237*1666a561SJustin T. Gibbs uint8_t db_user_immediate_evict; 238*1666a561SJustin T. Gibbs 239*1666a561SJustin T. Gibbs /* 240*1666a561SJustin T. Gibbs * This block was freed while a read or write was 241*1666a561SJustin T. Gibbs * active. 242*1666a561SJustin T. Gibbs */ 243fa9e4066Sahrens uint8_t db_freed_in_flight; 244fa9e4066Sahrens 245*1666a561SJustin T. Gibbs /* 246*1666a561SJustin T. Gibbs * dnode_evict_dbufs() or dnode_evict_bonus() tried to 247*1666a561SJustin T. Gibbs * evict this dbuf, but couldn't due to outstanding 248*1666a561SJustin T. Gibbs * references. Evict once the refcount drops to 0. 249*1666a561SJustin T. Gibbs */ 250*1666a561SJustin T. Gibbs uint8_t db_pending_evict; 251*1666a561SJustin T. Gibbs 252c717a561Smaybee uint8_t db_dirtycnt; 253fa9e4066Sahrens } dmu_buf_impl_t; 254fa9e4066Sahrens 255fa9e4066Sahrens /* Note: the dbuf hash table is exposed only for the mdb module */ 256fa9e4066Sahrens #define DBUF_MUTEXES 256 257fa9e4066Sahrens #define DBUF_HASH_MUTEX(h, idx) (&(h)->hash_mutexes[(idx) & (DBUF_MUTEXES-1)]) 258fa9e4066Sahrens typedef struct dbuf_hash_table { 259fa9e4066Sahrens uint64_t hash_table_mask; 260fa9e4066Sahrens dmu_buf_impl_t **hash_table; 261fa9e4066Sahrens kmutex_t hash_mutexes[DBUF_MUTEXES]; 262fa9e4066Sahrens } dbuf_hash_table_t; 263fa9e4066Sahrens 2645f9bb2f3SPaul Dagnelie uint64_t dbuf_whichblock(struct dnode *di, int64_t level, uint64_t offset); 265fa9e4066Sahrens 266fa9e4066Sahrens dmu_buf_impl_t *dbuf_create_tlib(struct dnode *dn, char *data); 2671934e92fSmaybee void dbuf_create_bonus(struct dnode *dn); 2680a586ceaSMark Shellenbaum int dbuf_spill_set_blksz(dmu_buf_t *db, uint64_t blksz, dmu_tx_t *tx); 2690a586ceaSMark Shellenbaum void dbuf_spill_hold(struct dnode *dn, dmu_buf_impl_t **dbp, void *tag); 2700a586ceaSMark Shellenbaum 2710a586ceaSMark Shellenbaum void dbuf_rm_spill(struct dnode *dn, dmu_tx_t *tx); 272fa9e4066Sahrens 273ea8dc4b6Seschrock dmu_buf_impl_t *dbuf_hold(struct dnode *dn, uint64_t blkid, void *tag); 274fa9e4066Sahrens dmu_buf_impl_t *dbuf_hold_level(struct dnode *dn, int level, uint64_t blkid, 275fa9e4066Sahrens void *tag); 2765f9bb2f3SPaul Dagnelie int dbuf_hold_impl(struct dnode *dn, uint8_t level, uint64_t blkid, 2775f9bb2f3SPaul Dagnelie boolean_t fail_sparse, boolean_t fail_uncached, 278fa9e4066Sahrens void *tag, dmu_buf_impl_t **dbp); 279fa9e4066Sahrens 2805f9bb2f3SPaul Dagnelie void dbuf_prefetch(struct dnode *dn, int64_t level, uint64_t blkid, 2815f9bb2f3SPaul Dagnelie zio_priority_t prio, arc_flags_t aflags); 282fa9e4066Sahrens 283fa9e4066Sahrens void dbuf_add_ref(dmu_buf_impl_t *db, void *tag); 284ab64b4bbSJustin T. Gibbs boolean_t dbuf_try_add_ref(dmu_buf_t *db, objset_t *os, uint64_t obj, 285ab64b4bbSJustin T. Gibbs uint64_t blkid, void *tag); 286fa9e4066Sahrens uint64_t dbuf_refcount(dmu_buf_impl_t *db); 287fa9e4066Sahrens 288ea8dc4b6Seschrock void dbuf_rele(dmu_buf_impl_t *db, void *tag); 289b24ab676SJeff Bonwick void dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag); 290fa9e4066Sahrens 291ab64b4bbSJustin T. Gibbs dmu_buf_impl_t *dbuf_find(struct objset *os, uint64_t object, uint8_t level, 292ab64b4bbSJustin T. Gibbs uint64_t blkid); 293fa9e4066Sahrens 294ea8dc4b6Seschrock int dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags); 29582c9918fSTim Haley void dmu_buf_will_not_fill(dmu_buf_t *db, dmu_tx_t *tx); 296fa9e4066Sahrens void dmu_buf_will_fill(dmu_buf_t *db, dmu_tx_t *tx); 297fa9e4066Sahrens void dmu_buf_fill_done(dmu_buf_t *db, dmu_tx_t *tx); 2982fdbea25SAleksandr Guzovskiy void dbuf_assign_arcbuf(dmu_buf_impl_t *db, arc_buf_t *buf, dmu_tx_t *tx); 299c717a561Smaybee dbuf_dirty_record_t *dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx); 300c242f9a0Schunli zhang - Sun Microsystems - Irvine United States arc_buf_t *dbuf_loan_arcbuf(dmu_buf_impl_t *db); 301e54e0be9SMatthew Ahrens void dmu_buf_write_embedded(dmu_buf_t *dbuf, void *data, 302e54e0be9SMatthew Ahrens bp_embedded_type_t etype, enum zio_compress comp, 303e54e0be9SMatthew Ahrens int uncompressed_size, int compressed_size, int byteorder, dmu_tx_t *tx); 304fa9e4066Sahrens 305ea8dc4b6Seschrock void dbuf_clear(dmu_buf_impl_t *db); 306fa9e4066Sahrens void dbuf_evict(dmu_buf_impl_t *db); 307fa9e4066Sahrens 308fa9e4066Sahrens void dbuf_setdirty(dmu_buf_impl_t *db, dmu_tx_t *tx); 309c717a561Smaybee void dbuf_unoverride(dbuf_dirty_record_t *dr); 310238fb8bbSMatthew Ahrens void dbuf_sync_list(list_t *list, int level, dmu_tx_t *tx); 3113f9d6ad7SLin Ling void dbuf_release_bp(dmu_buf_impl_t *db); 312fa9e4066Sahrens 313cdb0ab79Smaybee void dbuf_free_range(struct dnode *dn, uint64_t start, uint64_t end, 314fa9e4066Sahrens struct dmu_tx *); 315fa9e4066Sahrens 316fa9e4066Sahrens void dbuf_new_size(dmu_buf_impl_t *db, int size, dmu_tx_t *tx); 317fa9e4066Sahrens 318744947dcSTom Erickson #define DB_DNODE(_db) ((_db)->db_dnode_handle->dnh_dnode) 319744947dcSTom Erickson #define DB_DNODE_LOCK(_db) ((_db)->db_dnode_handle->dnh_zrlock) 320744947dcSTom Erickson #define DB_DNODE_ENTER(_db) (zrl_add(&DB_DNODE_LOCK(_db))) 321744947dcSTom Erickson #define DB_DNODE_EXIT(_db) (zrl_remove(&DB_DNODE_LOCK(_db))) 322744947dcSTom Erickson #define DB_DNODE_HELD(_db) (!zrl_is_zero(&DB_DNODE_LOCK(_db))) 323744947dcSTom Erickson 324fa9e4066Sahrens void dbuf_init(void); 325fa9e4066Sahrens void dbuf_fini(void); 326fa9e4066Sahrens 327744947dcSTom Erickson boolean_t dbuf_is_metadata(dmu_buf_impl_t *db); 3283baa08fcSek110237 329744947dcSTom Erickson #define DBUF_GET_BUFC_TYPE(_db) \ 3303b2aab18SMatthew Ahrens (dbuf_is_metadata(_db) ? ARC_BUFC_METADATA : ARC_BUFC_DATA) 3313baa08fcSek110237 332744947dcSTom Erickson #define DBUF_IS_CACHEABLE(_db) \ 333744947dcSTom Erickson ((_db)->db_objset->os_primary_cache == ZFS_CACHE_ALL || \ 3343b2aab18SMatthew Ahrens (dbuf_is_metadata(_db) && \ 335744947dcSTom Erickson ((_db)->db_objset->os_primary_cache == ZFS_CACHE_METADATA))) 336744947dcSTom Erickson 337744947dcSTom Erickson #define DBUF_IS_L2CACHEABLE(_db) \ 338744947dcSTom Erickson ((_db)->db_objset->os_secondary_cache == ZFS_CACHE_ALL || \ 3393b2aab18SMatthew Ahrens (dbuf_is_metadata(_db) && \ 340744947dcSTom Erickson ((_db)->db_objset->os_secondary_cache == ZFS_CACHE_METADATA))) 341ad23a2dbSjohansen 342aad02571SSaso Kiselkov #define DBUF_IS_L2COMPRESSIBLE(_db) \ 3439f7c5e6eSSaso Kiselkov ((_db)->db_objset->os_compress != ZIO_COMPRESS_OFF || \ 3449f7c5e6eSSaso Kiselkov (dbuf_is_metadata(_db) && zfs_mdcomp_disable == B_FALSE)) 345aad02571SSaso Kiselkov 346fa9e4066Sahrens #ifdef ZFS_DEBUG 347fa9e4066Sahrens 348fa9e4066Sahrens /* 349fa9e4066Sahrens * There should be a ## between the string literal and fmt, to make it 350fbabab8fSmaybee * clear that we're joining two strings together, but gcc does not 351fbabab8fSmaybee * support that preprocessor token. 352fa9e4066Sahrens */ 353fa9e4066Sahrens #define dprintf_dbuf(dbuf, fmt, ...) do { \ 354fa9e4066Sahrens if (zfs_flags & ZFS_DEBUG_DPRINTF) { \ 355fa9e4066Sahrens char __db_buf[32]; \ 356fa9e4066Sahrens uint64_t __db_obj = (dbuf)->db.db_object; \ 357fa9e4066Sahrens if (__db_obj == DMU_META_DNODE_OBJECT) \ 358fa9e4066Sahrens (void) strcpy(__db_buf, "mdn"); \ 359fa9e4066Sahrens else \ 360fa9e4066Sahrens (void) snprintf(__db_buf, sizeof (__db_buf), "%lld", \ 361fa9e4066Sahrens (u_longlong_t)__db_obj); \ 362fa9e4066Sahrens dprintf_ds((dbuf)->db_objset->os_dsl_dataset, \ 363fa9e4066Sahrens "obj=%s lvl=%u blkid=%lld " fmt, \ 364fa9e4066Sahrens __db_buf, (dbuf)->db_level, \ 365fa9e4066Sahrens (u_longlong_t)(dbuf)->db_blkid, __VA_ARGS__); \ 366fa9e4066Sahrens } \ 367fa9e4066Sahrens _NOTE(CONSTCOND) } while (0) 368fa9e4066Sahrens 369fa9e4066Sahrens #define dprintf_dbuf_bp(db, bp, fmt, ...) do { \ 370fa9e4066Sahrens if (zfs_flags & ZFS_DEBUG_DPRINTF) { \ 371c0a81264Sek110237 char *__blkbuf = kmem_alloc(BP_SPRINTF_LEN, KM_SLEEP); \ 37249064978SMax Grossman snprintf_blkptr(__blkbuf, BP_SPRINTF_LEN, bp); \ 373fa9e4066Sahrens dprintf_dbuf(db, fmt " %s\n", __VA_ARGS__, __blkbuf); \ 374c0a81264Sek110237 kmem_free(__blkbuf, BP_SPRINTF_LEN); \ 375fa9e4066Sahrens } \ 376fa9e4066Sahrens _NOTE(CONSTCOND) } while (0) 377fa9e4066Sahrens 3789c9dc39aSek110237 #define DBUF_VERIFY(db) dbuf_verify(db) 3799c9dc39aSek110237 380fa9e4066Sahrens #else 381fa9e4066Sahrens 382fa9e4066Sahrens #define dprintf_dbuf(db, fmt, ...) 383fa9e4066Sahrens #define dprintf_dbuf_bp(db, bp, fmt, ...) 3849c9dc39aSek110237 #define DBUF_VERIFY(db) 385fa9e4066Sahrens 386fa9e4066Sahrens #endif 387fa9e4066Sahrens 388fa9e4066Sahrens 389fa9e4066Sahrens #ifdef __cplusplus 390fa9e4066Sahrens } 391fa9e4066Sahrens #endif 392fa9e4066Sahrens 393fa9e4066Sahrens #endif /* _SYS_DBUF_H */ 394