Print this page
3525 Persistent L2ARC


   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 by Delphix. All rights reserved.
  24  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.

  25  */
  26 
  27 #ifndef _SYS_SPA_H
  28 #define _SYS_SPA_H
  29 
  30 #include <sys/avl.h>
  31 #include <sys/zfs_context.h>
  32 #include <sys/nvpair.h>
  33 #include <sys/sysmacros.h>
  34 #include <sys/types.h>
  35 #include <sys/fs/zfs.h>
  36 
  37 #ifdef  __cplusplus
  38 extern "C" {
  39 #endif
  40 
  41 /*
  42  * Forward references that lots of things need.
  43  */
  44 typedef struct spa spa_t;


 275         (DVA_GET_GANG(&(bp)->blk_dva[0]) + \
 276         DVA_GET_GANG(&(bp)->blk_dva[1]) + \
 277         DVA_GET_GANG(&(bp)->blk_dva[2]))
 278 
 279 #define DVA_EQUAL(dva1, dva2)   \
 280         ((dva1)->dva_word[1] == (dva2)->dva_word[1] && \
 281         (dva1)->dva_word[0] == (dva2)->dva_word[0])
 282 
 283 #define BP_EQUAL(bp1, bp2)      \
 284         (BP_PHYSICAL_BIRTH(bp1) == BP_PHYSICAL_BIRTH(bp2) &&    \
 285         DVA_EQUAL(&(bp1)->blk_dva[0], &(bp2)->blk_dva[0]) &&      \
 286         DVA_EQUAL(&(bp1)->blk_dva[1], &(bp2)->blk_dva[1]) &&      \
 287         DVA_EQUAL(&(bp1)->blk_dva[2], &(bp2)->blk_dva[2]))
 288 
 289 #define ZIO_CHECKSUM_EQUAL(zc1, zc2) \
 290         (0 == (((zc1).zc_word[0] - (zc2).zc_word[0]) | \
 291         ((zc1).zc_word[1] - (zc2).zc_word[1]) | \
 292         ((zc1).zc_word[2] - (zc2).zc_word[2]) | \
 293         ((zc1).zc_word[3] - (zc2).zc_word[3])))
 294 











 295 #define DVA_IS_VALID(dva)       (DVA_GET_ASIZE(dva) != 0)
 296 
 297 #define ZIO_SET_CHECKSUM(zcp, w0, w1, w2, w3)   \
 298 {                                               \
 299         (zcp)->zc_word[0] = w0;                      \
 300         (zcp)->zc_word[1] = w1;                      \
 301         (zcp)->zc_word[2] = w2;                      \
 302         (zcp)->zc_word[3] = w3;                      \
 303 }
 304 
 305 #define BP_IDENTITY(bp)         (&(bp)->blk_dva[0])
 306 #define BP_IS_GANG(bp)          DVA_GET_GANG(BP_IDENTITY(bp))
 307 #define BP_IS_HOLE(bp)          ((bp)->blk_birth == 0)
 308 
 309 /* BP_IS_RAIDZ(bp) assumes no block compression */
 310 #define BP_IS_RAIDZ(bp)         (DVA_GET_ASIZE(&(bp)->blk_dva[0]) > \
 311                                 BP_GET_PSIZE(bp))
 312 
 313 #define BP_ZERO(bp)                             \
 314 {                                               \




   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 by Delphix. All rights reserved.
  24  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  25  * Copyright 2013 Saso Kiselkov. All rights reserved.
  26  */
  27 
  28 #ifndef _SYS_SPA_H
  29 #define _SYS_SPA_H
  30 
  31 #include <sys/avl.h>
  32 #include <sys/zfs_context.h>
  33 #include <sys/nvpair.h>
  34 #include <sys/sysmacros.h>
  35 #include <sys/types.h>
  36 #include <sys/fs/zfs.h>
  37 
  38 #ifdef  __cplusplus
  39 extern "C" {
  40 #endif
  41 
  42 /*
  43  * Forward references that lots of things need.
  44  */
  45 typedef struct spa spa_t;


 276         (DVA_GET_GANG(&(bp)->blk_dva[0]) + \
 277         DVA_GET_GANG(&(bp)->blk_dva[1]) + \
 278         DVA_GET_GANG(&(bp)->blk_dva[2]))
 279 
 280 #define DVA_EQUAL(dva1, dva2)   \
 281         ((dva1)->dva_word[1] == (dva2)->dva_word[1] && \
 282         (dva1)->dva_word[0] == (dva2)->dva_word[0])
 283 
 284 #define BP_EQUAL(bp1, bp2)      \
 285         (BP_PHYSICAL_BIRTH(bp1) == BP_PHYSICAL_BIRTH(bp2) &&    \
 286         DVA_EQUAL(&(bp1)->blk_dva[0], &(bp2)->blk_dva[0]) &&      \
 287         DVA_EQUAL(&(bp1)->blk_dva[1], &(bp2)->blk_dva[1]) &&      \
 288         DVA_EQUAL(&(bp1)->blk_dva[2], &(bp2)->blk_dva[2]))
 289 
 290 #define ZIO_CHECKSUM_EQUAL(zc1, zc2) \
 291         (0 == (((zc1).zc_word[0] - (zc2).zc_word[0]) | \
 292         ((zc1).zc_word[1] - (zc2).zc_word[1]) | \
 293         ((zc1).zc_word[2] - (zc2).zc_word[2]) | \
 294         ((zc1).zc_word[3] - (zc2).zc_word[3])))
 295 
 296 #define ZIO_CHECKSUM_BSWAP(_zc) \
 297         do { \
 298                 zio_cksum_t *zc = (_zc); \
 299                 zc->zc_word[0] = BSWAP_64(zc->zc_word[0]); \
 300                 zc->zc_word[1] = BSWAP_64(zc->zc_word[1]); \
 301                 zc->zc_word[2] = BSWAP_64(zc->zc_word[2]); \
 302                 zc->zc_word[3] = BSWAP_64(zc->zc_word[3]); \
 303                 _NOTE(NOTREACHED) \
 304                 _NOTE(CONSTCOND) \
 305         } while (0)
 306 
 307 #define DVA_IS_VALID(dva)       (DVA_GET_ASIZE(dva) != 0)
 308 
 309 #define ZIO_SET_CHECKSUM(zcp, w0, w1, w2, w3)   \
 310 {                                               \
 311         (zcp)->zc_word[0] = w0;                      \
 312         (zcp)->zc_word[1] = w1;                      \
 313         (zcp)->zc_word[2] = w2;                      \
 314         (zcp)->zc_word[3] = w3;                      \
 315 }
 316 
 317 #define BP_IDENTITY(bp)         (&(bp)->blk_dva[0])
 318 #define BP_IS_GANG(bp)          DVA_GET_GANG(BP_IDENTITY(bp))
 319 #define BP_IS_HOLE(bp)          ((bp)->blk_birth == 0)
 320 
 321 /* BP_IS_RAIDZ(bp) assumes no block compression */
 322 #define BP_IS_RAIDZ(bp)         (DVA_GET_ASIZE(&(bp)->blk_dva[0]) > \
 323                                 BP_GET_PSIZE(bp))
 324 
 325 #define BP_ZERO(bp)                             \
 326 {                                               \