move some buffer cache internals declarations from buf.h to vfs_bio.c. this is needed to avoid name conflicts with ZFS and also makes it clearer that other code shouldn't be messing with these. remove the LFS debug code that poked around in bufqueues and remove the BQ_EMPTY bufqueue since nothing uses it anymore. provide a function to let LFS and wapbl read the value of nbuf for now.diff -r1.273 -r1.274 src/sys/kern/vfs_bio.c
(chs)
--- src/sys/kern/vfs_bio.c 2017/05/25 02:28:07 1.273
+++ src/sys/kern/vfs_bio.c 2017/06/08 01:23:01 1.274
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: vfs_bio.c,v 1.273 2017/05/25 02:28:07 pgoyette Exp $ */ | 1 | /* $NetBSD: vfs_bio.c,v 1.274 2017/06/08 01:23:01 chs Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Andrew Doran, and by Wasabi Systems, Inc. | 8 | * by Andrew Doran, and by Wasabi Systems, Inc. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -113,27 +113,27 @@ | @@ -113,27 +113,27 @@ | |||
113 | * - bufcache_lock: protects global buffer cache state. | 113 | * - bufcache_lock: protects global buffer cache state. | |
114 | * - BC_BUSY: a long term per-buffer lock. | 114 | * - BC_BUSY: a long term per-buffer lock. | |
115 | * - buf_t::b_objlock: lock on completion (biowait vs biodone). | 115 | * - buf_t::b_objlock: lock on completion (biowait vs biodone). | |
116 | * | 116 | * | |
117 | * For buffers associated with vnodes (a most common case) b_objlock points | 117 | * For buffers associated with vnodes (a most common case) b_objlock points | |
118 | * to the vnode_t::v_interlock. Otherwise, it points to generic buffer_lock. | 118 | * to the vnode_t::v_interlock. Otherwise, it points to generic buffer_lock. | |
119 | * | 119 | * | |
120 | * Lock order: | 120 | * Lock order: | |
121 | * bufcache_lock -> | 121 | * bufcache_lock -> | |
122 | * buf_t::b_objlock | 122 | * buf_t::b_objlock | |
123 | */ | 123 | */ | |
124 | 124 | |||
125 | #include <sys/cdefs.h> | 125 | #include <sys/cdefs.h> | |
126 | __KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.273 2017/05/25 02:28:07 pgoyette Exp $"); | 126 | __KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.274 2017/06/08 01:23:01 chs Exp $"); | |
127 | 127 | |||
128 | #ifdef _KERNEL_OPT | 128 | #ifdef _KERNEL_OPT | |
129 | #include "opt_bufcache.h" | 129 | #include "opt_bufcache.h" | |
130 | #include "opt_dtrace.h" | 130 | #include "opt_dtrace.h" | |
131 | #include "opt_biohist.h" | 131 | #include "opt_biohist.h" | |
132 | #endif | 132 | #endif | |
133 | 133 | |||
134 | #include <sys/param.h> | 134 | #include <sys/param.h> | |
135 | #include <sys/systm.h> | 135 | #include <sys/systm.h> | |
136 | #include <sys/kernel.h> | 136 | #include <sys/kernel.h> | |
137 | #include <sys/proc.h> | 137 | #include <sys/proc.h> | |
138 | #include <sys/buf.h> | 138 | #include <sys/buf.h> | |
139 | #include <sys/vnode.h> | 139 | #include <sys/vnode.h> | |
@@ -160,29 +160,43 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v | @@ -160,29 +160,43 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v | |||
160 | 160 | |||
161 | #ifdef BUFCACHE | 161 | #ifdef BUFCACHE | |
162 | # if (BUFCACHE < 5) || (BUFCACHE > 95) | 162 | # if (BUFCACHE < 5) || (BUFCACHE > 95) | |
163 | # error BUFCACHE is not between 5 and 95 | 163 | # error BUFCACHE is not between 5 and 95 | |
164 | # endif | 164 | # endif | |
165 | #else | 165 | #else | |
166 | # define BUFCACHE 15 | 166 | # define BUFCACHE 15 | |
167 | #endif | 167 | #endif | |
168 | 168 | |||
169 | u_int nbuf; /* desired number of buffer headers */ | 169 | u_int nbuf; /* desired number of buffer headers */ | |
170 | u_int bufpages = BUFPAGES; /* optional hardwired count */ | 170 | u_int bufpages = BUFPAGES; /* optional hardwired count */ | |
171 | u_int bufcache = BUFCACHE; /* max % of RAM to use for buffer cache */ | 171 | u_int bufcache = BUFCACHE; /* max % of RAM to use for buffer cache */ | |
172 | 172 | |||
173 | /* Function prototypes */ | 173 | /* | |
174 | struct bqueue; | 174 | * Definitions for the buffer free lists. | |
175 | */ | |||
176 | #define BQUEUES 3 /* number of free buffer queues */ | |||
175 | 177 | |||
178 | #define BQ_LOCKED 0 /* super-blocks &c */ | |||
179 | #define BQ_LRU 1 /* lru, useful buffers */ | |||
180 | #define BQ_AGE 2 /* rubbish */ | |||
181 | ||||
182 | struct bqueue { | |||
183 | TAILQ_HEAD(, buf) bq_queue; | |||
184 | uint64_t bq_bytes; | |||
185 | buf_t *bq_marker; | |||
186 | }; | |||
187 | static struct bqueue bufqueues[BQUEUES]; | |||
188 | ||||
189 | /* Function prototypes */ | |||
176 | static void buf_setwm(void); | 190 | static void buf_setwm(void); | |
177 | static int buf_trim(void); | 191 | static int buf_trim(void); | |
178 | static void *bufpool_page_alloc(struct pool *, int); | 192 | static void *bufpool_page_alloc(struct pool *, int); | |
179 | static void bufpool_page_free(struct pool *, void *); | 193 | static void bufpool_page_free(struct pool *, void *); | |
180 | static buf_t *bio_doread(struct vnode *, daddr_t, int, int); | 194 | static buf_t *bio_doread(struct vnode *, daddr_t, int, int); | |
181 | static buf_t *getnewbuf(int, int, int); | 195 | static buf_t *getnewbuf(int, int, int); | |
182 | static int buf_lotsfree(void); | 196 | static int buf_lotsfree(void); | |
183 | static int buf_canrelease(void); | 197 | static int buf_canrelease(void); | |
184 | static u_long buf_mempoolidx(u_long); | 198 | static u_long buf_mempoolidx(u_long); | |
185 | static u_long buf_roundsize(u_long); | 199 | static u_long buf_roundsize(u_long); | |
186 | static void *buf_alloc(size_t); | 200 | static void *buf_alloc(size_t); | |
187 | static void buf_mrelease(void *, size_t); | 201 | static void buf_mrelease(void *, size_t); | |
188 | static void binsheadfree(buf_t *, struct bqueue *); | 202 | static void binsheadfree(buf_t *, struct bqueue *); | |
@@ -207,27 +221,26 @@ void | @@ -207,27 +221,26 @@ void | |||
207 | biohist_init(void) | 221 | biohist_init(void) | |
208 | { | 222 | { | |
209 | 223 | |||
210 | BIOHIST_INIT(biohist, BIOHIST_SIZE); | 224 | BIOHIST_INIT(biohist, BIOHIST_SIZE); | |
211 | } | 225 | } | |
212 | 226 | |||
213 | /* | 227 | /* | |
214 | * Definitions for the buffer hash lists. | 228 | * Definitions for the buffer hash lists. | |
215 | */ | 229 | */ | |
216 | #define BUFHASH(dvp, lbn) \ | 230 | #define BUFHASH(dvp, lbn) \ | |
217 | (&bufhashtbl[(((long)(dvp) >> 8) + (int)(lbn)) & bufhash]) | 231 | (&bufhashtbl[(((long)(dvp) >> 8) + (int)(lbn)) & bufhash]) | |
218 | LIST_HEAD(bufhashhdr, buf) *bufhashtbl, invalhash; | 232 | LIST_HEAD(bufhashhdr, buf) *bufhashtbl, invalhash; | |
219 | u_long bufhash; | 233 | u_long bufhash; | |
220 | struct bqueue bufqueues[BQUEUES]; | |||
221 | 234 | |||
222 | static kcondvar_t needbuffer_cv; | 235 | static kcondvar_t needbuffer_cv; | |
223 | 236 | |||
224 | /* | 237 | /* | |
225 | * Buffer queue lock. | 238 | * Buffer queue lock. | |
226 | */ | 239 | */ | |
227 | kmutex_t bufcache_lock; | 240 | kmutex_t bufcache_lock; | |
228 | kmutex_t buffer_lock; | 241 | kmutex_t buffer_lock; | |
229 | 242 | |||
230 | /* Software ISR for completed transfers. */ | 243 | /* Software ISR for completed transfers. */ | |
231 | static void *biodone_sih; | 244 | static void *biodone_sih; | |
232 | 245 | |||
233 | /* Buffer pool for I/O buffers. */ | 246 | /* Buffer pool for I/O buffers. */ | |
@@ -2126,13 +2139,24 @@ bbusy(buf_t *bp, bool intr, int timo, km | @@ -2126,13 +2139,24 @@ bbusy(buf_t *bp, bool intr, int timo, km | |||
2126 | timo); | 2139 | timo); | |
2127 | } | 2140 | } | |
2128 | brele(bp); | 2141 | brele(bp); | |
2129 | if (interlock != NULL) | 2142 | if (interlock != NULL) | |
2130 | mutex_enter(interlock); | 2143 | mutex_enter(interlock); | |
2131 | if (error != 0) | 2144 | if (error != 0) | |
2132 | return error; | 2145 | return error; | |
2133 | return EPASSTHROUGH; | 2146 | return EPASSTHROUGH; | |
2134 | } | 2147 | } | |
2135 | bp->b_cflags |= BC_BUSY; | 2148 | bp->b_cflags |= BC_BUSY; | |
2136 | 2149 | |||
2137 | return 0; | 2150 | return 0; | |
2138 | } | 2151 | } | |
2152 | ||||
2153 | /* | |||
2154 | * Nothing outside this file should really need to know about nbuf, | |||
2155 | * but a few things still want to read it, so give them a way to do that. | |||
2156 | */ | |||
2157 | int | |||
2158 | buf_nbuf(void) | |||
2159 | { | |||
2160 | ||||
2161 | return nbuf; | |||
2162 | } |
--- src/sys/kern/vfs_wapbl.c 2017/04/10 21:36:05 1.96
+++ src/sys/kern/vfs_wapbl.c 2017/06/08 01:23:01 1.97
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: vfs_wapbl.c,v 1.96 2017/04/10 21:36:05 jdolecek Exp $ */ | 1 | /* $NetBSD: vfs_wapbl.c,v 1.97 2017/06/08 01:23:01 chs Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Wasabi Systems, Inc. | 8 | * by Wasabi Systems, Inc. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -26,27 +26,27 @@ | @@ -26,27 +26,27 @@ | |||
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | /* | 32 | /* | |
33 | * This implements file system independent write ahead filesystem logging. | 33 | * This implements file system independent write ahead filesystem logging. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #define WAPBL_INTERNAL | 36 | #define WAPBL_INTERNAL | |
37 | 37 | |||
38 | #include <sys/cdefs.h> | 38 | #include <sys/cdefs.h> | |
39 | __KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.96 2017/04/10 21:36:05 jdolecek Exp $"); | 39 | __KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.97 2017/06/08 01:23:01 chs Exp $"); | |
40 | 40 | |||
41 | #include <sys/param.h> | 41 | #include <sys/param.h> | |
42 | #include <sys/bitops.h> | 42 | #include <sys/bitops.h> | |
43 | #include <sys/time.h> | 43 | #include <sys/time.h> | |
44 | #include <sys/wapbl.h> | 44 | #include <sys/wapbl.h> | |
45 | #include <sys/wapbl_replay.h> | 45 | #include <sys/wapbl_replay.h> | |
46 | 46 | |||
47 | #ifdef _KERNEL | 47 | #ifdef _KERNEL | |
48 | 48 | |||
49 | #include <sys/atomic.h> | 49 | #include <sys/atomic.h> | |
50 | #include <sys/conf.h> | 50 | #include <sys/conf.h> | |
51 | #include <sys/evcnt.h> | 51 | #include <sys/evcnt.h> | |
52 | #include <sys/file.h> | 52 | #include <sys/file.h> | |
@@ -602,27 +602,27 @@ wapbl_start(struct wapbl ** wlp, struct | @@ -602,27 +602,27 @@ wapbl_start(struct wapbl ** wlp, struct | |||
602 | /* XXX fix actual number of pages reserved per filesystem. */ | 602 | /* XXX fix actual number of pages reserved per filesystem. */ | |
603 | wl->wl_bufbytes_max = MIN(wl->wl_circ_size, buf_memcalc() / 2); | 603 | wl->wl_bufbytes_max = MIN(wl->wl_circ_size, buf_memcalc() / 2); | |
604 | 604 | |||
605 | /* Round wl_bufbytes_max to the largest power of two constraint */ | 605 | /* Round wl_bufbytes_max to the largest power of two constraint */ | |
606 | wl->wl_bufbytes_max >>= PAGE_SHIFT; | 606 | wl->wl_bufbytes_max >>= PAGE_SHIFT; | |
607 | wl->wl_bufbytes_max <<= PAGE_SHIFT; | 607 | wl->wl_bufbytes_max <<= PAGE_SHIFT; | |
608 | wl->wl_bufbytes_max >>= wl->wl_log_dev_bshift; | 608 | wl->wl_bufbytes_max >>= wl->wl_log_dev_bshift; | |
609 | wl->wl_bufbytes_max <<= wl->wl_log_dev_bshift; | 609 | wl->wl_bufbytes_max <<= wl->wl_log_dev_bshift; | |
610 | wl->wl_bufbytes_max >>= wl->wl_fs_dev_bshift; | 610 | wl->wl_bufbytes_max >>= wl->wl_fs_dev_bshift; | |
611 | wl->wl_bufbytes_max <<= wl->wl_fs_dev_bshift; | 611 | wl->wl_bufbytes_max <<= wl->wl_fs_dev_bshift; | |
612 | 612 | |||
613 | /* XXX maybe use filesystem fragment size instead of 1024 */ | 613 | /* XXX maybe use filesystem fragment size instead of 1024 */ | |
614 | /* XXX fix actual number of buffers reserved per filesystem. */ | 614 | /* XXX fix actual number of buffers reserved per filesystem. */ | |
615 | wl->wl_bufcount_max = (nbuf / 2) * 1024; | 615 | wl->wl_bufcount_max = (buf_nbuf() / 2) * 1024; | |
616 | 616 | |||
617 | wl->wl_brperjblock = ((1<<wl->wl_log_dev_bshift) | 617 | wl->wl_brperjblock = ((1<<wl->wl_log_dev_bshift) | |
618 | - offsetof(struct wapbl_wc_blocklist, wc_blocks)) / | 618 | - offsetof(struct wapbl_wc_blocklist, wc_blocks)) / | |
619 | sizeof(((struct wapbl_wc_blocklist *)0)->wc_blocks[0]); | 619 | sizeof(((struct wapbl_wc_blocklist *)0)->wc_blocks[0]); | |
620 | KASSERT(wl->wl_brperjblock > 0); | 620 | KASSERT(wl->wl_brperjblock > 0); | |
621 | 621 | |||
622 | /* XXX tie this into resource estimation */ | 622 | /* XXX tie this into resource estimation */ | |
623 | wl->wl_dealloclim = wl->wl_bufbytes_max / mp->mnt_stat.f_bsize / 2; | 623 | wl->wl_dealloclim = wl->wl_bufbytes_max / mp->mnt_stat.f_bsize / 2; | |
624 | TAILQ_INIT(&wl->wl_dealloclist); | 624 | TAILQ_INIT(&wl->wl_dealloclist); | |
625 | 625 | |||
626 | wapbl_inodetrk_init(wl, WAPBL_INODETRK_SIZE); | 626 | wapbl_inodetrk_init(wl, WAPBL_INODETRK_SIZE); | |
627 | 627 | |||
628 | wapbl_evcnt_init(wl); | 628 | wapbl_evcnt_init(wl); |
--- src/sys/sys/buf.h 2017/04/10 19:52:38 1.128
+++ src/sys/sys/buf.h 2017/06/08 01:23:01 1.129
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: buf.h,v 1.128 2017/04/10 19:52:38 jdolecek Exp $ */ | 1 | /* $NetBSD: buf.h,v 1.129 2017/06/08 01:23:01 chs Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1999, 2000, 2007, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1999, 2000, 2007, 2008 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | |
9 | * NASA Ames Research Center, and by Andrew Doran. | 9 | * NASA Ames Research Center, and by Andrew Doran. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -247,46 +247,26 @@ do { \ | @@ -247,46 +247,26 @@ do { \ | |||
247 | 247 | |||
248 | #ifdef _KERNEL | 248 | #ifdef _KERNEL | |
249 | 249 | |||
250 | #define BIO_GETPRIO(bp) ((bp)->b_prio) | 250 | #define BIO_GETPRIO(bp) ((bp)->b_prio) | |
251 | #define BIO_SETPRIO(bp, prio) (bp)->b_prio = (prio) | 251 | #define BIO_SETPRIO(bp, prio) (bp)->b_prio = (prio) | |
252 | #define BIO_COPYPRIO(bp1, bp2) BIO_SETPRIO(bp1, BIO_GETPRIO(bp2)) | 252 | #define BIO_COPYPRIO(bp1, bp2) BIO_SETPRIO(bp1, BIO_GETPRIO(bp2)) | |
253 | 253 | |||
254 | #define BPRIO_NPRIO 3 | 254 | #define BPRIO_NPRIO 3 | |
255 | #define BPRIO_TIMECRITICAL 2 | 255 | #define BPRIO_TIMECRITICAL 2 | |
256 | #define BPRIO_TIMELIMITED 1 | 256 | #define BPRIO_TIMELIMITED 1 | |
257 | #define BPRIO_TIMENONCRITICAL 0 | 257 | #define BPRIO_TIMENONCRITICAL 0 | |
258 | #define BPRIO_DEFAULT BPRIO_TIMELIMITED | 258 | #define BPRIO_DEFAULT BPRIO_TIMELIMITED | |
259 | 259 | |||
260 | extern u_int nbuf; /* The number of buffer headers */ | |||
261 | ||||
262 | /* | |||
263 | * Definitions for the buffer free lists. | |||
264 | */ | |||
265 | #define BQUEUES 4 /* number of free buffer queues */ | |||
266 | ||||
267 | #define BQ_LOCKED 0 /* super-blocks &c */ | |||
268 | #define BQ_LRU 1 /* lru, useful buffers */ | |||
269 | #define BQ_AGE 2 /* rubbish */ | |||
270 | #define BQ_EMPTY 3 /* buffer headers with no memory */ | |||
271 | ||||
272 | struct bqueue { | |||
273 | TAILQ_HEAD(, buf) bq_queue; | |||
274 | uint64_t bq_bytes; | |||
275 | buf_t *bq_marker; | |||
276 | }; | |||
277 | ||||
278 | extern struct bqueue bufqueues[BQUEUES]; | |||
279 | ||||
280 | __BEGIN_DECLS | 260 | __BEGIN_DECLS | |
281 | /* | 261 | /* | |
282 | * bufferio(9) ops | 262 | * bufferio(9) ops | |
283 | */ | 263 | */ | |
284 | void biodone(buf_t *); | 264 | void biodone(buf_t *); | |
285 | int biowait(buf_t *); | 265 | int biowait(buf_t *); | |
286 | buf_t *getiobuf(struct vnode *, bool); | 266 | buf_t *getiobuf(struct vnode *, bool); | |
287 | void putiobuf(buf_t *); | 267 | void putiobuf(buf_t *); | |
288 | void nestiobuf_setup(buf_t *, buf_t *, int, size_t); | 268 | void nestiobuf_setup(buf_t *, buf_t *, int, size_t); | |
289 | void nestiobuf_done(buf_t *, int, int); | 269 | void nestiobuf_done(buf_t *, int, int); | |
290 | 270 | |||
291 | void nestiobuf_iodone(buf_t *); | 271 | void nestiobuf_iodone(buf_t *); | |
292 | int physio(void (*)(buf_t *), buf_t *, dev_t, int, | 272 | int physio(void (*)(buf_t *), buf_t *, dev_t, int, | |
@@ -320,19 +300,20 @@ void brelvp(buf_t *); | @@ -320,19 +300,20 @@ void brelvp(buf_t *); | |||
320 | void reassignbuf(buf_t *, struct vnode *); | 300 | void reassignbuf(buf_t *, struct vnode *); | |
321 | void bgetvp(struct vnode *, buf_t *); | 301 | void bgetvp(struct vnode *, buf_t *); | |
322 | int buf_syncwait(void); | 302 | int buf_syncwait(void); | |
323 | u_long buf_memcalc(void); | 303 | u_long buf_memcalc(void); | |
324 | int buf_drain(int); | 304 | int buf_drain(int); | |
325 | int buf_setvalimit(vsize_t); | 305 | int buf_setvalimit(vsize_t); | |
326 | #if defined(DDB) || defined(DEBUGPRINT) | 306 | #if defined(DDB) || defined(DEBUGPRINT) | |
327 | void vfs_buf_print(buf_t *, int, void (*)(const char *, ...) | 307 | void vfs_buf_print(buf_t *, int, void (*)(const char *, ...) | |
328 | __printflike(1, 2)); | 308 | __printflike(1, 2)); | |
329 | #endif | 309 | #endif | |
330 | void buf_init(buf_t *); | 310 | void buf_init(buf_t *); | |
331 | void buf_destroy(buf_t *); | 311 | void buf_destroy(buf_t *); | |
332 | int bbusy(buf_t *, bool, int, kmutex_t *); | 312 | int bbusy(buf_t *, bool, int, kmutex_t *); | |
313 | int buf_nbuf(void); | |||
333 | 314 | |||
334 | void biohist_init(void); | 315 | void biohist_init(void); | |
335 | 316 | |||
336 | __END_DECLS | 317 | __END_DECLS | |
337 | #endif /* _KERNEL */ | 318 | #endif /* _KERNEL */ | |
338 | #endif /* !_SYS_BUF_H_ */ | 319 | #endif /* !_SYS_BUF_H_ */ |
--- src/sys/ufs/lfs/lfs_balloc.c 2017/04/06 02:38:08 1.92
+++ src/sys/ufs/lfs/lfs_balloc.c 2017/06/08 01:23:01 1.93
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: lfs_balloc.c,v 1.92 2017/04/06 02:38:08 maya Exp $ */ | 1 | /* $NetBSD: lfs_balloc.c,v 1.93 2017/06/08 01:23:01 chs Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Konrad E. Schroder <perseant@hhhh.org>. | 8 | * by Konrad E. Schroder <perseant@hhhh.org>. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -50,27 +50,27 @@ | @@ -50,27 +50,27 @@ | |||
50 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 50 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
51 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 51 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
52 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 52 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
53 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 53 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
54 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 54 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
55 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 55 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
56 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 56 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
57 | * SUCH DAMAGE. | 57 | * SUCH DAMAGE. | |
58 | * | 58 | * | |
59 | * @(#)lfs_balloc.c 8.4 (Berkeley) 5/8/95 | 59 | * @(#)lfs_balloc.c 8.4 (Berkeley) 5/8/95 | |
60 | */ | 60 | */ | |
61 | 61 | |||
62 | #include <sys/cdefs.h> | 62 | #include <sys/cdefs.h> | |
63 | __KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.92 2017/04/06 02:38:08 maya Exp $"); | 63 | __KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.93 2017/06/08 01:23:01 chs Exp $"); | |
64 | 64 | |||
65 | #if defined(_KERNEL_OPT) | 65 | #if defined(_KERNEL_OPT) | |
66 | #include "opt_quota.h" | 66 | #include "opt_quota.h" | |
67 | #endif | 67 | #endif | |
68 | 68 | |||
69 | #include <sys/param.h> | 69 | #include <sys/param.h> | |
70 | #include <sys/systm.h> | 70 | #include <sys/systm.h> | |
71 | #include <sys/buf.h> | 71 | #include <sys/buf.h> | |
72 | #include <sys/proc.h> | 72 | #include <sys/proc.h> | |
73 | #include <sys/vnode.h> | 73 | #include <sys/vnode.h> | |
74 | #include <sys/mount.h> | 74 | #include <sys/mount.h> | |
75 | #include <sys/resourcevar.h> | 75 | #include <sys/resourcevar.h> | |
76 | #include <sys/tree.h> | 76 | #include <sys/tree.h> | |
@@ -517,27 +517,26 @@ lfs_fragextend(struct vnode *vp, int osi | @@ -517,27 +517,26 @@ lfs_fragextend(struct vnode *vp, int osi | |||
517 | 517 | |||
518 | /* | 518 | /* | |
519 | * Get the seglock so we don't enlarge blocks while a segment | 519 | * Get the seglock so we don't enlarge blocks while a segment | |
520 | * is being written. If we're called with bpp==NULL, though, | 520 | * is being written. If we're called with bpp==NULL, though, | |
521 | * we are only pretending to change a buffer, so we don't have to | 521 | * we are only pretending to change a buffer, so we don't have to | |
522 | * lock. | 522 | * lock. | |
523 | * | 523 | * | |
524 | * XXX: the above comment is lying, as fs->lfs_fraglock is not | 524 | * XXX: the above comment is lying, as fs->lfs_fraglock is not | |
525 | * the segment lock. | 525 | * the segment lock. | |
526 | */ | 526 | */ | |
527 | top: | 527 | top: | |
528 | if (bpp) { | 528 | if (bpp) { | |
529 | rw_enter(&fs->lfs_fraglock, RW_READER); | 529 | rw_enter(&fs->lfs_fraglock, RW_READER); | |
530 | LFS_DEBUG_COUNTLOCKED("frag"); | |||
531 | } | 530 | } | |
532 | 531 | |||
533 | /* check if we actually have enough frags available */ | 532 | /* check if we actually have enough frags available */ | |
534 | if (!ISSPACE(fs, frags, cred)) { | 533 | if (!ISSPACE(fs, frags, cred)) { | |
535 | error = ENOSPC; | 534 | error = ENOSPC; | |
536 | goto out; | 535 | goto out; | |
537 | } | 536 | } | |
538 | 537 | |||
539 | /* | 538 | /* | |
540 | * If we are not asked to actually return the block, all we need | 539 | * If we are not asked to actually return the block, all we need | |
541 | * to do is allocate space for it. UBC will handle dirtying the | 540 | * to do is allocate space for it. UBC will handle dirtying the | |
542 | * appropriate things and making sure it all goes to disk. | 541 | * appropriate things and making sure it all goes to disk. | |
543 | * Don't bother to read in that case. | 542 | * Don't bother to read in that case. |
--- src/sys/ufs/lfs/lfs_subr.c 2017/04/06 03:21:01 1.92
+++ src/sys/ufs/lfs/lfs_subr.c 2017/06/08 01:23:01 1.93
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: lfs_subr.c,v 1.92 2017/04/06 03:21:01 maya Exp $ */ | 1 | /* $NetBSD: lfs_subr.c,v 1.93 2017/06/08 01:23:01 chs Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Konrad E. Schroder <perseant@hhhh.org>. | 8 | * by Konrad E. Schroder <perseant@hhhh.org>. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -50,27 +50,27 @@ | @@ -50,27 +50,27 @@ | |||
50 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 50 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
51 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 51 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
52 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 52 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
53 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 53 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
54 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 54 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
55 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 55 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
56 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 56 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
57 | * SUCH DAMAGE. | 57 | * SUCH DAMAGE. | |
58 | * | 58 | * | |
59 | * @(#)lfs_subr.c 8.4 (Berkeley) 5/8/95 | 59 | * @(#)lfs_subr.c 8.4 (Berkeley) 5/8/95 | |
60 | */ | 60 | */ | |
61 | 61 | |||
62 | #include <sys/cdefs.h> | 62 | #include <sys/cdefs.h> | |
63 | __KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.92 2017/04/06 03:21:01 maya Exp $"); | 63 | __KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.93 2017/06/08 01:23:01 chs Exp $"); | |
64 | 64 | |||
65 | #include <sys/param.h> | 65 | #include <sys/param.h> | |
66 | #include <sys/systm.h> | 66 | #include <sys/systm.h> | |
67 | #include <sys/namei.h> | 67 | #include <sys/namei.h> | |
68 | #include <sys/vnode.h> | 68 | #include <sys/vnode.h> | |
69 | #include <sys/buf.h> | 69 | #include <sys/buf.h> | |
70 | #include <sys/mount.h> | 70 | #include <sys/mount.h> | |
71 | #include <sys/malloc.h> | 71 | #include <sys/malloc.h> | |
72 | #include <sys/proc.h> | 72 | #include <sys/proc.h> | |
73 | #include <sys/kauth.h> | 73 | #include <sys/kauth.h> | |
74 | 74 | |||
75 | #include <ufs/lfs/ulfs_inode.h> | 75 | #include <ufs/lfs/ulfs_inode.h> | |
76 | #include <ufs/lfs/lfs.h> | 76 | #include <ufs/lfs/lfs.h> | |
@@ -453,32 +453,30 @@ lfs_segunlock(struct lfs *fs) | @@ -453,32 +453,30 @@ lfs_segunlock(struct lfs *fs) | |||
453 | * fs->lfs_sp so another process can use it (we have to | 453 | * fs->lfs_sp so another process can use it (we have to | |
454 | * wait but they don't have to wait for us). | 454 | * wait but they don't have to wait for us). | |
455 | */ | 455 | */ | |
456 | if (!sync) | 456 | if (!sync) | |
457 | pool_put(&fs->lfs_segpool, sp); | 457 | pool_put(&fs->lfs_segpool, sp); | |
458 | fs->lfs_sp = NULL; | 458 | fs->lfs_sp = NULL; | |
459 | 459 | |||
460 | /* | 460 | /* | |
461 | * If the I/O count is non-zero, sleep until it reaches zero. | 461 | * If the I/O count is non-zero, sleep until it reaches zero. | |
462 | * At the moment, the user's process hangs around so we can | 462 | * At the moment, the user's process hangs around so we can | |
463 | * sleep. | 463 | * sleep. | |
464 | */ | 464 | */ | |
465 | mutex_enter(&lfs_lock); | 465 | mutex_enter(&lfs_lock); | |
466 | if (--fs->lfs_iocount == 0) { | 466 | if (--fs->lfs_iocount <= 1) | |
467 | LFS_DEBUG_COUNTLOCKED("lfs_segunlock"); | |||
468 | } | |||
469 | if (fs->lfs_iocount <= 1) | |||
470 | wakeup(&fs->lfs_iocount); | 467 | wakeup(&fs->lfs_iocount); | |
471 | mutex_exit(&lfs_lock); | 468 | mutex_exit(&lfs_lock); | |
469 | ||||
472 | /* | 470 | /* | |
473 | * If we're not checkpointing, we don't have to block | 471 | * If we're not checkpointing, we don't have to block | |
474 | * other processes to wait for a synchronous write | 472 | * other processes to wait for a synchronous write | |
475 | * to complete. | 473 | * to complete. | |
476 | */ | 474 | */ | |
477 | if (!ckp) { | 475 | if (!ckp) { | |
478 | LFS_ENTER_LOG("segunlock_std", __FILE__, __LINE__, 0, 0, curproc->p_pid); | 476 | LFS_ENTER_LOG("segunlock_std", __FILE__, __LINE__, 0, 0, curproc->p_pid); | |
479 | 477 | |||
480 | mutex_enter(&lfs_lock); | 478 | mutex_enter(&lfs_lock); | |
481 | --fs->lfs_seglock; | 479 | --fs->lfs_seglock; | |
482 | fs->lfs_lockpid = 0; | 480 | fs->lfs_lockpid = 0; | |
483 | fs->lfs_locklwp = 0; | 481 | fs->lfs_locklwp = 0; | |
484 | mutex_exit(&lfs_lock); | 482 | mutex_exit(&lfs_lock); |
--- src/sys/ufs/lfs/lfs_bio.c 2017/04/17 08:32:01 1.139
+++ src/sys/ufs/lfs/lfs_bio.c 2017/06/08 01:23:01 1.140
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: lfs_bio.c,v 1.139 2017/04/17 08:32:01 hannken Exp $ */ | 1 | /* $NetBSD: lfs_bio.c,v 1.140 2017/06/08 01:23:01 chs Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Konrad E. Schroder <perseant@hhhh.org>. | 8 | * by Konrad E. Schroder <perseant@hhhh.org>. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -50,27 +50,27 @@ | @@ -50,27 +50,27 @@ | |||
50 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 50 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
51 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 51 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
52 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 52 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
53 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 53 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
54 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 54 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
55 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 55 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
56 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 56 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
57 | * SUCH DAMAGE. | 57 | * SUCH DAMAGE. | |
58 | * | 58 | * | |
59 | * @(#)lfs_bio.c 8.10 (Berkeley) 6/10/95 | 59 | * @(#)lfs_bio.c 8.10 (Berkeley) 6/10/95 | |
60 | */ | 60 | */ | |
61 | 61 | |||
62 | #include <sys/cdefs.h> | 62 | #include <sys/cdefs.h> | |
63 | __KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.139 2017/04/17 08:32:01 hannken Exp $"); | 63 | __KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.140 2017/06/08 01:23:01 chs Exp $"); | |
64 | 64 | |||
65 | #include <sys/param.h> | 65 | #include <sys/param.h> | |
66 | #include <sys/systm.h> | 66 | #include <sys/systm.h> | |
67 | #include <sys/proc.h> | 67 | #include <sys/proc.h> | |
68 | #include <sys/buf.h> | 68 | #include <sys/buf.h> | |
69 | #include <sys/vnode.h> | 69 | #include <sys/vnode.h> | |
70 | #include <sys/resourcevar.h> | 70 | #include <sys/resourcevar.h> | |
71 | #include <sys/mount.h> | 71 | #include <sys/mount.h> | |
72 | #include <sys/kernel.h> | 72 | #include <sys/kernel.h> | |
73 | #include <sys/kauth.h> | 73 | #include <sys/kauth.h> | |
74 | 74 | |||
75 | #include <ufs/lfs/ulfs_inode.h> | 75 | #include <ufs/lfs/ulfs_inode.h> | |
76 | #include <ufs/lfs/ulfsmount.h> | 76 | #include <ufs/lfs/ulfsmount.h> | |
@@ -297,26 +297,40 @@ lfs_reserve(struct lfs *fs, struct vnode | @@ -297,26 +297,40 @@ lfs_reserve(struct lfs *fs, struct vnode | |||
297 | return error; | 297 | return error; | |
298 | 298 | |||
299 | /* | 299 | /* | |
300 | * XXX just a guess. should be more precise. | 300 | * XXX just a guess. should be more precise. | |
301 | */ | 301 | */ | |
302 | error = lfs_reservebuf(fs, vp, vp2, fsb, lfs_fsbtob(fs, fsb)); | 302 | error = lfs_reservebuf(fs, vp, vp2, fsb, lfs_fsbtob(fs, fsb)); | |
303 | if (error) | 303 | if (error) | |
304 | lfs_reserveavail(fs, vp, vp2, -fsb); | 304 | lfs_reserveavail(fs, vp, vp2, -fsb); | |
305 | 305 | |||
306 | return error; | 306 | return error; | |
307 | } | 307 | } | |
308 | 308 | |||
309 | int | 309 | int | |
310 | lfs_max_bufs(void) | |||
311 | { | |||
312 | ||||
313 | return LFS_MAX_RESOURCE(buf_nbuf(), 1); | |||
314 | } | |||
315 | ||||
316 | int | |||
317 | lfs_wait_bufs(void) | |||
318 | { | |||
319 | ||||
320 | return LFS_WAIT_RESOURCE(buf_nbuf(), 1); | |||
321 | } | |||
322 | ||||
323 | int | |||
310 | lfs_bwrite(void *v) | 324 | lfs_bwrite(void *v) | |
311 | { | 325 | { | |
312 | struct vop_bwrite_args /* { | 326 | struct vop_bwrite_args /* { | |
313 | struct vnode *a_vp; | 327 | struct vnode *a_vp; | |
314 | struct buf *a_bp; | 328 | struct buf *a_bp; | |
315 | } */ *ap = v; | 329 | } */ *ap = v; | |
316 | struct buf *bp = ap->a_bp; | 330 | struct buf *bp = ap->a_bp; | |
317 | 331 | |||
318 | KASSERTMSG((VTOI(bp->b_vp)->i_lfs->lfs_ronly || | 332 | KASSERTMSG((VTOI(bp->b_vp)->i_lfs->lfs_ronly || | |
319 | !(bp->b_flags & B_ASYNC)), | 333 | !(bp->b_flags & B_ASYNC)), | |
320 | "bawrite LFS buffer"); | 334 | "bawrite LFS buffer"); | |
321 | return lfs_bwrite_ext(bp, 0); | 335 | return lfs_bwrite_ext(bp, 0); | |
322 | } | 336 | } | |
@@ -546,27 +560,26 @@ lfs_flush(struct lfs *fs, int flags, int | @@ -546,27 +560,26 @@ lfs_flush(struct lfs *fs, int flags, int | |||
546 | locked_fakequeue_count = 0; | 560 | locked_fakequeue_count = 0; | |
547 | mountlist_iterator_init(&iter); | 561 | mountlist_iterator_init(&iter); | |
548 | while ((mp = mountlist_iterator_next(iter)) != NULL) { | 562 | while ((mp = mountlist_iterator_next(iter)) != NULL) { | |
549 | if (strncmp(&mp->mnt_stat.f_fstypename[0], MOUNT_LFS, | 563 | if (strncmp(&mp->mnt_stat.f_fstypename[0], MOUNT_LFS, | |
550 | sizeof(mp->mnt_stat.f_fstypename)) == 0) { | 564 | sizeof(mp->mnt_stat.f_fstypename)) == 0) { | |
551 | tfs = VFSTOULFS(mp)->um_lfs; | 565 | tfs = VFSTOULFS(mp)->um_lfs; | |
552 | mutex_enter(&lfs_lock); | 566 | mutex_enter(&lfs_lock); | |
553 | lfs_flush_fs(tfs, flags); | 567 | lfs_flush_fs(tfs, flags); | |
554 | mutex_exit(&lfs_lock); | 568 | mutex_exit(&lfs_lock); | |
555 | } | 569 | } | |
556 | } | 570 | } | |
557 | mountlist_iterator_destroy(iter); | 571 | mountlist_iterator_destroy(iter); | |
558 | } | 572 | } | |
559 | LFS_DEBUG_COUNTLOCKED("flush"); | |||
560 | wakeup(&lfs_subsys_pages); | 573 | wakeup(&lfs_subsys_pages); | |
561 | 574 | |||
562 | errout: | 575 | errout: | |
563 | mutex_enter(&lfs_lock); | 576 | mutex_enter(&lfs_lock); | |
564 | KASSERT(lfs_writing); | 577 | KASSERT(lfs_writing); | |
565 | lfs_writing = 0; | 578 | lfs_writing = 0; | |
566 | wakeup(&lfs_writing); | 579 | wakeup(&lfs_writing); | |
567 | } | 580 | } | |
568 | 581 | |||
569 | #define INOCOUNT(fs) howmany(lfs_sb_getuinodes(fs), LFS_INOPB(fs)) | 582 | #define INOCOUNT(fs) howmany(lfs_sb_getuinodes(fs), LFS_INOPB(fs)) | |
570 | #define INOBYTES(fs) (lfs_sb_getuinodes(fs) * DINOSIZE(fs)) | 583 | #define INOBYTES(fs) (lfs_sb_getuinodes(fs) * DINOSIZE(fs)) | |
571 | 584 | |||
572 | /* | 585 | /* | |
@@ -739,64 +752,26 @@ lfs_freebuf(struct lfs *fs, struct buf * | @@ -739,64 +752,26 @@ lfs_freebuf(struct lfs *fs, struct buf * | |||
739 | mutex_enter(&bufcache_lock); | 752 | mutex_enter(&bufcache_lock); | |
740 | mutex_enter(vp->v_interlock); | 753 | mutex_enter(vp->v_interlock); | |
741 | brelvp(bp); | 754 | brelvp(bp); | |
742 | mutex_exit(vp->v_interlock); | 755 | mutex_exit(vp->v_interlock); | |
743 | mutex_exit(&bufcache_lock); | 756 | mutex_exit(&bufcache_lock); | |
744 | } | 757 | } | |
745 | if (!(bp->b_cflags & BC_INVAL)) { /* BC_INVAL indicates a "fake" buffer */ | 758 | if (!(bp->b_cflags & BC_INVAL)) { /* BC_INVAL indicates a "fake" buffer */ | |
746 | lfs_free(fs, bp->b_data, LFS_NB_UNKNOWN); | 759 | lfs_free(fs, bp->b_data, LFS_NB_UNKNOWN); | |
747 | bp->b_data = NULL; | 760 | bp->b_data = NULL; | |
748 | } | 761 | } | |
749 | putiobuf(bp); | 762 | putiobuf(bp); | |
750 | } | 763 | } | |
751 | 764 | |||
752 | /* | |||
753 | * Count buffers on the "locked" queue, and compare it to a pro-forma count. | |||
754 | * Don't count malloced buffers, since they don't detract from the total. | |||
755 | */ | |||
756 | void | |||
757 | lfs_countlocked(int *count, long *bytes, const char *msg) | |||
758 | { | |||
759 | struct buf *bp; | |||
760 | int n = 0; | |||
761 | long int size = 0L; | |||
762 | ||||
763 | mutex_enter(&bufcache_lock); | |||
764 | TAILQ_FOREACH(bp, &bufqueues[BQ_LOCKED].bq_queue, b_freelist) { | |||
765 | KASSERT(bp->b_iodone == NULL); | |||
766 | n++; | |||
767 | size += bp->b_bufsize; | |||
768 | KASSERTMSG((n <= nbuf), | |||
769 | "lfs_countlocked: this can't happen: more" | |||
770 | " buffers locked than exist"); | |||
771 | } | |||
772 | /* | |||
773 | * Theoretically this function never really does anything. | |||
774 | * Give a warning if we have to fix the accounting. | |||
775 | */ | |||
776 | if (n != *count) { | |||
777 | DLOG((DLOG_LLIST, "lfs_countlocked: %s: adjusted buf count" | |||
778 | " from %d to %d\n", msg, *count, n)); | |||
779 | } | |||
780 | if (size != *bytes) { | |||
781 | DLOG((DLOG_LLIST, "lfs_countlocked: %s: adjusted byte count" | |||
782 | " from %ld to %ld\n", msg, *bytes, size)); | |||
783 | } | |||
784 | *count = n; | |||
785 | *bytes = size; | |||
786 | mutex_exit(&bufcache_lock); | |||
787 | return; | |||
788 | } | |||
789 | ||||
790 | int | 765 | int | |
791 | lfs_wait_pages(void) | 766 | lfs_wait_pages(void) | |
792 | { | 767 | { | |
793 | int active, inactive; | 768 | int active, inactive; | |
794 | 769 | |||
795 | uvm_estimatepageable(&active, &inactive); | 770 | uvm_estimatepageable(&active, &inactive); | |
796 | return LFS_WAIT_RESOURCE(active + inactive + uvmexp.free, 1); | 771 | return LFS_WAIT_RESOURCE(active + inactive + uvmexp.free, 1); | |
797 | } | 772 | } | |
798 | 773 | |||
799 | int | 774 | int | |
800 | lfs_max_pages(void) | 775 | lfs_max_pages(void) | |
801 | { | 776 | { | |
802 | int active, inactive; | 777 | int active, inactive; |
--- src/sys/ufs/lfs/lfs_extern.h 2016/06/20 03:29:52 1.111
+++ src/sys/ufs/lfs/lfs_extern.h 2017/06/08 01:23:01 1.112
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: lfs_extern.h,v 1.111 2016/06/20 03:29:52 dholland Exp $ */ | 1 | /* $NetBSD: lfs_extern.h,v 1.112 2017/06/08 01:23:01 chs Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Konrad E. Schroder <perseant@hhhh.org>. | 8 | * by Konrad E. Schroder <perseant@hhhh.org>. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -139,26 +139,28 @@ void lfs_deregister_block(struct vnode * | @@ -139,26 +139,28 @@ void lfs_deregister_block(struct vnode * | |||
139 | void lfs_deregister_all(struct vnode *); | 139 | void lfs_deregister_all(struct vnode *); | |
140 | 140 | |||
141 | /* lfs_bio.c */ | 141 | /* lfs_bio.c */ | |
142 | int lfs_availwait(struct lfs *, int); | 142 | int lfs_availwait(struct lfs *, int); | |
143 | int lfs_bwrite_ext(struct buf *, int); | 143 | int lfs_bwrite_ext(struct buf *, int); | |
144 | int lfs_fits(struct lfs *, int); | 144 | int lfs_fits(struct lfs *, int); | |
145 | void lfs_flush_fs(struct lfs *, int); | 145 | void lfs_flush_fs(struct lfs *, int); | |
146 | void lfs_flush(struct lfs *, int, int); | 146 | void lfs_flush(struct lfs *, int, int); | |
147 | int lfs_check(struct vnode *, daddr_t, int); | 147 | int lfs_check(struct vnode *, daddr_t, int); | |
148 | void lfs_freebuf(struct lfs *, struct buf *); | 148 | void lfs_freebuf(struct lfs *, struct buf *); | |
149 | struct buf *lfs_newbuf(struct lfs *, struct vnode *, daddr_t, size_t, int); | 149 | struct buf *lfs_newbuf(struct lfs *, struct vnode *, daddr_t, size_t, int); | |
150 | void lfs_countlocked(int *, long *, const char *); | 150 | void lfs_countlocked(int *, long *, const char *); | |
151 | int lfs_reserve(struct lfs *, struct vnode *, struct vnode *, int); | 151 | int lfs_reserve(struct lfs *, struct vnode *, struct vnode *, int); | |
152 | int lfs_max_bufs(void); | |||
153 | int lfs_wait_bufs(void); | |||
152 | 154 | |||
153 | /* lfs_debug.c */ | 155 | /* lfs_debug.c */ | |
154 | #ifdef DEBUG | 156 | #ifdef DEBUG | |
155 | int lfs_bwrite_log(struct buf *, const char *, int); | 157 | int lfs_bwrite_log(struct buf *, const char *, int); | |
156 | void lfs_dumplog(void); | 158 | void lfs_dumplog(void); | |
157 | void lfs_dump_super(struct lfs *); | 159 | void lfs_dump_super(struct lfs *); | |
158 | void lfs_dump_dinode(struct lfs *, union lfs_dinode *); | 160 | void lfs_dump_dinode(struct lfs *, union lfs_dinode *); | |
159 | void lfs_check_bpp(struct lfs *, struct segment *, char *, int); | 161 | void lfs_check_bpp(struct lfs *, struct segment *, char *, int); | |
160 | void lfs_check_segsum(struct lfs *, struct segment *, char *, int); | 162 | void lfs_check_segsum(struct lfs *, struct segment *, char *, int); | |
161 | void lfs_debug_log(int, const char *, ...); | 163 | void lfs_debug_log(int, const char *, ...); | |
162 | #endif /* DEBUG */ | 164 | #endif /* DEBUG */ | |
163 | 165 | |||
164 | /* lfs_inode.c */ | 166 | /* lfs_inode.c */ |
--- src/sys/ufs/lfs/lfs_inode.h 2017/06/05 07:47:32 1.21
+++ src/sys/ufs/lfs/lfs_inode.h 2017/06/08 01:23:01 1.22
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: lfs_inode.h,v 1.21 2017/06/05 07:47:32 maya Exp $ */ | 1 | /* $NetBSD: lfs_inode.h,v 1.22 2017/06/08 01:23:01 chs Exp $ */ | |
2 | /* from NetBSD: ulfs_inode.h,v 1.5 2013/06/06 00:51:50 dholland Exp */ | 2 | /* from NetBSD: ulfs_inode.h,v 1.5 2013/06/06 00:51:50 dholland Exp */ | |
3 | /* from NetBSD: inode.h,v 1.72 2016/06/03 15:36:03 christos Exp */ | 3 | /* from NetBSD: inode.h,v 1.72 2016/06/03 15:36:03 christos Exp */ | |
4 | 4 | |||
5 | /* | 5 | /* | |
6 | * Copyright (c) 1982, 1989, 1993 | 6 | * Copyright (c) 1982, 1989, 1993 | |
7 | * The Regents of the University of California. All rights reserved. | 7 | * The Regents of the University of California. All rights reserved. | |
8 | * (c) UNIX System Laboratories, Inc. | 8 | * (c) UNIX System Laboratories, Inc. | |
9 | * All or some portions of this file are derived from material licensed | 9 | * All or some portions of this file are derived from material licensed | |
10 | * to the University of California by American Telephone and Telegraph | 10 | * to the University of California by American Telephone and Telegraph | |
11 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | 11 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
12 | * the permission of UNIX System Laboratories, Inc. | 12 | * the permission of UNIX System Laboratories, Inc. | |
13 | * | 13 | * | |
14 | * Redistribution and use in source and binary forms, with or without | 14 | * Redistribution and use in source and binary forms, with or without | |
@@ -206,37 +206,26 @@ struct lfs_inode_ext { | @@ -206,37 +206,26 @@ struct lfs_inode_ext { | |||
206 | #define i_lfs_lbtree inode_ext.lfs->lfs_lbtree | 206 | #define i_lfs_lbtree inode_ext.lfs->lfs_lbtree | |
207 | #define i_lfs_nbtree inode_ext.lfs->lfs_nbtree | 207 | #define i_lfs_nbtree inode_ext.lfs->lfs_nbtree | |
208 | #define i_lfs_segdhd inode_ext.lfs->lfs_segdhd | 208 | #define i_lfs_segdhd inode_ext.lfs->lfs_segdhd | |
209 | #define i_lfs_odnlink inode_ext.lfs->lfs_odnlink | 209 | #define i_lfs_odnlink inode_ext.lfs->lfs_odnlink | |
210 | 210 | |||
211 | /* | 211 | /* | |
212 | * "struct buf" associated definitions | 212 | * "struct buf" associated definitions | |
213 | */ | 213 | */ | |
214 | 214 | |||
215 | #ifdef _KERNEL | 215 | #ifdef _KERNEL | |
216 | 216 | |||
217 | # define LFS_IS_MALLOC_BUF(bp) ((bp)->b_iodone == lfs_callback) | 217 | # define LFS_IS_MALLOC_BUF(bp) ((bp)->b_iodone == lfs_callback) | |
218 | 218 | |||
219 | # ifdef DEBUG | |||
220 | # define LFS_DEBUG_COUNTLOCKED(m) do { \ | |||
221 | if (lfs_debug_log_subsys[DLOG_LLIST]) { \ | |||
222 | lfs_countlocked(&locked_queue_count, &locked_queue_bytes, (m)); \ | |||
223 | cv_broadcast(&locked_queue_cv); \ | |||
224 | } \ | |||
225 | } while (0) | |||
226 | # else | |||
227 | # define LFS_DEBUG_COUNTLOCKED(m) | |||
228 | # endif | |||
229 | ||||
230 | /* log for debugging writes to the Ifile */ | 219 | /* log for debugging writes to the Ifile */ | |
231 | # ifdef DEBUG | 220 | # ifdef DEBUG | |
232 | struct lfs_log_entry { | 221 | struct lfs_log_entry { | |
233 | const char *op; | 222 | const char *op; | |
234 | const char *file; | 223 | const char *file; | |
235 | int pid; | 224 | int pid; | |
236 | int line; | 225 | int line; | |
237 | daddr_t block; | 226 | daddr_t block; | |
238 | unsigned long flags; | 227 | unsigned long flags; | |
239 | }; | 228 | }; | |
240 | extern int lfs_lognum; | 229 | extern int lfs_lognum; | |
241 | extern struct lfs_log_entry lfs_log[LFS_LOGLENGTH]; | 230 | extern struct lfs_log_entry lfs_log[LFS_LOGLENGTH]; | |
242 | # define LFS_BWRITE_LOG(bp) lfs_bwrite_log((bp), __FILE__, __LINE__) | 231 | # define LFS_BWRITE_LOG(bp) lfs_bwrite_log((bp), __FILE__, __LINE__) |
--- src/sys/ufs/lfs/ulfs_inode.h 2016/06/21 06:14:40 1.22
+++ src/sys/ufs/lfs/ulfs_inode.h 2017/06/08 01:23:01 1.23
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ulfs_inode.h,v 1.22 2016/06/21 06:14:40 dholland Exp $ */ | 1 | /* $NetBSD: ulfs_inode.h,v 1.23 2017/06/08 01:23:01 chs Exp $ */ | |
2 | /* from NetBSD: inode.h,v 1.72 2016/06/03 15:36:03 christos Exp */ | 2 | /* from NetBSD: inode.h,v 1.72 2016/06/03 15:36:03 christos Exp */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 1982, 1989, 1993 | 5 | * Copyright (c) 1982, 1989, 1993 | |
6 | * The Regents of the University of California. All rights reserved. | 6 | * The Regents of the University of California. All rights reserved. | |
7 | * (c) UNIX System Laboratories, Inc. | 7 | * (c) UNIX System Laboratories, Inc. | |
8 | * All or some portions of this file are derived from material licensed | 8 | * All or some portions of this file are derived from material licensed | |
9 | * to the University of California by American Telephone and Telegraph | 9 | * to the University of California by American Telephone and Telegraph | |
10 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | 10 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
11 | * the permission of UNIX System Laboratories, Inc. | 11 | * the permission of UNIX System Laboratories, Inc. | |
12 | * | 12 | * | |
13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without | |
14 | * modification, are permitted provided that the following conditions | 14 | * modification, are permitted provided that the following conditions | |
@@ -59,28 +59,28 @@ | @@ -59,28 +59,28 @@ | |||
59 | #define MARK_VNODE(vp) lfs_mark_vnode(vp) | 59 | #define MARK_VNODE(vp) lfs_mark_vnode(vp) | |
60 | #define UNMARK_VNODE(vp) lfs_unmark_vnode(vp) | 60 | #define UNMARK_VNODE(vp) lfs_unmark_vnode(vp) | |
61 | int lfs_set_dirop(struct vnode *, struct vnode *); | 61 | int lfs_set_dirop(struct vnode *, struct vnode *); | |
62 | void lfs_unset_dirop(struct lfs *, struct vnode *, const char *); | 62 | void lfs_unset_dirop(struct lfs *, struct vnode *, const char *); | |
63 | 63 | |||
64 | /* Misc. definitions */ | 64 | /* Misc. definitions */ | |
65 | #define BW_CLEAN 1 /* Flag for lfs_bwrite_ext() */ | 65 | #define BW_CLEAN 1 /* Flag for lfs_bwrite_ext() */ | |
66 | #define PG_DELWRI PG_PAGER1 /* Local def for delayed pageout */ | 66 | #define PG_DELWRI PG_PAGER1 /* Local def for delayed pageout */ | |
67 | 67 | |||
68 | /* Resource limits */ | 68 | /* Resource limits */ | |
69 | #define LFS_MAX_RESOURCE(x, u) (((x) >> 2) - 10 * (u)) | 69 | #define LFS_MAX_RESOURCE(x, u) (((x) >> 2) - 10 * (u)) | |
70 | #define LFS_WAIT_RESOURCE(x, u) (((x) >> 1) - ((x) >> 3) - 10 * (u)) | 70 | #define LFS_WAIT_RESOURCE(x, u) (((x) >> 1) - ((x) >> 3) - 10 * (u)) | |
71 | #define LFS_INVERSE_MAX_RESOURCE(x, u) (((x) + 10 * (u)) << 2) | 71 | #define LFS_INVERSE_MAX_RESOURCE(x, u) (((x) + 10 * (u)) << 2) | |
72 | #define LFS_MAX_BUFS LFS_MAX_RESOURCE(nbuf, 1) | 72 | #define LFS_MAX_BUFS lfs_max_bufs() | |
73 | #define LFS_WAIT_BUFS LFS_WAIT_RESOURCE(nbuf, 1) | 73 | #define LFS_WAIT_BUFS lfs_wait_bufs() | |
74 | #define LFS_INVERSE_MAX_BUFS(n) LFS_INVERSE_MAX_RESOURCE(n, 1) | 74 | #define LFS_INVERSE_MAX_BUFS(n) LFS_INVERSE_MAX_RESOURCE(n, 1) | |
75 | #define LFS_MAX_BYTES LFS_MAX_RESOURCE(bufmem_lowater, PAGE_SIZE) | 75 | #define LFS_MAX_BYTES LFS_MAX_RESOURCE(bufmem_lowater, PAGE_SIZE) | |
76 | #define LFS_INVERSE_MAX_BYTES(n) LFS_INVERSE_MAX_RESOURCE(n, PAGE_SIZE) | 76 | #define LFS_INVERSE_MAX_BYTES(n) LFS_INVERSE_MAX_RESOURCE(n, PAGE_SIZE) | |
77 | #define LFS_WAIT_BYTES LFS_WAIT_RESOURCE(bufmem_lowater, PAGE_SIZE) | 77 | #define LFS_WAIT_BYTES LFS_WAIT_RESOURCE(bufmem_lowater, PAGE_SIZE) | |
78 | #define LFS_MAX_DIROP ((desiredvnodes >> 2) + (desiredvnodes >> 3)) | 78 | #define LFS_MAX_DIROP ((desiredvnodes >> 2) + (desiredvnodes >> 3)) | |
79 | #define SIZEOF_DIROP(fs) (2 * (lfs_sb_getbsize(fs) + DINOSIZE(fs))) | 79 | #define SIZEOF_DIROP(fs) (2 * (lfs_sb_getbsize(fs) + DINOSIZE(fs))) | |
80 | #define LFS_MAX_FSDIROP(fs) \ | 80 | #define LFS_MAX_FSDIROP(fs) \ | |
81 | (lfs_sb_getnclean(fs) <= lfs_sb_getresvseg(fs) ? 0 : \ | 81 | (lfs_sb_getnclean(fs) <= lfs_sb_getresvseg(fs) ? 0 : \ | |
82 | ((lfs_sb_getnclean(fs) - lfs_sb_getresvseg(fs)) * lfs_sb_getssize(fs)) / \ | 82 | ((lfs_sb_getnclean(fs) - lfs_sb_getresvseg(fs)) * lfs_sb_getssize(fs)) / \ | |
83 | (2 * SIZEOF_DIROP(fs))) | 83 | (2 * SIZEOF_DIROP(fs))) | |
84 | #define LFS_MAX_PAGES lfs_max_pages() | 84 | #define LFS_MAX_PAGES lfs_max_pages() | |
85 | #define LFS_WAIT_PAGES lfs_wait_pages() | 85 | #define LFS_WAIT_PAGES lfs_wait_pages() | |
86 | #define LFS_BUFWAIT 2 /* How long to wait if over *_WAIT_* */ | 86 | #define LFS_BUFWAIT 2 /* How long to wait if over *_WAIT_* */ |