Print this page
Revert "8958 Update Intel ucode to 20180108 release"
This reverts commit 1adc3ffcd976ec0a34010cc7db08037a14c3ea4c.
NEX-15280 New default metadata block size is too large
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-15280 New default metadata block size is too large
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-5058 WBC: Race between the purging of window and opening new one
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: Alex Aizman <alex.aizman@nexenta.com>
NEX-2830 ZFS smart compression
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-3266 5630 stale bonus buffer in recycled dnode_t leads to data corruption
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Will Andrews <will@freebsd.org>
Approved by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Dan Fields <dan.fields@nexenta.com>
SUP-507 Delete or truncate of large files delayed on datasets with small recordsize
Reviewed by: Albert Lee <trisk@nexenta.com>
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: Ilya Usvyatsky <ilya.usvyatsky@nexenta.com>
Reviewed by: Tony Nguyen <tony.nguyen@nexenta.com>
Fixup merge results
re #12585 rb4049 ZFS++ work port - refactoring to improve separation of open/closed code, bug fixes, performance improvements - open code
Bug 11205: add missing libzfs_closed_stubs.c to fix opensource-only build.
ZFS plus work: special vdevs, cos, cos/vdev properties


   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
   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  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.

  23  * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
  24  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
  25  */
  26 
  27 #ifndef _SYS_DNODE_H
  28 #define _SYS_DNODE_H
  29 
  30 #include <sys/zfs_context.h>
  31 #include <sys/avl.h>
  32 #include <sys/spa.h>
  33 #include <sys/txg.h>
  34 #include <sys/zio.h>
  35 #include <sys/refcount.h>
  36 #include <sys/dmu_zfetch.h>
  37 #include <sys/zrlock.h>
  38 #include <sys/multilist.h>
  39 
  40 #ifdef  __cplusplus
  41 extern "C" {
  42 #endif
  43 
  44 /*
  45  * dnode_hold() flags.
  46  */
  47 #define DNODE_MUST_BE_ALLOCATED 1
  48 #define DNODE_MUST_BE_FREE      2
  49 
  50 /*
  51  * dnode_next_offset() flags.
  52  */
  53 #define DNODE_FIND_HOLE         1
  54 #define DNODE_FIND_BACKWARDS    2
  55 #define DNODE_FIND_HAVELOCK     4
  56 
  57 /*
  58  * Fixed constants.
  59  */
  60 #define DNODE_SHIFT             9       /* 512 bytes */
  61 #define DN_MIN_INDBLKSHIFT      12      /* 4k */

  62 /*
  63  * If we ever increase this value beyond 20, we need to revisit all logic that
  64  * does x << level * ebps to handle overflow.  With a 1M indirect block size,
  65  * 4 levels of indirect blocks would not be able to guarantee addressing an
  66  * entire object, so 5 levels will be used, but 5 * (20 - 7) = 65.
  67  */
  68 #define DN_MAX_INDBLKSHIFT      17      /* 128k */
  69 #define DNODE_BLOCK_SHIFT       14      /* 16k */
  70 #define DNODE_CORE_SIZE         64      /* 64 bytes for dnode sans blkptrs */
  71 #define DN_MAX_OBJECT_SHIFT     48      /* 256 trillion (zfs_fid_t limit) */
  72 #define DN_MAX_OFFSET_SHIFT     64      /* 2^64 bytes in a dnode */
  73 
  74 /*
  75  * dnode id flags
  76  *
  77  * Note: a file will never ever have its
  78  * ids moved from bonus->spill
  79  * and only in a crypto environment would it be on spill
  80  */
  81 #define DN_ID_CHKED_BONUS       0x1


 115 
 116 #define EPB(blkshift, typeshift)        (1 << (blkshift - typeshift))
 117 
 118 struct dmu_buf_impl;
 119 struct objset;
 120 struct zio;
 121 
 122 enum dnode_dirtycontext {
 123         DN_UNDIRTIED,
 124         DN_DIRTY_OPEN,
 125         DN_DIRTY_SYNC
 126 };
 127 
 128 /* Is dn_used in bytes?  if not, it's in multiples of SPA_MINBLOCKSIZE */
 129 #define DNODE_FLAG_USED_BYTES           (1<<0)
 130 #define DNODE_FLAG_USERUSED_ACCOUNTED   (1<<1)
 131 
 132 /* Does dnode have a SA spill blkptr in bonus? */
 133 #define DNODE_FLAG_SPILL_BLKPTR (1<<2)
 134 









































 135 typedef struct dnode_phys {
 136         uint8_t dn_type;                /* dmu_object_type_t */
 137         uint8_t dn_indblkshift;         /* ln2(indirect block size) */
 138         uint8_t dn_nlevels;             /* 1=dn_blkptr->data blocks */
 139         uint8_t dn_nblkptr;             /* length of dn_blkptr */
 140         uint8_t dn_bonustype;           /* type of data in bonus buffer */
 141         uint8_t dn_checksum;            /* ZIO_CHECKSUM type */
 142         uint8_t dn_compress;            /* ZIO_COMPRESS type */
 143         uint8_t dn_flags;               /* DNODE_FLAG_* */
 144         uint16_t dn_datablkszsec;       /* data block size in 512b sectors */
 145         uint16_t dn_bonuslen;           /* length of dn_bonus */
 146         uint8_t dn_pad2[4];
 147 
 148         /* accounting is protected by dn_dirty_mtx */
 149         uint64_t dn_maxblkid;           /* largest allocated block ID */
 150         uint64_t dn_used;               /* bytes (or sectors) of disk space */
 151 
 152         uint64_t dn_pad3[4];
 153 
 154         blkptr_t dn_blkptr[1];


 235          */
 236         avl_tree_t dn_dbufs;
 237 
 238         /* protected by dn_struct_rwlock */
 239         struct dmu_buf_impl *dn_bonus;  /* bonus buffer dbuf */
 240 
 241         boolean_t dn_have_spill;        /* have spill or are spilling */
 242 
 243         /* parent IO for current sync write */
 244         zio_t *dn_zio;
 245 
 246         /* used in syncing context */
 247         uint64_t dn_oldused;    /* old phys used bytes */
 248         uint64_t dn_oldflags;   /* old phys dn_flags */
 249         uint64_t dn_olduid, dn_oldgid;
 250         uint64_t dn_newuid, dn_newgid;
 251         int dn_id_flags;
 252 
 253         /* holds prefetch structure */
 254         struct zfetch   dn_zfetch;


 255 };
 256 
 257 /*
 258  * Adds a level of indirection between the dbuf and the dnode to avoid
 259  * iterating descendent dbufs in dnode_move(). Handles are not allocated
 260  * individually, but as an array of child dnodes in dnode_hold_impl().
 261  */
 262 typedef struct dnode_handle {
 263         /* Protects dnh_dnode from modification by dnode_move(). */
 264         zrlock_t dnh_zrlock;
 265         dnode_t *dnh_dnode;
 266 } dnode_handle_t;
 267 
 268 typedef struct dnode_children {
 269         dmu_buf_user_t dnc_dbu;         /* User evict data */
 270         size_t dnc_count;               /* number of children */
 271         dnode_handle_t dnc_children[];  /* sized dynamically */
 272 } dnode_children_t;
 273 
 274 typedef struct free_range {


 276         uint64_t fr_blkid;
 277         uint64_t fr_nblks;
 278 } free_range_t;
 279 
 280 void dnode_special_open(struct objset *dd, dnode_phys_t *dnp,
 281     uint64_t object, dnode_handle_t *dnh);
 282 void dnode_special_close(dnode_handle_t *dnh);
 283 
 284 void dnode_setbonuslen(dnode_t *dn, int newsize, dmu_tx_t *tx);
 285 void dnode_setbonus_type(dnode_t *dn, dmu_object_type_t, dmu_tx_t *tx);
 286 void dnode_rm_spill(dnode_t *dn, dmu_tx_t *tx);
 287 
 288 int dnode_hold(struct objset *dd, uint64_t object,
 289     void *ref, dnode_t **dnp);
 290 int dnode_hold_impl(struct objset *dd, uint64_t object, int flag,
 291     void *ref, dnode_t **dnp);
 292 boolean_t dnode_add_ref(dnode_t *dn, void *ref);
 293 void dnode_rele(dnode_t *dn, void *ref);
 294 void dnode_rele_and_unlock(dnode_t *dn, void *tag);
 295 void dnode_setdirty(dnode_t *dn, dmu_tx_t *tx);

 296 void dnode_sync(dnode_t *dn, dmu_tx_t *tx);
 297 void dnode_allocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, int ibs,
 298     dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx);
 299 void dnode_reallocate(dnode_t *dn, dmu_object_type_t ot, int blocksize,
 300     dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx);
 301 void dnode_free(dnode_t *dn, dmu_tx_t *tx);
 302 void dnode_byteswap(dnode_phys_t *dnp);
 303 void dnode_buf_byteswap(void *buf, size_t size);
 304 void dnode_verify(dnode_t *dn);
 305 int dnode_set_blksz(dnode_t *dn, uint64_t size, int ibs, dmu_tx_t *tx);
 306 void dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx);
 307 void dnode_diduse_space(dnode_t *dn, int64_t space);
 308 void dnode_new_blkid(dnode_t *dn, uint64_t blkid, dmu_tx_t *tx, boolean_t);

 309 uint64_t dnode_block_freed(dnode_t *dn, uint64_t blkid);
 310 void dnode_init(void);
 311 void dnode_fini(void);
 312 int dnode_next_offset(dnode_t *dn, int flags, uint64_t *off,
 313     int minlvl, uint64_t blkfill, uint64_t txg);
 314 void dnode_evict_dbufs(dnode_t *dn);
 315 void dnode_evict_bonus(dnode_t *dn);
 316 boolean_t dnode_needs_remap(const dnode_t *dn);
 317 






 318 #define DNODE_IS_CACHEABLE(_dn)                                         \
 319         ((_dn)->dn_objset->os_primary_cache == ZFS_CACHE_ALL ||           \
 320         (DMU_OT_IS_METADATA((_dn)->dn_type) &&                               \
 321         (_dn)->dn_objset->os_primary_cache == ZFS_CACHE_METADATA))
 322 
 323 #define DNODE_META_IS_CACHEABLE(_dn)                                    \
 324         ((_dn)->dn_objset->os_primary_cache == ZFS_CACHE_ALL ||           \
 325         (_dn)->dn_objset->os_primary_cache == ZFS_CACHE_METADATA)
 326 
 327 #ifdef ZFS_DEBUG
 328 
 329 /*
 330  * There should be a ## between the string literal and fmt, to make it
 331  * clear that we're joining two strings together, but that piece of shit
 332  * gcc doesn't support that preprocessor token.
 333  */
 334 #define dprintf_dnode(dn, fmt, ...) do { \
 335         if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
 336         char __db_buf[32]; \
 337         uint64_t __db_obj = (dn)->dn_object; \




   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
   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  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  24  * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
  25  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
  26  */
  27 
  28 #ifndef _SYS_DNODE_H
  29 #define _SYS_DNODE_H
  30 
  31 #include <sys/zfs_context.h>
  32 #include <sys/avl.h>
  33 #include <sys/spa.h>
  34 #include <sys/txg.h>
  35 #include <sys/zio.h>
  36 #include <sys/refcount.h>
  37 #include <sys/dmu_zfetch.h>
  38 #include <sys/zrlock.h>
  39 #include <sys/multilist.h>
  40 
  41 #ifdef  __cplusplus
  42 extern "C" {
  43 #endif
  44 
  45 /*
  46  * dnode_hold() flags.
  47  */
  48 #define DNODE_MUST_BE_ALLOCATED 1
  49 #define DNODE_MUST_BE_FREE      2
  50 
  51 /*
  52  * dnode_next_offset() flags.
  53  */
  54 #define DNODE_FIND_HOLE         1
  55 #define DNODE_FIND_BACKWARDS    2
  56 #define DNODE_FIND_HAVELOCK     4
  57 
  58 /*
  59  * Fixed constants.
  60  */
  61 #define DNODE_SHIFT             9       /* 512 bytes */
  62 #define DN_MIN_INDBLKSHIFT      12      /* 4k */
  63 #define DN_DFL_INDBLKSHIFT      14      /* 16k */
  64 /*
  65  * If we ever increase this value beyond 20, we need to revisit all logic that
  66  * does x << level * ebps to handle overflow.  With a 1M indirect block size,
  67  * 4 levels of indirect blocks would not be able to guarantee addressing an
  68  * entire object, so 5 levels will be used, but 5 * (20 - 7) = 65.
  69  */
  70 #define DN_MAX_INDBLKSHIFT      17      /* 128k */
  71 #define DNODE_BLOCK_SHIFT       14      /* 16k */
  72 #define DNODE_CORE_SIZE         64      /* 64 bytes for dnode sans blkptrs */
  73 #define DN_MAX_OBJECT_SHIFT     48      /* 256 trillion (zfs_fid_t limit) */
  74 #define DN_MAX_OFFSET_SHIFT     64      /* 2^64 bytes in a dnode */
  75 
  76 /*
  77  * dnode id flags
  78  *
  79  * Note: a file will never ever have its
  80  * ids moved from bonus->spill
  81  * and only in a crypto environment would it be on spill
  82  */
  83 #define DN_ID_CHKED_BONUS       0x1


 117 
 118 #define EPB(blkshift, typeshift)        (1 << (blkshift - typeshift))
 119 
 120 struct dmu_buf_impl;
 121 struct objset;
 122 struct zio;
 123 
 124 enum dnode_dirtycontext {
 125         DN_UNDIRTIED,
 126         DN_DIRTY_OPEN,
 127         DN_DIRTY_SYNC
 128 };
 129 
 130 /* Is dn_used in bytes?  if not, it's in multiples of SPA_MINBLOCKSIZE */
 131 #define DNODE_FLAG_USED_BYTES           (1<<0)
 132 #define DNODE_FLAG_USERUSED_ACCOUNTED   (1<<1)
 133 
 134 /* Does dnode have a SA spill blkptr in bonus? */
 135 #define DNODE_FLAG_SPILL_BLKPTR (1<<2)
 136 
 137 /*
 138  * Smart Compression
 139  *
 140  * Smart compression is a simple heuristic algorithm that automatically
 141  * tries to avoid compression on incompressible objects by continuously
 142  * monitoring per-object compression performance.
 143  *
 144  * The smart compression system has two states for each object:
 145  *      COMPRESSING: compression is applied to the object and results are
 146  *              reevaluated at fixed check intervals to see if we should
 147  *              continue attempting to compress.
 148  *      DENYING: compression has failed too often, so we give up trying
 149  *              for a while and retry at a later time.
 150  *
 151  * Each time compression succeeds, we bump down the sc_compression_failures
 152  * counter down to a minimum of -5. This helps us to prevent starting
 153  * denying in case of short incompressible transients. Each time
 154  * compression fails, we bump up the sc_compression_failures counter up to
 155  * a maximum of 5 (zfs_smartcomp_interval_shift). If the failure counter
 156  * is > 0 at the time the compression failed, we transition from the
 157  * COMPRESSING to the DENYING state and calculate a deny interval by
 158  * multiplying zfs_smartcomp_interval and (1 << sc_compression_failures).
 159  * This means that successive failures at compression will have us retry
 160  * compression progressively less often down to approx 32x less often
 161  * (by default) than the compression test interval. To avoid potential
 162  * data patterns confusing us, the deny interval is randomized by +-10%.
 163  */
 164 typedef enum dnode_smartcomp_state {
 165         DNODE_SMARTCOMP_COMPRESSING = 0,
 166         DNODE_SMARTCOMP_DENYING
 167 } dnode_smartcomp_state_t;
 168 
 169 typedef struct dnode_smartcomp {
 170         kmutex_t                sc_lock;
 171         dnode_smartcomp_state_t sc_state;
 172         uint64_t                sc_size;
 173         uint64_t                sc_orig_size;
 174         uint64_t                sc_deny_interval;
 175         int64_t                 sc_comp_failures;
 176 } dnode_smartcomp_t;
 177 
 178 typedef struct dnode_phys {
 179         uint8_t dn_type;                /* dmu_object_type_t */
 180         uint8_t dn_indblkshift;         /* ln2(indirect block size) */
 181         uint8_t dn_nlevels;             /* 1=dn_blkptr->data blocks */
 182         uint8_t dn_nblkptr;             /* length of dn_blkptr */
 183         uint8_t dn_bonustype;           /* type of data in bonus buffer */
 184         uint8_t dn_checksum;            /* ZIO_CHECKSUM type */
 185         uint8_t dn_compress;            /* ZIO_COMPRESS type */
 186         uint8_t dn_flags;               /* DNODE_FLAG_* */
 187         uint16_t dn_datablkszsec;       /* data block size in 512b sectors */
 188         uint16_t dn_bonuslen;           /* length of dn_bonus */
 189         uint8_t dn_pad2[4];
 190 
 191         /* accounting is protected by dn_dirty_mtx */
 192         uint64_t dn_maxblkid;           /* largest allocated block ID */
 193         uint64_t dn_used;               /* bytes (or sectors) of disk space */
 194 
 195         uint64_t dn_pad3[4];
 196 
 197         blkptr_t dn_blkptr[1];


 278          */
 279         avl_tree_t dn_dbufs;
 280 
 281         /* protected by dn_struct_rwlock */
 282         struct dmu_buf_impl *dn_bonus;  /* bonus buffer dbuf */
 283 
 284         boolean_t dn_have_spill;        /* have spill or are spilling */
 285 
 286         /* parent IO for current sync write */
 287         zio_t *dn_zio;
 288 
 289         /* used in syncing context */
 290         uint64_t dn_oldused;    /* old phys used bytes */
 291         uint64_t dn_oldflags;   /* old phys dn_flags */
 292         uint64_t dn_olduid, dn_oldgid;
 293         uint64_t dn_newuid, dn_newgid;
 294         int dn_id_flags;
 295 
 296         /* holds prefetch structure */
 297         struct zfetch   dn_zfetch;
 298 
 299         dnode_smartcomp_t dn_smartcomp; /* smart compression performance */
 300 };
 301 
 302 /*
 303  * Adds a level of indirection between the dbuf and the dnode to avoid
 304  * iterating descendent dbufs in dnode_move(). Handles are not allocated
 305  * individually, but as an array of child dnodes in dnode_hold_impl().
 306  */
 307 typedef struct dnode_handle {
 308         /* Protects dnh_dnode from modification by dnode_move(). */
 309         zrlock_t dnh_zrlock;
 310         dnode_t *dnh_dnode;
 311 } dnode_handle_t;
 312 
 313 typedef struct dnode_children {
 314         dmu_buf_user_t dnc_dbu;         /* User evict data */
 315         size_t dnc_count;               /* number of children */
 316         dnode_handle_t dnc_children[];  /* sized dynamically */
 317 } dnode_children_t;
 318 
 319 typedef struct free_range {


 321         uint64_t fr_blkid;
 322         uint64_t fr_nblks;
 323 } free_range_t;
 324 
 325 void dnode_special_open(struct objset *dd, dnode_phys_t *dnp,
 326     uint64_t object, dnode_handle_t *dnh);
 327 void dnode_special_close(dnode_handle_t *dnh);
 328 
 329 void dnode_setbonuslen(dnode_t *dn, int newsize, dmu_tx_t *tx);
 330 void dnode_setbonus_type(dnode_t *dn, dmu_object_type_t, dmu_tx_t *tx);
 331 void dnode_rm_spill(dnode_t *dn, dmu_tx_t *tx);
 332 
 333 int dnode_hold(struct objset *dd, uint64_t object,
 334     void *ref, dnode_t **dnp);
 335 int dnode_hold_impl(struct objset *dd, uint64_t object, int flag,
 336     void *ref, dnode_t **dnp);
 337 boolean_t dnode_add_ref(dnode_t *dn, void *ref);
 338 void dnode_rele(dnode_t *dn, void *ref);
 339 void dnode_rele_and_unlock(dnode_t *dn, void *tag);
 340 void dnode_setdirty(dnode_t *dn, dmu_tx_t *tx);
 341 void dnode_setdirty_sc(dnode_t *dn, dmu_tx_t *tx, boolean_t usesc);
 342 void dnode_sync(dnode_t *dn, dmu_tx_t *tx);
 343 void dnode_allocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, int ibs,
 344     dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx);
 345 void dnode_reallocate(dnode_t *dn, dmu_object_type_t ot, int blocksize,
 346     dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx);
 347 void dnode_free(dnode_t *dn, dmu_tx_t *tx);
 348 void dnode_byteswap(dnode_phys_t *dnp);
 349 void dnode_buf_byteswap(void *buf, size_t size);
 350 void dnode_verify(dnode_t *dn);
 351 int dnode_set_blksz(dnode_t *dn, uint64_t size, int ibs, dmu_tx_t *tx);
 352 void dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx);
 353 void dnode_diduse_space(dnode_t *dn, int64_t space);
 354 void dnode_new_blkid(dnode_t *dn, uint64_t blkid, dmu_tx_t *tx,
 355     boolean_t usesc, boolean_t);
 356 uint64_t dnode_block_freed(dnode_t *dn, uint64_t blkid);
 357 void dnode_init(void);
 358 void dnode_fini(void);
 359 int dnode_next_offset(dnode_t *dn, int flags, uint64_t *off,
 360     int minlvl, uint64_t blkfill, uint64_t txg);
 361 void dnode_evict_dbufs(dnode_t *dn, int level);
 362 void dnode_evict_bonus(dnode_t *dn);

 363 
 364 /* Smart compression callbacks (see zio_smartcomp_info_t). */
 365 extern boolean_t dnode_smartcomp_ask_cb(void *userinfo, const zio_t *zio);
 366 extern void dnode_smartcomp_result_cb(void *userinfo, const zio_t *zio);
 367 extern void dnode_setup_zio_smartcomp(struct dmu_buf_impl *db,
 368     zio_smartcomp_info_t *sc);
 369 
 370 #define DNODE_IS_CACHEABLE(_dn)                                         \
 371         ((_dn)->dn_objset->os_primary_cache == ZFS_CACHE_ALL ||           \
 372         (DMU_OT_IS_METADATA((_dn)->dn_type) &&                               \
 373         (_dn)->dn_objset->os_primary_cache == ZFS_CACHE_METADATA))
 374 
 375 #define DNODE_META_IS_CACHEABLE(_dn)                                    \
 376         ((_dn)->dn_objset->os_primary_cache == ZFS_CACHE_ALL ||           \
 377         (_dn)->dn_objset->os_primary_cache == ZFS_CACHE_METADATA)
 378 
 379 #ifdef ZFS_DEBUG
 380 
 381 /*
 382  * There should be a ## between the string literal and fmt, to make it
 383  * clear that we're joining two strings together, but that piece of shit
 384  * gcc doesn't support that preprocessor token.
 385  */
 386 #define dprintf_dnode(dn, fmt, ...) do { \
 387         if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
 388         char __db_buf[32]; \
 389         uint64_t __db_obj = (dn)->dn_object; \