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>


   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 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 /*
  26  * Copyright (c) 2012 by Delphix. All rights reserved.
  27  */
  28 
  29 #ifndef _SYS_DMU_TX_H
  30 #define _SYS_DMU_TX_H
  31 
  32 #include <sys/inttypes.h>
  33 #include <sys/dmu.h>
  34 #include <sys/txg.h>
  35 #include <sys/refcount.h>
  36 
  37 #ifdef  __cplusplus
  38 extern "C" {
  39 #endif
  40 
  41 struct dmu_buf_impl;
  42 struct dmu_tx_hold;
  43 struct dnode_link;
  44 struct dsl_pool;
  45 struct dnode;
  46 struct dsl_dir;
  47 
  48 struct dmu_tx {
  49         /*
  50          * No synchronization is needed because a tx can only be handled
  51          * by one thread.
  52          */
  53         list_t tx_holds; /* list of dmu_tx_hold_t */
  54         objset_t *tx_objset;
  55         struct dsl_dir *tx_dir;
  56         struct dsl_pool *tx_pool;
  57         uint64_t tx_txg;
  58         uint64_t tx_lastsnap_txg;
  59         uint64_t tx_lasttried_txg;
  60         txg_handle_t tx_txgh;
  61         void *tx_tempreserve_cookie;
  62         struct dmu_tx_hold *tx_needassign_txh;
  63         list_t tx_callbacks; /* list of dmu_tx_callback_t on this dmu_tx */
  64         uint8_t tx_anyobj;














  65         int tx_err;
  66 #ifdef ZFS_DEBUG
  67         uint64_t tx_space_towrite;
  68         uint64_t tx_space_tofree;
  69         uint64_t tx_space_tooverwrite;
  70         uint64_t tx_space_tounref;
  71         refcount_t tx_space_written;
  72         refcount_t tx_space_freed;
  73 #endif
  74 };
  75 
  76 enum dmu_tx_hold_type {
  77         THT_NEWOBJECT,
  78         THT_WRITE,
  79         THT_BONUS,
  80         THT_FREE,
  81         THT_ZAP,
  82         THT_SPACE,
  83         THT_SPILL,
  84         THT_NUMTYPES




   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 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 /*
  26  * Copyright (c) 2013 by Delphix. All rights reserved.
  27  */
  28 
  29 #ifndef _SYS_DMU_TX_H
  30 #define _SYS_DMU_TX_H
  31 
  32 #include <sys/inttypes.h>
  33 #include <sys/dmu.h>
  34 #include <sys/txg.h>
  35 #include <sys/refcount.h>
  36 
  37 #ifdef  __cplusplus
  38 extern "C" {
  39 #endif
  40 
  41 struct dmu_buf_impl;
  42 struct dmu_tx_hold;
  43 struct dnode_link;
  44 struct dsl_pool;
  45 struct dnode;
  46 struct dsl_dir;
  47 
  48 struct dmu_tx {
  49         /*
  50          * No synchronization is needed because a tx can only be handled
  51          * by one thread.
  52          */
  53         list_t tx_holds; /* list of dmu_tx_hold_t */
  54         objset_t *tx_objset;
  55         struct dsl_dir *tx_dir;
  56         struct dsl_pool *tx_pool;
  57         uint64_t tx_txg;
  58         uint64_t tx_lastsnap_txg;
  59         uint64_t tx_lasttried_txg;
  60         txg_handle_t tx_txgh;
  61         void *tx_tempreserve_cookie;
  62         struct dmu_tx_hold *tx_needassign_txh;
  63 
  64         /* list of dmu_tx_callback_t on this dmu_tx */
  65         list_t tx_callbacks;
  66 
  67         /* placeholder for syncing context, doesn't need specific holds */
  68         boolean_t tx_anyobj;
  69 
  70         /* has this transaction already been delayed? */
  71         boolean_t tx_waited;
  72 
  73         /* time this transaction was created */
  74         hrtime_t tx_start;
  75 
  76         /* need to wait for sufficient dirty space */
  77         boolean_t tx_wait_dirty;
  78 
  79         int tx_err;
  80 #ifdef ZFS_DEBUG
  81         uint64_t tx_space_towrite;
  82         uint64_t tx_space_tofree;
  83         uint64_t tx_space_tooverwrite;
  84         uint64_t tx_space_tounref;
  85         refcount_t tx_space_written;
  86         refcount_t tx_space_freed;
  87 #endif
  88 };
  89 
  90 enum dmu_tx_hold_type {
  91         THT_NEWOBJECT,
  92         THT_WRITE,
  93         THT_BONUS,
  94         THT_FREE,
  95         THT_ZAP,
  96         THT_SPACE,
  97         THT_SPILL,
  98         THT_NUMTYPES