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 2011 Nexenta Systems, Inc. All rights reserved.
24 * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
25 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
26 */
27
28 #ifndef _SYS_ZFS_CONTEXT_H
29 #define _SYS_ZFS_CONTEXT_H
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #define _SYS_MUTEX_H
36 #define _SYS_RWLOCK_H
37 #define _SYS_CONDVAR_H
38 #define _SYS_SYSTM_H
39 #define _SYS_T_LOCK_H
40 #define _SYS_VNODE_H
41 #define _SYS_VFS_H
42 #define _SYS_SUNDDI_H
43 #define _SYS_CALLB_H
44
45 #include <stdio.h>
316 extern void kstat_runq_back_to_waitq(kstat_io_t *);
317
318 /*
319 * Kernel memory
320 */
321 #define KM_SLEEP UMEM_NOFAIL
322 #define KM_PUSHPAGE KM_SLEEP
323 #define KM_NOSLEEP UMEM_DEFAULT
324 #define KM_NORMALPRI 0 /* not needed with UMEM_DEFAULT */
325 #define KMC_NODEBUG UMC_NODEBUG
326 #define KMC_NOTOUCH 0 /* not needed for userland caches */
327 #define kmem_alloc(_s, _f) umem_alloc(_s, _f)
328 #define kmem_zalloc(_s, _f) umem_zalloc(_s, _f)
329 #define kmem_free(_b, _s) umem_free(_b, _s)
330 #define kmem_cache_create(_a, _b, _c, _d, _e, _f, _g, _h, _i) \
331 umem_cache_create(_a, _b, _c, _d, _e, _f, _g, _h, _i)
332 #define kmem_cache_destroy(_c) umem_cache_destroy(_c)
333 #define kmem_cache_alloc(_c, _f) umem_cache_alloc(_c, _f)
334 #define kmem_cache_free(_c, _b) umem_cache_free(_c, _b)
335 #define kmem_debugging() 0
336 #define kmem_cache_reap_now(_c) /* nothing */
337 #define kmem_cache_set_move(_c, _cb) /* nothing */
338 #define vmem_qcache_reap(_v) /* nothing */
339 #define POINTER_INVALIDATE(_pp) /* nothing */
340 #define POINTER_IS_VALID(_p) 0
341
342 extern vmem_t *zio_arena;
343
344 typedef umem_cache_t kmem_cache_t;
345
346 typedef enum kmem_cbrc {
347 KMEM_CBRC_YES,
348 KMEM_CBRC_NO,
349 KMEM_CBRC_LATER,
350 KMEM_CBRC_DONT_NEED,
351 KMEM_CBRC_DONT_KNOW
352 } kmem_cbrc_t;
353
354 /*
355 * Task queues
356 */
374 #define TASKQ_THREADS_CPU_PCT 0x0008 /* Scale # threads by # cpus */
375 #define TASKQ_DC_BATCH 0x0010 /* Mark threads as batch */
376
377 #define TQ_SLEEP KM_SLEEP /* Can block for memory */
378 #define TQ_NOSLEEP KM_NOSLEEP /* cannot block for memory; may fail */
379 #define TQ_NOQUEUE 0x02 /* Do not enqueue if can't dispatch */
380 #define TQ_FRONT 0x08 /* Queue in front */
381
382
383 extern taskq_t *system_taskq;
384
385 extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t);
386 #define taskq_create_proc(a, b, c, d, e, p, f) \
387 (taskq_create(a, b, c, d, e, f))
388 #define taskq_create_sysdc(a, b, d, e, p, dc, f) \
389 (taskq_create(a, b, maxclsyspri, d, e, f))
390 extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t);
391 extern void taskq_dispatch_ent(taskq_t *, task_func_t, void *, uint_t,
392 taskq_ent_t *);
393 extern void taskq_destroy(taskq_t *);
394 extern void taskq_wait(taskq_t *);
395 extern int taskq_member(taskq_t *, void *);
396 extern void system_taskq_init(void);
397 extern void system_taskq_fini(void);
398
399 #define XVA_MAPSIZE 3
400 #define XVA_MAGIC 0x78766174
401
402 /*
403 * vnodes
404 */
405 typedef struct vnode {
406 uint64_t v_size;
407 int v_fd;
408 char *v_path;
409 int v_dump_fd;
410 } vnode_t;
411
412 extern char *vn_dumpdir;
413 #define AV_SCANSTAMP_SZ 32 /* length of anti-virus scanstamp */
|
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 2011 Nexenta Systems, Inc. All rights reserved.
24 * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
25 * Copyright (c) 2017, Joyent, Inc. All rights reserved.
26 */
27
28 #ifndef _SYS_ZFS_CONTEXT_H
29 #define _SYS_ZFS_CONTEXT_H
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #define _SYS_MUTEX_H
36 #define _SYS_RWLOCK_H
37 #define _SYS_CONDVAR_H
38 #define _SYS_SYSTM_H
39 #define _SYS_T_LOCK_H
40 #define _SYS_VNODE_H
41 #define _SYS_VFS_H
42 #define _SYS_SUNDDI_H
43 #define _SYS_CALLB_H
44
45 #include <stdio.h>
316 extern void kstat_runq_back_to_waitq(kstat_io_t *);
317
318 /*
319 * Kernel memory
320 */
321 #define KM_SLEEP UMEM_NOFAIL
322 #define KM_PUSHPAGE KM_SLEEP
323 #define KM_NOSLEEP UMEM_DEFAULT
324 #define KM_NORMALPRI 0 /* not needed with UMEM_DEFAULT */
325 #define KMC_NODEBUG UMC_NODEBUG
326 #define KMC_NOTOUCH 0 /* not needed for userland caches */
327 #define kmem_alloc(_s, _f) umem_alloc(_s, _f)
328 #define kmem_zalloc(_s, _f) umem_zalloc(_s, _f)
329 #define kmem_free(_b, _s) umem_free(_b, _s)
330 #define kmem_cache_create(_a, _b, _c, _d, _e, _f, _g, _h, _i) \
331 umem_cache_create(_a, _b, _c, _d, _e, _f, _g, _h, _i)
332 #define kmem_cache_destroy(_c) umem_cache_destroy(_c)
333 #define kmem_cache_alloc(_c, _f) umem_cache_alloc(_c, _f)
334 #define kmem_cache_free(_c, _b) umem_cache_free(_c, _b)
335 #define kmem_debugging() 0
336 #define kmem_cache_reap_active() (B_FALSE)
337 #define kmem_cache_reap_soon(_c) /* nothing */
338 #define kmem_cache_set_move(_c, _cb) /* nothing */
339 #define vmem_qcache_reap(_v) /* nothing */
340 #define POINTER_INVALIDATE(_pp) /* nothing */
341 #define POINTER_IS_VALID(_p) 0
342
343 extern vmem_t *zio_arena;
344
345 typedef umem_cache_t kmem_cache_t;
346
347 typedef enum kmem_cbrc {
348 KMEM_CBRC_YES,
349 KMEM_CBRC_NO,
350 KMEM_CBRC_LATER,
351 KMEM_CBRC_DONT_NEED,
352 KMEM_CBRC_DONT_KNOW
353 } kmem_cbrc_t;
354
355 /*
356 * Task queues
357 */
375 #define TASKQ_THREADS_CPU_PCT 0x0008 /* Scale # threads by # cpus */
376 #define TASKQ_DC_BATCH 0x0010 /* Mark threads as batch */
377
378 #define TQ_SLEEP KM_SLEEP /* Can block for memory */
379 #define TQ_NOSLEEP KM_NOSLEEP /* cannot block for memory; may fail */
380 #define TQ_NOQUEUE 0x02 /* Do not enqueue if can't dispatch */
381 #define TQ_FRONT 0x08 /* Queue in front */
382
383
384 extern taskq_t *system_taskq;
385
386 extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t);
387 #define taskq_create_proc(a, b, c, d, e, p, f) \
388 (taskq_create(a, b, c, d, e, f))
389 #define taskq_create_sysdc(a, b, d, e, p, dc, f) \
390 (taskq_create(a, b, maxclsyspri, d, e, f))
391 extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t);
392 extern void taskq_dispatch_ent(taskq_t *, task_func_t, void *, uint_t,
393 taskq_ent_t *);
394 extern void taskq_destroy(taskq_t *);
395 extern boolean_t taskq_empty(taskq_t *);
396 extern void taskq_wait(taskq_t *);
397 extern int taskq_member(taskq_t *, void *);
398 extern void system_taskq_init(void);
399 extern void system_taskq_fini(void);
400
401 #define XVA_MAPSIZE 3
402 #define XVA_MAGIC 0x78766174
403
404 /*
405 * vnodes
406 */
407 typedef struct vnode {
408 uint64_t v_size;
409 int v_fd;
410 char *v_path;
411 int v_dump_fd;
412 } vnode_t;
413
414 extern char *vn_dumpdir;
415 #define AV_SCANSTAMP_SZ 32 /* length of anti-virus scanstamp */
|