FreeBSD ZFS
The Zettabyte File System

sys/dmu_impl.h

Go to the documentation of this file.
00001 /*
00002  * CDDL HEADER START
00003  *
00004  * The contents of this file are subject to the terms of the
00005  * Common Development and Distribution License (the "License").
00006  * You may not use this file except in compliance with the License.
00007  *
00008  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
00009  * or http://www.opensolaris.org/os/licensing.
00010  * See the License for the specific language governing permissions
00011  * and limitations under the License.
00012  *
00013  * When distributing Covered Code, include this CDDL HEADER in each
00014  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
00015  * If applicable, add the following below this CDDL HEADER, with the
00016  * fields enclosed by brackets "[]" replaced with your own identifying
00017  * information: Portions Copyright [yyyy] [name of copyright owner]
00018  *
00019  * CDDL HEADER END
00020  */
00021 /*
00022  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
00023  * Use is subject to license terms.
00024  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
00025  * Copyright (c) 2012, Martin Matuska <mm@FreeBSD.org>. All rights reserved.
00026  */
00027 
00028 #ifndef _SYS_DMU_IMPL_H
00029 #define _SYS_DMU_IMPL_H
00030 
00031 #include <sys/txg_impl.h>
00032 #include <sys/zio.h>
00033 #include <sys/dnode.h>
00034 #include <sys/kstat.h>
00035 #include <sys/zfs_context.h>
00036 #include <sys/zfs_ioctl.h>
00037 
00038 #ifdef  __cplusplus
00039 extern "C" {
00040 #endif
00041 
00238 struct objset;
00239 struct dmu_pool;
00240 
00241 typedef struct dmu_xuio {
00242         int next;
00243         int cnt;
00244         struct arc_buf **bufs;
00245         iovec_t *iovp;
00246 } dmu_xuio_t;
00247 
00248 typedef struct xuio_stats {
00250         kstat_named_t xuiostat_onloan_rbuf;
00251         kstat_named_t xuiostat_onloan_wbuf;
00253         kstat_named_t xuiostat_rbuf_copied;
00254         kstat_named_t xuiostat_rbuf_nocopy;
00256         kstat_named_t xuiostat_wbuf_copied;
00257         kstat_named_t xuiostat_wbuf_nocopy;
00258 } xuio_stats_t;
00259 
00260 static xuio_stats_t xuio_stats = {
00261         { "onloan_read_buf",    KSTAT_DATA_UINT64 },
00262         { "onloan_write_buf",   KSTAT_DATA_UINT64 },
00263         { "read_buf_copied",    KSTAT_DATA_UINT64 },
00264         { "read_buf_nocopy",    KSTAT_DATA_UINT64 },
00265         { "write_buf_copied",   KSTAT_DATA_UINT64 },
00266         { "write_buf_nocopy",   KSTAT_DATA_UINT64 }
00267 };
00268 
00269 #define XUIOSTAT_INCR(stat, val)        \
00270         atomic_add_64(&xuio_stats.stat.value.ui64, (val))
00271 #define XUIOSTAT_BUMP(stat)     XUIOSTAT_INCR(stat, 1)
00272 
00273 /*
00274  * The list of data whose inclusion in a send stream can be pending from
00275  * one call to backup_cb to another.  Multiple calls to dump_free() and
00276  * dump_freeobjects() can be aggregated into a single DRR_FREE or
00277  * DRR_FREEOBJECTS replay record.
00278  */
00279 typedef enum {
00280         PENDING_NONE,
00281         PENDING_FREE,
00282         PENDING_FREEOBJECTS
00283 } dmu_pendop_t;
00284 
00285 typedef struct dmu_sendarg {
00286         list_node_t dsa_link;
00287         dmu_replay_record_t *dsa_drr;
00288         kthread_t *dsa_td;
00289         struct file *dsa_fp;
00290         int dsa_outfd;
00291         struct proc *dsa_proc;
00292         offset_t *dsa_off;
00293         objset_t *dsa_os;
00294         zio_cksum_t dsa_zc;
00295         uint64_t dsa_toguid;
00296         int dsa_err;
00297         dmu_pendop_t dsa_pending_op;
00298 } dmu_sendarg_t;
00299 
00300 
00301 #ifdef  __cplusplus
00302 }
00303 #endif
00304 
00305 #endif  /* _SYS_DMU_IMPL_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines