vfs_bio.c (189595) | vfs_bio.c (189627) |
---|---|
1/*- 2 * Copyright (c) 2004 Poul-Henning Kamp 3 * Copyright (c) 1994,1997 John S. Dyson 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 25 unchanged lines hidden (view full) --- 34 * Author: John S. Dyson 35 * Significant help during the development and debugging phases 36 * had been provided by David Greenman, also of the FreeBSD core team. 37 * 38 * see man buf(9) for more info. 39 */ 40 41#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2004 Poul-Henning Kamp 3 * Copyright (c) 1994,1997 John S. Dyson 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 25 unchanged lines hidden (view full) --- 34 * Author: John S. Dyson 35 * Significant help during the development and debugging phases 36 * had been provided by David Greenman, also of the FreeBSD core team. 37 * 38 * see man buf(9) for more info. 39 */ 40 41#include <sys/cdefs.h> |
42__FBSDID("$FreeBSD: head/sys/kern/vfs_bio.c 189595 2009-03-09 19:35:20Z jhb $"); | 42__FBSDID("$FreeBSD: head/sys/kern/vfs_bio.c 189627 2009-03-10 15:26:50Z jhb $"); |
43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/bio.h> 47#include <sys/conf.h> 48#include <sys/buf.h> 49#include <sys/devicestat.h> 50#include <sys/eventhandler.h> --- 13 unchanged lines hidden (view full) --- 64#include <vm/vm.h> 65#include <vm/vm_param.h> 66#include <vm/vm_kern.h> 67#include <vm/vm_pageout.h> 68#include <vm/vm_page.h> 69#include <vm/vm_object.h> 70#include <vm/vm_extern.h> 71#include <vm/vm_map.h> | 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/bio.h> 47#include <sys/conf.h> 48#include <sys/buf.h> 49#include <sys/devicestat.h> 50#include <sys/eventhandler.h> --- 13 unchanged lines hidden (view full) --- 64#include <vm/vm.h> 65#include <vm/vm_param.h> 66#include <vm/vm_kern.h> 67#include <vm/vm_pageout.h> 68#include <vm/vm_page.h> 69#include <vm/vm_object.h> 70#include <vm/vm_extern.h> 71#include <vm/vm_map.h> |
72#include "opt_compat.h" |
|
72#include "opt_directio.h" 73#include "opt_swap.h" 74 75static MALLOC_DEFINE(M_BIOBUF, "biobuf", "BIO buffer"); 76 77struct bio_ops bioops; /* I/O operation notification */ 78 79struct buf_ops buf_ops_bio = { --- 23 unchanged lines hidden (view full) --- 103static void vfs_setdirty(struct buf *bp); 104static void vfs_setdirty_locked_object(struct buf *bp); 105static void vfs_vmio_release(struct buf *bp); 106static int vfs_bio_clcheck(struct vnode *vp, int size, 107 daddr_t lblkno, daddr_t blkno); 108static int flushbufqueues(int, int); 109static void buf_daemon(void); 110static void bremfreel(struct buf *bp); | 73#include "opt_directio.h" 74#include "opt_swap.h" 75 76static MALLOC_DEFINE(M_BIOBUF, "biobuf", "BIO buffer"); 77 78struct bio_ops bioops; /* I/O operation notification */ 79 80struct buf_ops buf_ops_bio = { --- 23 unchanged lines hidden (view full) --- 104static void vfs_setdirty(struct buf *bp); 105static void vfs_setdirty_locked_object(struct buf *bp); 106static void vfs_vmio_release(struct buf *bp); 107static int vfs_bio_clcheck(struct vnode *vp, int size, 108 daddr_t lblkno, daddr_t blkno); 109static int flushbufqueues(int, int); 110static void buf_daemon(void); 111static void bremfreel(struct buf *bp); |
112#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ 113 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) 114static int sysctl_bufspace(SYSCTL_HANDLER_ARGS); 115#endif |
|
111 112int vmiodirenable = TRUE; 113SYSCTL_INT(_vfs, OID_AUTO, vmiodirenable, CTLFLAG_RW, &vmiodirenable, 0, 114 "Use the VM system for directory writes"); 115long runningbufspace; 116SYSCTL_LONG(_vfs, OID_AUTO, runningbufspace, CTLFLAG_RD, &runningbufspace, 0, 117 "Amount of presently outstanding async buffer io"); 118static long bufspace; | 116 117int vmiodirenable = TRUE; 118SYSCTL_INT(_vfs, OID_AUTO, vmiodirenable, CTLFLAG_RW, &vmiodirenable, 0, 119 "Use the VM system for directory writes"); 120long runningbufspace; 121SYSCTL_LONG(_vfs, OID_AUTO, runningbufspace, CTLFLAG_RD, &runningbufspace, 0, 122 "Amount of presently outstanding async buffer io"); 123static long bufspace; |
124#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ 125 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) 126SYSCTL_PROC(_vfs, OID_AUTO, bufspace, CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RD, 127 &bufspace, 0, sysctl_bufspace, "L", "KVA memory used for bufs"); 128#else |
|
119SYSCTL_LONG(_vfs, OID_AUTO, bufspace, CTLFLAG_RD, &bufspace, 0, 120 "KVA memory used for bufs"); | 129SYSCTL_LONG(_vfs, OID_AUTO, bufspace, CTLFLAG_RD, &bufspace, 0, 130 "KVA memory used for bufs"); |
131#endif |
|
121static long maxbufspace; 122SYSCTL_LONG(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RD, &maxbufspace, 0, 123 "Maximum allowed value of bufspace (including buf_daemon)"); 124static long bufmallocspace; 125SYSCTL_LONG(_vfs, OID_AUTO, bufmallocspace, CTLFLAG_RD, &bufmallocspace, 0, 126 "Amount of malloced memory for buffers"); 127static long maxbufmallocspace; 128SYSCTL_LONG(_vfs, OID_AUTO, maxmallocbufspace, CTLFLAG_RW, &maxbufmallocspace, 0, --- 131 unchanged lines hidden (view full) --- 260 */ 261const char *buf_wmesg = BUF_WMESG; 262 263#define VFS_BIO_NEED_ANY 0x01 /* any freeable buffer */ 264#define VFS_BIO_NEED_DIRTYFLUSH 0x02 /* waiting for dirty buffer flush */ 265#define VFS_BIO_NEED_FREE 0x04 /* wait for free bufs, hi hysteresis */ 266#define VFS_BIO_NEED_BUFSPACE 0x08 /* wait for buf space, lo hysteresis */ 267 | 132static long maxbufspace; 133SYSCTL_LONG(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RD, &maxbufspace, 0, 134 "Maximum allowed value of bufspace (including buf_daemon)"); 135static long bufmallocspace; 136SYSCTL_LONG(_vfs, OID_AUTO, bufmallocspace, CTLFLAG_RD, &bufmallocspace, 0, 137 "Amount of malloced memory for buffers"); 138static long maxbufmallocspace; 139SYSCTL_LONG(_vfs, OID_AUTO, maxmallocbufspace, CTLFLAG_RW, &maxbufmallocspace, 0, --- 131 unchanged lines hidden (view full) --- 271 */ 272const char *buf_wmesg = BUF_WMESG; 273 274#define VFS_BIO_NEED_ANY 0x01 /* any freeable buffer */ 275#define VFS_BIO_NEED_DIRTYFLUSH 0x02 /* waiting for dirty buffer flush */ 276#define VFS_BIO_NEED_FREE 0x04 /* wait for free bufs, hi hysteresis */ 277#define VFS_BIO_NEED_BUFSPACE 0x08 /* wait for buf space, lo hysteresis */ 278 |
279#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ 280 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) 281static int 282sysctl_bufspace(SYSCTL_HANDLER_ARGS) 283{ 284 long lvalue; 285 int ivalue; 286 287 if (sizeof(int) == sizeof(long) || req->oldlen == sizeof(long)) 288 return (sysctl_handle_long(oidp, arg1, arg2, req)); 289 lvalue = *(long *)arg1; 290 ivalue = lvalue > INT_MAX ? INT_MAX : lvalue; 291 return (sysctl_handle_int(oidp, &ivalue, 0, req)); 292} 293#endif 294 |
|
268#ifdef DIRECTIO 269extern void ffs_rawread_setup(void); 270#endif /* DIRECTIO */ 271/* 272 * numdirtywakeup: 273 * 274 * If someone is blocked due to there being too many dirty buffers, 275 * and numdirtybuffers is now reasonable, wake them up. --- 3694 unchanged lines hidden --- | 295#ifdef DIRECTIO 296extern void ffs_rawread_setup(void); 297#endif /* DIRECTIO */ 298/* 299 * numdirtywakeup: 300 * 301 * If someone is blocked due to there being too many dirty buffers, 302 * and numdirtybuffers is now reasonable, wake them up. --- 3694 unchanged lines hidden --- |