12199Sahrens /* 22199Sahrens * CDDL HEADER START 32199Sahrens * 42199Sahrens * The contents of this file are subject to the terms of the 52199Sahrens * Common Development and Distribution License (the "License"). 62199Sahrens * You may not use this file except in compliance with the License. 72199Sahrens * 82199Sahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 92199Sahrens * or http://www.opensolaris.org/os/licensing. 102199Sahrens * See the License for the specific language governing permissions 112199Sahrens * and limitations under the License. 122199Sahrens * 132199Sahrens * When distributing Covered Code, include this CDDL HEADER in each 142199Sahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 152199Sahrens * If applicable, add the following below this CDDL HEADER, with the 162199Sahrens * fields enclosed by brackets "[]" replaced with your own identifying 172199Sahrens * information: Portions Copyright [yyyy] [name of copyright owner] 182199Sahrens * 192199Sahrens * CDDL HEADER END 202199Sahrens */ 212199Sahrens /* 22*12296SLin.Ling@Sun.COM * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 232199Sahrens */ 242199Sahrens 252199Sahrens #ifndef _SYS_DSL_SYNCTASK_H 262199Sahrens #define _SYS_DSL_SYNCTASK_H 272199Sahrens 282199Sahrens #include <sys/txg.h> 292199Sahrens #include <sys/zfs_context.h> 302199Sahrens 312199Sahrens #ifdef __cplusplus 322199Sahrens extern "C" { 332199Sahrens #endif 342199Sahrens 352199Sahrens struct dsl_pool; 362199Sahrens 372199Sahrens typedef int (dsl_checkfunc_t)(void *, void *, dmu_tx_t *); 38*12296SLin.Ling@Sun.COM typedef void (dsl_syncfunc_t)(void *, void *, dmu_tx_t *); 392199Sahrens 402199Sahrens typedef struct dsl_sync_task { 412199Sahrens list_node_t dst_node; 422199Sahrens dsl_checkfunc_t *dst_checkfunc; 432199Sahrens dsl_syncfunc_t *dst_syncfunc; 442199Sahrens void *dst_arg1; 452199Sahrens void *dst_arg2; 462199Sahrens int dst_err; 472199Sahrens } dsl_sync_task_t; 482199Sahrens 492199Sahrens typedef struct dsl_sync_task_group { 502199Sahrens txg_node_t dstg_node; 512199Sahrens list_t dstg_tasks; 522199Sahrens struct dsl_pool *dstg_pool; 532199Sahrens uint64_t dstg_txg; 542199Sahrens int dstg_err; 552199Sahrens int dstg_space; 564577Sahrens boolean_t dstg_nowaiter; 572199Sahrens } dsl_sync_task_group_t; 582199Sahrens 592199Sahrens dsl_sync_task_group_t *dsl_sync_task_group_create(struct dsl_pool *dp); 602199Sahrens void dsl_sync_task_create(dsl_sync_task_group_t *dstg, 612199Sahrens dsl_checkfunc_t *, dsl_syncfunc_t *, 622199Sahrens void *arg1, void *arg2, int blocks_modified); 632199Sahrens int dsl_sync_task_group_wait(dsl_sync_task_group_t *dstg); 644577Sahrens void dsl_sync_task_group_nowait(dsl_sync_task_group_t *dstg, dmu_tx_t *tx); 652199Sahrens void dsl_sync_task_group_destroy(dsl_sync_task_group_t *dstg); 662199Sahrens void dsl_sync_task_group_sync(dsl_sync_task_group_t *dstg, dmu_tx_t *tx); 672199Sahrens 682199Sahrens int dsl_sync_task_do(struct dsl_pool *dp, 692199Sahrens dsl_checkfunc_t *checkfunc, dsl_syncfunc_t *syncfunc, 702199Sahrens void *arg1, void *arg2, int blocks_modified); 714577Sahrens void dsl_sync_task_do_nowait(struct dsl_pool *dp, 724577Sahrens dsl_checkfunc_t *checkfunc, dsl_syncfunc_t *syncfunc, 734577Sahrens void *arg1, void *arg2, int blocks_modified, dmu_tx_t *tx); 742199Sahrens 752199Sahrens #ifdef __cplusplus 762199Sahrens } 772199Sahrens #endif 782199Sahrens 792199Sahrens #endif /* _SYS_DSL_SYNCTASK_H */ 80