use queue.h macros.

This commit is contained in:
yamt 2003-07-02 13:43:02 +00:00
parent 82659031f4
commit eb4e09d59f
5 changed files with 24 additions and 23 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs.h,v 1.65 2003/07/02 13:40:51 yamt Exp $ */
/* $NetBSD: lfs.h,v 1.66 2003/07/02 13:43:02 yamt Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -345,8 +345,8 @@ struct lfid {
!((vp)->v_flag & VONWORKLST))
/* XXX Shouldn't we use v_numoutput instead? */
#define WRITEINPROG(vp) ((vp)->v_dirtyblkhd.lh_first && !(VTOI(vp)->i_flag & \
(IN_MODIFIED | IN_ACCESSED | IN_CLEANING)))
#define WRITEINPROG(vp) (!LIST_EMPTY(&(vp)->v_dirtyblkhd) && \
!(VTOI(vp)->i_flag & (IN_MODIFIED | IN_ACCESSED | IN_CLEANING)))
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_bio.c,v 1.68 2003/07/02 13:41:38 yamt Exp $ */
/* $NetBSD: lfs_bio.c,v 1.69 2003/07/02 13:43:02 yamt Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.68 2003/07/02 13:41:38 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.69 2003/07/02 13:43:02 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -522,15 +522,17 @@ lfs_flush(struct lfs *fs, int flags)
wakeup(&lfs_subsys_pages);
simple_lock(&mountlist_slock);
for (mp = mountlist.cqh_first; mp != (void *)&mountlist; mp = nmp) {
for (mp = CIRCLEQ_FIRST(&mountlist); mp != (void *)&mountlist;
mp = nmp) {
if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) {
nmp = mp->mnt_list.cqe_next;
nmp = CIRCLEQ_NEXT(mp, mnt_list);
continue;
}
if (strncmp(&mp->mnt_stat.f_fstypename[0], MOUNT_LFS, MFSNAMELEN) == 0)
if (strncmp(&mp->mnt_stat.f_fstypename[0], MOUNT_LFS,
MFSNAMELEN) == 0)
lfs_flush_fs(VFSTOUFS(mp)->um_lfs, flags);
simple_lock(&mountlist_slock);
nmp = mp->mnt_list.cqe_next;
nmp = CIRCLEQ_NEXT(mp, mnt_list);
vfs_unbusy(mp);
}
simple_unlock(&mountlist_slock);
@ -724,8 +726,7 @@ lfs_countlocked(int *count, long *bytes, char *msg)
int n = 0;
long int size = 0L;
for (bp = bufqueues[BQ_LOCKED].tqh_first; bp;
bp = bp->b_freelist.tqe_next) {
TAILQ_FOREACH(bp, &bufqueues[BQ_LOCKED], b_freelist) {
if (bp->b_flags & B_CALL)
continue;
n++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_segment.c,v 1.125 2003/07/02 13:40:52 yamt Exp $ */
/* $NetBSD: lfs_segment.c,v 1.126 2003/07/02 13:43:03 yamt Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.125 2003/07/02 13:40:52 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.126 2003/07/02 13:43:03 yamt Exp $");
#define ivndebug(vp,str) printf("ino %d: %s\n",VTOI(vp)->i_number,(str))
@ -1609,7 +1609,7 @@ lfs_newclusterbuf(struct lfs *fs, struct vnode *vp, daddr_t addr, int n)
/* Get an empty buffer header, or maybe one with something on it */
s = splbio();
simple_lock(&bqueue_slock);
if ((bp = bufqueues[BQ_EMPTY].tqh_first) != NULL) {
if ((bp = TAILQ_FIRST(&bufqueues[BQ_EMPTY])) != NULL) {
simple_lock(&bp->b_interlock);
bremfree(bp);
/* clear out various other fields */

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_syscalls.c,v 1.93 2003/06/29 22:32:40 fvdl Exp $ */
/* $NetBSD: lfs_syscalls.c,v 1.94 2003/07/02 13:43:04 yamt Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.93 2003/06/29 22:32:40 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.94 2003/07/02 13:43:04 yamt Exp $");
#ifndef LFS
# define LFS /* for prototypes in syscallargs.h */
@ -571,8 +571,8 @@ lfs_markv(struct proc *p, fsid_t *fsidp, BLOCK_INFO *blkiov, int blkcnt)
/* Free up fakebuffers -- have to take these from the LOCKED list */
again:
s = splbio();
for (bp = bufqueues[BQ_LOCKED].tqh_first; bp; bp = nbp) {
nbp = bp->b_freelist.tqe_next;
for (bp = TAILQ_FIRST(&bufqueues[BQ_LOCKED]); bp; bp = nbp) {
nbp = TAILQ_NEXT(bp, b_freelist);
if (LFS_IS_MALLOC_BUF(bp)) {
if (bp->b_flags & B_BUSY) { /* not bloody likely */
bp->b_flags |= B_WANTED;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vfsops.c,v 1.123 2003/07/02 13:41:38 yamt Exp $ */
/* $NetBSD: lfs_vfsops.c,v 1.124 2003/07/02 13:43:05 yamt Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.123 2003/07/02 13:41:38 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.124 2003/07/02 13:43:05 yamt Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -195,10 +195,10 @@ lfs_writerd(void *arg)
* have requested pageouts.
*/
simple_lock(&mountlist_slock);
for (mp = mountlist.cqh_first; mp != (void *)&mountlist;
for (mp = CIRCLEQ_FIRST(&mountlist); mp != (void *)&mountlist;
mp = nmp) {
if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) {
nmp = mp->mnt_list.cqe_next;
nmp = CIRCLEQ_NEXT(mp, mnt_list);
continue;
}
if (strncmp(&mp->mnt_stat.f_fstypename[0], MOUNT_LFS,
@ -212,7 +212,7 @@ lfs_writerd(void *arg)
}
simple_lock(&mountlist_slock);
nmp = mp->mnt_list.cqe_next;
nmp = CIRCLEQ_NEXT(mp, mnt_list);
vfs_unbusy(mp);
}
simple_unlock(&mountlist_slock);