* Move bswlist declaration and initialization from kern/vfs_bio.c to

vm/vm_pager.c, which is the only place it is used.
* Make the QUEUE_* definitions and bufqueues local to vfs_bio.c.
* constify buf_wmesg.
This commit is contained in:
Eivind Eklund 2002-03-05 18:20:58 +00:00
parent 0346e9733a
commit f52bd684f3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=91700
3 changed files with 22 additions and 20 deletions

View File

@ -68,7 +68,6 @@ struct buf_ops buf_ops_bio = {
* carnal knowledge of buffers. This knowledge should be moved to vfs_bio.c.
*/
struct buf *buf; /* buffer header pool */
struct swqueue bswlist;
struct mtx buftimelock; /* Interlock on setting prio and timo */
static void vm_hold_free_pages(struct buf * bp, vm_offset_t from,
@ -207,13 +206,26 @@ static LIST_HEAD(bufhashhdr, buf) *bufhashtbl;
* on them.)
*/
static struct bufhashhdr invalhash;
/*
* Definitions for the buffer free lists.
*/
#define BUFFER_QUEUES 6 /* number of free buffer queues */
#define QUEUE_NONE 0 /* on no queue */
#define QUEUE_LOCKED 1 /* locked buffers */
#define QUEUE_CLEAN 2 /* non-B_DELWRI buffers */
#define QUEUE_DIRTY 3 /* B_DELWRI buffers */
#define QUEUE_EMPTYKVA 4 /* empty buffer headers w/KVA assignment */
#define QUEUE_EMPTY 5 /* empty buffer headers */
/* Queues for free buffers with various properties */
static struct bqueues bufqueues[BUFFER_QUEUES] = { { 0 } };
static TAILQ_HEAD(bqueues, buf) bufqueues[BUFFER_QUEUES] = { { 0 } };
/*
* Single global constant for BUF_WMESG, to avoid getting multiple references.
* buf_wmesg is referred from macros.
*/
char *buf_wmesg = BUF_WMESG;
const char *buf_wmesg = BUF_WMESG;
#define VFS_BIO_NEED_ANY 0x01 /* any freeable buffer */
#define VFS_BIO_NEED_DIRTYFLUSH 0x02 /* waiting for dirty buffer flush */
@ -471,7 +483,6 @@ bufinit(void)
GIANT_REQUIRED;
TAILQ_INIT(&bswlist);
LIST_INIT(&invalhash);
mtx_init(&buftimelock, "buftime lock", MTX_DEF);

View File

@ -254,7 +254,7 @@ struct buf {
* Buffer locking
*/
extern struct mtx buftimelock; /* Interlock on setting prio and timo */
extern char *buf_wmesg; /* Default buffer lock message */
extern const char *buf_wmesg; /* Default buffer lock message */
#define BUF_WMESG "bufwait"
#include <sys/proc.h> /* XXX for curthread */
#include <sys/mutex.h>
@ -431,18 +431,6 @@ buf_countdeps(struct buf *bp, int i)
#endif /* _KERNEL */
/*
* Definitions for the buffer free lists.
*/
#define BUFFER_QUEUES 6 /* number of free buffer queues */
#define QUEUE_NONE 0 /* on no queue */
#define QUEUE_LOCKED 1 /* locked buffers */
#define QUEUE_CLEAN 2 /* non-B_DELWRI buffers */
#define QUEUE_DIRTY 3 /* B_DELWRI buffers */
#define QUEUE_EMPTYKVA 4 /* empty buffer headers w/KVA assignment */
#define QUEUE_EMPTY 5 /* empty buffer headers */
/*
* Zero out the buffer's data area.
*/
@ -468,8 +456,6 @@ extern char *buffers; /* The buffer contents. */
extern int bufpages; /* Number of memory pages in the buffer pool. */
extern struct buf *swbuf; /* Swap I/O buffer headers. */
extern int nswbuf; /* Number of swap I/O buffer headers. */
extern TAILQ_HEAD(swqueue, buf) bswlist;
extern TAILQ_HEAD(bqueues, buf) bufqueues[BUFFER_QUEUES];
struct uio;

View File

@ -194,12 +194,14 @@ vm_map_t pager_map;
static int bswneeded;
static vm_offset_t swapbkva; /* swap buffers kva */
struct mtx pbuf_mtx;
static TAILQ_HEAD(swqueue, buf) bswlist;
void
vm_pager_init()
{
struct pagerops **pgops;
TAILQ_INIT(&bswlist);
/*
* Initialize known pagers
*/
@ -347,12 +349,15 @@ vm_pager_object_lookup(pg_list, handle)
* initialize a physical buffer
*/
/*
* XXX This probably belongs in vfs_bio.c
*/
static void
initpbuf(struct buf *bp)
{
bp->b_rcred = NOCRED;
bp->b_wcred = NOCRED;
bp->b_qindex = QUEUE_NONE;
bp->b_qindex = 0; /* On no queue (QUEUE_NONE) */
bp->b_data = (caddr_t) (MAXPHYS * (bp - swbuf)) + swapbkva;
bp->b_kvabase = bp->b_data;
bp->b_kvasize = MAXPHYS;