Print this page
4045 zfs write throttle & i/o scheduler performance work
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>


   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) 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2012 by Delphix. All rights reserved.
  24  */
  25 
  26 #ifndef _SYS_SA_IMPL_H
  27 #define _SYS_SA_IMPL_H
  28 
  29 #include <sys/dmu.h>
  30 #include <sys/refcount.h>
  31 #include <sys/list.h>
  32 
  33 /*
  34  * Array of known attributes and their
  35  * various characteristics.
  36  */
  37 typedef struct sa_attr_table {
  38         sa_attr_type_t  sa_attr;
  39         uint8_t sa_registered;
  40         uint16_t sa_length;
  41         sa_bswap_type_t sa_byteswap;
  42         char *sa_name;
  43 } sa_attr_table_t;


 136         kmutex_t        sa_lock;
 137         boolean_t       sa_need_attr_registration;
 138         boolean_t       sa_force_spill;
 139         uint64_t        sa_master_obj;
 140         uint64_t        sa_reg_attr_obj;
 141         uint64_t        sa_layout_attr_obj;
 142         int             sa_num_attrs;
 143         sa_attr_table_t *sa_attr_table;  /* private attr table */
 144         sa_update_cb_t  *sa_update_cb;
 145         avl_tree_t      sa_layout_num_tree;  /* keyed by layout number */
 146         avl_tree_t      sa_layout_hash_tree; /* keyed by layout hash value */
 147         int             sa_user_table_sz;
 148         sa_attr_type_t  *sa_user_table; /* user name->attr mapping table */
 149 };
 150 
 151 /*
 152  * header for all bonus and spill buffers.
 153  *
 154  * The header has a fixed portion with a variable number
 155  * of "lengths" depending on the number of variable sized
 156  * attribues which are determined by the "layout number"
 157  */
 158 
 159 #define SA_MAGIC        0x2F505A  /* ZFS SA */
 160 typedef struct sa_hdr_phys {
 161         uint32_t sa_magic;

 162         /*
 163          * Encoded with hdrsize and layout number as follows:
 164          * 16      10       0
 165          * +--------+-------+
 166          * | hdrsz  |layout |
 167          * +--------+-------+
 168          *
 169          * Bits 0-10 are the layout number
 170          * Bits 11-16 are the size of the header.
 171          * The hdrsize is the number * 8
 172          *
 173          * For example.
 174          * hdrsz of 1 ==> 8 byte header
 175          *          2 ==> 16 byte header
 176          *
 177          */

 178         uint16_t sa_layout_info;
 179         uint16_t sa_lengths[1]; /* optional sizes for variable length attrs */
 180         /* ... Data follows the lengths.  */
 181 } sa_hdr_phys_t;
 182 
 183 #define SA_HDR_LAYOUT_NUM(hdr) BF32_GET(hdr->sa_layout_info, 0, 10)
 184 #define SA_HDR_SIZE(hdr) BF32_GET_SB(hdr->sa_layout_info, 10, 6, 3, 0)
 185 #define SA_HDR_LAYOUT_INFO_ENCODE(x, num, size) \
 186 { \
 187         BF32_SET_SB(x, 10, 6, 3, 0, size); \
 188         BF32_SET(x, 0, 10, num); \
 189 }
 190 
 191 typedef enum sa_buf_type {
 192         SA_BONUS = 1,
 193         SA_SPILL = 2
 194 } sa_buf_type_t;
 195 
 196 typedef enum sa_data_op {
 197         SA_LOOKUP,




   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) 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2013 by Delphix. All rights reserved.
  24  */
  25 
  26 #ifndef _SYS_SA_IMPL_H
  27 #define _SYS_SA_IMPL_H
  28 
  29 #include <sys/dmu.h>
  30 #include <sys/refcount.h>
  31 #include <sys/list.h>
  32 
  33 /*
  34  * Array of known attributes and their
  35  * various characteristics.
  36  */
  37 typedef struct sa_attr_table {
  38         sa_attr_type_t  sa_attr;
  39         uint8_t sa_registered;
  40         uint16_t sa_length;
  41         sa_bswap_type_t sa_byteswap;
  42         char *sa_name;
  43 } sa_attr_table_t;


 136         kmutex_t        sa_lock;
 137         boolean_t       sa_need_attr_registration;
 138         boolean_t       sa_force_spill;
 139         uint64_t        sa_master_obj;
 140         uint64_t        sa_reg_attr_obj;
 141         uint64_t        sa_layout_attr_obj;
 142         int             sa_num_attrs;
 143         sa_attr_table_t *sa_attr_table;  /* private attr table */
 144         sa_update_cb_t  *sa_update_cb;
 145         avl_tree_t      sa_layout_num_tree;  /* keyed by layout number */
 146         avl_tree_t      sa_layout_hash_tree; /* keyed by layout hash value */
 147         int             sa_user_table_sz;
 148         sa_attr_type_t  *sa_user_table; /* user name->attr mapping table */
 149 };
 150 
 151 /*
 152  * header for all bonus and spill buffers.
 153  *
 154  * The header has a fixed portion with a variable number
 155  * of "lengths" depending on the number of variable sized
 156  * attributes which are determined by the "layout number"
 157  */
 158 
 159 #define SA_MAGIC        0x2F505A  /* ZFS SA */
 160 typedef struct sa_hdr_phys {
 161         uint32_t sa_magic;
 162         /* BEGIN CSTYLED */
 163         /*
 164          * Encoded with hdrsize and layout number as follows:
 165          * 16      10       0
 166          * +--------+-------+
 167          * | hdrsz  |layout |
 168          * +--------+-------+
 169          *
 170          * Bits 0-10 are the layout number
 171          * Bits 11-16 are the size of the header.
 172          * The hdrsize is the number * 8
 173          *
 174          * For example.
 175          * hdrsz of 1 ==> 8 byte header
 176          *          2 ==> 16 byte header
 177          *
 178          */
 179         /* END CSTYLED */
 180         uint16_t sa_layout_info;
 181         uint16_t sa_lengths[1]; /* optional sizes for variable length attrs */
 182         /* ... Data follows the lengths.  */
 183 } sa_hdr_phys_t;
 184 
 185 #define SA_HDR_LAYOUT_NUM(hdr) BF32_GET(hdr->sa_layout_info, 0, 10)
 186 #define SA_HDR_SIZE(hdr) BF32_GET_SB(hdr->sa_layout_info, 10, 6, 3, 0)
 187 #define SA_HDR_LAYOUT_INFO_ENCODE(x, num, size) \
 188 { \
 189         BF32_SET_SB(x, 10, 6, 3, 0, size); \
 190         BF32_SET(x, 0, 10, num); \
 191 }
 192 
 193 typedef enum sa_buf_type {
 194         SA_BONUS = 1,
 195         SA_SPILL = 2
 196 } sa_buf_type_t;
 197 
 198 typedef enum sa_data_op {
 199         SA_LOOKUP,