kernel: bwrite_common's 3rd & 4th args can be bools
[unleashed.git] / include / sys / fs / ufs_bio.h
blobfef9d2c30f62dc6aafecff5487531d9f06521734
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright (c) 1997,2001 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #ifndef _SYS_FS_UFS_BIO_H
28 #define _SYS_FS_UFS_BIO_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/t_lock.h>
33 #include <sys/kstat.h>
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
40 * Statistics on ufs buffer cache
41 * Not protected by locks
43 struct ufsbiostats {
44 kstat_named_t ub_breads; /* ufs_bread */
45 kstat_named_t ub_bwrites; /* ufs_bwrite and ufs_bwrite2 */
46 kstat_named_t ub_fbiwrites; /* ufs_fbiwrite */
47 kstat_named_t ub_getpages; /* ufs_getpage_miss */
48 kstat_named_t ub_getras; /* ufs_getpage_ra */
49 kstat_named_t ub_putsyncs; /* ufs_putapage (B_SYNC) */
50 kstat_named_t ub_putasyncs; /* ufs_putapage (B_ASYNC) */
51 kstat_named_t ub_pageios; /* ufs_pageios (swap) */
54 extern struct ufsbiostats ub;
56 #if defined(_KERNEL)
59 * let's define macros for the ufs_bio calls (as they were originally
60 * defined name-wise). using these macros to access the appropriate
61 * *_common routines to minimize subroutine calls.
63 extern struct buf *bread_common(void *arg, dev_t dev,
64 daddr_t blkno, long bsize);
65 extern void bwrite_common(void *arg, struct buf *bp, bool force_wait,
66 bool do_relse, int clear_flags);
67 extern struct buf *getblk_common(void * arg, dev_t dev,
68 daddr_t blkno, long bsize, int flag);
70 #define UFS_BREAD(ufsvfsp, dev, blkno, bsize) \
71 bread_common(ufsvfsp, dev, blkno, bsize)
72 #define UFS_BWRITE(ufsvfsp, bp) \
73 bwrite_common(ufsvfsp, bp, false, true, \
74 /* clear_flags */ (B_READ | B_DONE | B_ERROR | B_DELWRI))
75 #define UFS_BRWRITE(ufsvfsp, bp) \
76 (bp)->b_flags |= B_RETRYWRI; \
77 bwrite_common(ufsvfsp, bp, false, true, \
78 /* clear_flags */ (B_READ | B_DONE | B_ERROR | B_DELWRI))
79 #define UFS_BWRITE2(ufsvfsp, bp) \
80 bwrite_common(ufsvfsp, bp, true, false, \
81 /* clear_flags */ (B_READ | B_DONE | B_ERROR | B_DELWRI))
82 #define UFS_GETBLK(ufsvfsp, dev, blkno, bsize) \
83 getblk_common(ufsvfsp, dev, blkno, bsize, /* errflg */ 0)
85 #endif /* defined(_KERNEL) */
87 #ifdef __cplusplus
89 #endif
91 #endif /* _SYS_FS_UFS_BIO_H */