Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Dec 2004 01:59:39 GMT
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 67013 for review
Message-ID:  <200412140159.iBE1xdaU098544@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=67013

Change 67013 by peter@peter_daintree on 2004/12/14 01:59:29

	Apply smpffs.diff that I snarfed this morning.

Affected files ...

.. //depot/projects/smpffs/geom/geom_vfs.c#2 edit
.. //depot/projects/smpffs/kern/init_sysent.c#2 edit
.. //depot/projects/smpffs/kern/kern_descrip.c#2 edit
.. //depot/projects/smpffs/kern/kern_lock.c#2 edit
.. //depot/projects/smpffs/kern/syscalls.c#2 edit
.. //depot/projects/smpffs/kern/syscalls.master#2 edit
.. //depot/projects/smpffs/kern/vfs_bio.c#2 edit
.. //depot/projects/smpffs/kern/vfs_cache.c#2 edit
.. //depot/projects/smpffs/kern/vfs_cluster.c#2 edit
.. //depot/projects/smpffs/kern/vfs_default.c#2 edit
.. //depot/projects/smpffs/kern/vfs_lookup.c#2 edit
.. //depot/projects/smpffs/kern/vfs_mount.c#2 edit
.. //depot/projects/smpffs/kern/vfs_subr.c#2 edit
.. //depot/projects/smpffs/kern/vfs_syscalls.c#2 edit
.. //depot/projects/smpffs/kern/vfs_vnops.c#2 edit
.. //depot/projects/smpffs/sys/ktr.h#2 edit
.. //depot/projects/smpffs/sys/mount.h#2 edit
.. //depot/projects/smpffs/sys/namei.h#2 edit
.. //depot/projects/smpffs/sys/syscall.h#2 edit
.. //depot/projects/smpffs/sys/syscall.mk#2 edit
.. //depot/projects/smpffs/sys/sysproto.h#2 edit
.. //depot/projects/smpffs/sys/vnode.h#2 edit
.. //depot/projects/smpffs/ufs/ffs/ffs_alloc.c#2 edit
.. //depot/projects/smpffs/ufs/ffs/ffs_balloc.c#2 edit
.. //depot/projects/smpffs/ufs/ffs/ffs_extern.h#2 edit
.. //depot/projects/smpffs/ufs/ffs/ffs_inode.c#2 edit
.. //depot/projects/smpffs/ufs/ffs/ffs_snapshot.c#2 edit
.. //depot/projects/smpffs/ufs/ffs/ffs_softdep.c#2 edit
.. //depot/projects/smpffs/ufs/ffs/ffs_vfsops.c#2 edit
.. //depot/projects/smpffs/ufs/ffs/ffs_vnops.c#2 edit
.. //depot/projects/smpffs/ufs/ffs/fs.h#2 edit
.. //depot/projects/smpffs/ufs/ufs/ufsmount.h#2 edit
.. //depot/projects/smpffs/vm/vm_fault.c#2 edit
.. //depot/projects/smpffs/vm/vm_mmap.c#2 edit
.. //depot/projects/smpffs/vm/vm_object.c#2 edit
.. //depot/projects/smpffs/vm/vnode_pager.c#2 edit

Differences ...

==== //depot/projects/smpffs/geom/geom_vfs.c#2 (text+ko) ====

@@ -77,9 +77,7 @@
 		bp->b_ioflags |= BIO_ERROR;
 	bp->b_resid = bp->b_bcount - bip->bio_completed;
 	g_destroy_bio(bip);
-	mtx_lock(&Giant);
 	bufdone(bp);
-	mtx_unlock(&Giant);
 }
 
 void

==== //depot/projects/smpffs/kern/init_sysent.c#2 (text+ko) ====

@@ -2,7 +2,7 @@
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/kern/init_sysent.c,v 1.180 2004/11/25 12:08:16 phk Exp $
+ * $FreeBSD$
  * created from FreeBSD: src/sys/kern/syscalls.master,v 1.180 2004/11/25 12:07:28 phk Exp 
  */
 
@@ -40,11 +40,11 @@
 	{ SYF_MPSAFE | AS(link_args), (sy_call_t *)link },	/* 9 = link */
 	{ SYF_MPSAFE | AS(unlink_args), (sy_call_t *)unlink },	/* 10 = unlink */
 	{ 0, (sy_call_t *)nosys },			/* 11 = obsolete execv */
-	{ AS(chdir_args), (sy_call_t *)chdir },		/* 12 = chdir */
-	{ AS(fchdir_args), (sy_call_t *)fchdir },	/* 13 = fchdir */
-	{ AS(mknod_args), (sy_call_t *)mknod },		/* 14 = mknod */
-	{ AS(chmod_args), (sy_call_t *)chmod },		/* 15 = chmod */
-	{ AS(chown_args), (sy_call_t *)chown },		/* 16 = chown */
+	{ SYF_MPSAFE | AS(chdir_args), (sy_call_t *)chdir },	/* 12 = chdir */
+	{ SYF_MPSAFE | AS(fchdir_args), (sy_call_t *)fchdir },	/* 13 = fchdir */
+	{ SYF_MPSAFE | AS(mknod_args), (sy_call_t *)mknod },	/* 14 = mknod */
+	{ SYF_MPSAFE | AS(chmod_args), (sy_call_t *)chmod },	/* 15 = chmod */
+	{ SYF_MPSAFE | AS(chown_args), (sy_call_t *)chown },	/* 16 = chown */
 	{ SYF_MPSAFE | AS(obreak_args), (sy_call_t *)obreak },	/* 17 = break */
 	{ compat4(AS(freebsd4_getfsstat_args),getfsstat) },	/* 18 = old getfsstat */
 	{ compat(AS(olseek_args),lseek) },		/* 19 = old lseek */
@@ -61,10 +61,10 @@
 	{ SYF_MPSAFE | AS(accept_args), (sy_call_t *)accept },	/* 30 = accept */
 	{ SYF_MPSAFE | AS(getpeername_args), (sy_call_t *)getpeername },	/* 31 = getpeername */
 	{ SYF_MPSAFE | AS(getsockname_args), (sy_call_t *)getsockname },	/* 32 = getsockname */
-	{ AS(access_args), (sy_call_t *)access },	/* 33 = access */
-	{ AS(chflags_args), (sy_call_t *)chflags },	/* 34 = chflags */
-	{ AS(fchflags_args), (sy_call_t *)fchflags },	/* 35 = fchflags */
-	{ 0, (sy_call_t *)sync },			/* 36 = sync */
+	{ SYF_MPSAFE | AS(access_args), (sy_call_t *)access },	/* 33 = access */
+	{ SYF_MPSAFE | AS(chflags_args), (sy_call_t *)chflags },	/* 34 = chflags */
+	{ SYF_MPSAFE | AS(fchflags_args), (sy_call_t *)fchflags },	/* 35 = fchflags */
+	{ SYF_MPSAFE | 0, (sy_call_t *)sync },		/* 36 = sync */
 	{ SYF_MPSAFE | AS(kill_args), (sy_call_t *)kill },	/* 37 = kill */
 	{ compat(AS(ostat_args),stat) },		/* 38 = old stat */
 	{ SYF_MPSAFE | 0, (sy_call_t *)getppid },	/* 39 = getppid */
@@ -84,12 +84,12 @@
 	{ SYF_MPSAFE | AS(sigaltstack_args), (sy_call_t *)sigaltstack },	/* 53 = sigaltstack */
 	{ SYF_MPSAFE | AS(ioctl_args), (sy_call_t *)ioctl },	/* 54 = ioctl */
 	{ SYF_MPSAFE | AS(reboot_args), (sy_call_t *)reboot },	/* 55 = reboot */
-	{ AS(revoke_args), (sy_call_t *)revoke },	/* 56 = revoke */
-	{ AS(symlink_args), (sy_call_t *)symlink },	/* 57 = symlink */
-	{ AS(readlink_args), (sy_call_t *)readlink },	/* 58 = readlink */
+	{ SYF_MPSAFE | AS(revoke_args), (sy_call_t *)revoke },	/* 56 = revoke */
+	{ SYF_MPSAFE | AS(symlink_args), (sy_call_t *)symlink },	/* 57 = symlink */
+	{ SYF_MPSAFE | AS(readlink_args), (sy_call_t *)readlink },	/* 58 = readlink */
 	{ SYF_MPSAFE | AS(execve_args), (sy_call_t *)execve },	/* 59 = execve */
 	{ SYF_MPSAFE | AS(umask_args), (sy_call_t *)umask },	/* 60 = umask */
-	{ AS(chroot_args), (sy_call_t *)chroot },	/* 61 = chroot */
+	{ SYF_MPSAFE | AS(chroot_args), (sy_call_t *)chroot },	/* 61 = chroot */
 	{ compat(SYF_MPSAFE | AS(ofstat_args),fstat) },	/* 62 = old fstat */
 	{ compat(SYF_MPSAFE | AS(getkerninfo_args),getkerninfo) },	/* 63 = old getkerninfo */
 	{ compat(SYF_MPSAFE | 0,getpagesize) },		/* 64 = old getpagesize */
@@ -123,7 +123,7 @@
 	{ SYF_MPSAFE | AS(fcntl_args), (sy_call_t *)fcntl },	/* 92 = fcntl */
 	{ SYF_MPSAFE | AS(select_args), (sy_call_t *)select },	/* 93 = select */
 	{ 0, (sy_call_t *)nosys },			/* 94 = setdopt */
-	{ AS(fsync_args), (sy_call_t *)fsync },		/* 95 = fsync */
+	{ SYF_MPSAFE | AS(fsync_args), (sy_call_t *)fsync },	/* 95 = fsync */
 	{ SYF_MPSAFE | AS(setpriority_args), (sy_call_t *)setpriority },	/* 96 = setpriority */
 	{ SYF_MPSAFE | AS(socket_args), (sy_call_t *)socket },	/* 97 = socket */
 	{ SYF_MPSAFE | AS(connect_args), (sy_call_t *)connect },	/* 98 = connect */
@@ -151,22 +151,22 @@
 	{ SYF_MPSAFE | AS(readv_args), (sy_call_t *)readv },	/* 120 = readv */
 	{ SYF_MPSAFE | AS(writev_args), (sy_call_t *)writev },	/* 121 = writev */
 	{ SYF_MPSAFE | AS(settimeofday_args), (sy_call_t *)settimeofday },	/* 122 = settimeofday */
-	{ AS(fchown_args), (sy_call_t *)fchown },	/* 123 = fchown */
-	{ AS(fchmod_args), (sy_call_t *)fchmod },	/* 124 = fchmod */
+	{ SYF_MPSAFE | AS(fchown_args), (sy_call_t *)fchown },	/* 123 = fchown */
+	{ SYF_MPSAFE | AS(fchmod_args), (sy_call_t *)fchmod },	/* 124 = fchmod */
 	{ compat(SYF_MPSAFE | AS(recvfrom_args),recvfrom) },	/* 125 = old recvfrom */
 	{ SYF_MPSAFE | AS(setreuid_args), (sy_call_t *)setreuid },	/* 126 = setreuid */
 	{ SYF_MPSAFE | AS(setregid_args), (sy_call_t *)setregid },	/* 127 = setregid */
-	{ AS(rename_args), (sy_call_t *)rename },	/* 128 = rename */
+	{ SYF_MPSAFE | AS(rename_args), (sy_call_t *)rename },	/* 128 = rename */
 	{ compat(AS(otruncate_args),truncate) },	/* 129 = old truncate */
 	{ compat(AS(oftruncate_args),ftruncate) },	/* 130 = old ftruncate */
 	{ SYF_MPSAFE | AS(flock_args), (sy_call_t *)flock },	/* 131 = flock */
-	{ AS(mkfifo_args), (sy_call_t *)mkfifo },	/* 132 = mkfifo */
+	{ SYF_MPSAFE | AS(mkfifo_args), (sy_call_t *)mkfifo },	/* 132 = mkfifo */
 	{ SYF_MPSAFE | AS(sendto_args), (sy_call_t *)sendto },	/* 133 = sendto */
 	{ SYF_MPSAFE | AS(shutdown_args), (sy_call_t *)shutdown },	/* 134 = shutdown */
 	{ SYF_MPSAFE | AS(socketpair_args), (sy_call_t *)socketpair },	/* 135 = socketpair */
-	{ AS(mkdir_args), (sy_call_t *)mkdir },		/* 136 = mkdir */
-	{ AS(rmdir_args), (sy_call_t *)rmdir },		/* 137 = rmdir */
-	{ AS(utimes_args), (sy_call_t *)utimes },	/* 138 = utimes */
+	{ SYF_MPSAFE | AS(mkdir_args), (sy_call_t *)mkdir },	/* 136 = mkdir */
+	{ SYF_MPSAFE | AS(rmdir_args), (sy_call_t *)rmdir },	/* 137 = rmdir */
+	{ SYF_MPSAFE | AS(utimes_args), (sy_call_t *)utimes },	/* 138 = utimes */
 	{ 0, (sy_call_t *)nosys },			/* 139 = obsolete 4.2 sigreturn */
 	{ SYF_MPSAFE | AS(adjtime_args), (sy_call_t *)adjtime },	/* 140 = adjtime */
 	{ compat(SYF_MPSAFE | AS(ogetpeername_args),getpeername) },	/* 141 = old getpeername */
@@ -188,8 +188,8 @@
 	{ compat4(AS(freebsd4_statfs_args),statfs) },	/* 157 = old statfs */
 	{ compat4(AS(freebsd4_fstatfs_args),fstatfs) },	/* 158 = old fstatfs */
 	{ 0, (sy_call_t *)nosys },			/* 159 = nosys */
-	{ AS(lgetfh_args), (sy_call_t *)lgetfh },	/* 160 = lgetfh */
-	{ AS(getfh_args), (sy_call_t *)getfh },		/* 161 = getfh */
+	{ SYF_MPSAFE | AS(lgetfh_args), (sy_call_t *)lgetfh },	/* 160 = lgetfh */
+	{ SYF_MPSAFE | AS(getfh_args), (sy_call_t *)getfh },	/* 161 = getfh */
 	{ SYF_MPSAFE | AS(getdomainname_args), (sy_call_t *)getdomainname },	/* 162 = getdomainname */
 	{ SYF_MPSAFE | AS(setdomainname_args), (sy_call_t *)setdomainname },	/* 163 = setdomainname */
 	{ SYF_MPSAFE | AS(uname_args), (sy_call_t *)uname },	/* 164 = uname */
@@ -216,25 +216,25 @@
 	{ 0, (sy_call_t *)nosys },			/* 185 = lfs_markv */
 	{ 0, (sy_call_t *)nosys },			/* 186 = lfs_segclean */
 	{ 0, (sy_call_t *)nosys },			/* 187 = lfs_segwait */
-	{ AS(stat_args), (sy_call_t *)stat },		/* 188 = stat */
+	{ SYF_MPSAFE | AS(stat_args), (sy_call_t *)stat },	/* 188 = stat */
 	{ SYF_MPSAFE | AS(fstat_args), (sy_call_t *)fstat },	/* 189 = fstat */
-	{ AS(lstat_args), (sy_call_t *)lstat },		/* 190 = lstat */
-	{ AS(pathconf_args), (sy_call_t *)pathconf },	/* 191 = pathconf */
+	{ SYF_MPSAFE | AS(lstat_args), (sy_call_t *)lstat },	/* 190 = lstat */
+	{ SYF_MPSAFE | AS(pathconf_args), (sy_call_t *)pathconf },	/* 191 = pathconf */
 	{ SYF_MPSAFE | AS(fpathconf_args), (sy_call_t *)fpathconf },	/* 192 = fpathconf */
 	{ 0, (sy_call_t *)nosys },			/* 193 = nosys */
 	{ SYF_MPSAFE | AS(__getrlimit_args), (sy_call_t *)getrlimit },	/* 194 = getrlimit */
 	{ SYF_MPSAFE | AS(__setrlimit_args), (sy_call_t *)setrlimit },	/* 195 = setrlimit */
-	{ AS(getdirentries_args), (sy_call_t *)getdirentries },	/* 196 = getdirentries */
+	{ SYF_MPSAFE | AS(getdirentries_args), (sy_call_t *)getdirentries },	/* 196 = getdirentries */
 	{ SYF_MPSAFE | AS(mmap_args), (sy_call_t *)mmap },	/* 197 = mmap */
-	{ 0, (sy_call_t *)nosys },			/* 198 = __syscall */
-	{ AS(lseek_args), (sy_call_t *)lseek },		/* 199 = lseek */
-	{ AS(truncate_args), (sy_call_t *)truncate },	/* 200 = truncate */
-	{ AS(ftruncate_args), (sy_call_t *)ftruncate },	/* 201 = ftruncate */
+	{ SYF_MPSAFE | 0, (sy_call_t *)nosys },		/* 198 = __syscall */
+	{ SYF_MPSAFE | AS(lseek_args), (sy_call_t *)lseek },	/* 199 = lseek */
+	{ SYF_MPSAFE | AS(truncate_args), (sy_call_t *)truncate },	/* 200 = truncate */
+	{ SYF_MPSAFE | AS(ftruncate_args), (sy_call_t *)ftruncate },	/* 201 = ftruncate */
 	{ SYF_MPSAFE | AS(sysctl_args), (sy_call_t *)__sysctl },	/* 202 = __sysctl */
 	{ SYF_MPSAFE | AS(mlock_args), (sy_call_t *)mlock },	/* 203 = mlock */
 	{ SYF_MPSAFE | AS(munlock_args), (sy_call_t *)munlock },	/* 204 = munlock */
-	{ AS(undelete_args), (sy_call_t *)undelete },	/* 205 = undelete */
-	{ AS(futimes_args), (sy_call_t *)futimes },	/* 206 = futimes */
+	{ SYF_MPSAFE | AS(undelete_args), (sy_call_t *)undelete },	/* 205 = undelete */
+	{ SYF_MPSAFE | AS(futimes_args), (sy_call_t *)futimes },	/* 206 = futimes */
 	{ SYF_MPSAFE | AS(getpgid_args), (sy_call_t *)getpgid },	/* 207 = getpgid */
 	{ 0, (sy_call_t *)nosys },			/* 208 = newreboot */
 	{ SYF_MPSAFE | AS(poll_args), (sy_call_t *)poll },	/* 209 = poll */
@@ -282,7 +282,7 @@
 	{ SYF_MPSAFE | AS(rfork_args), (sy_call_t *)rfork },	/* 251 = rfork */
 	{ SYF_MPSAFE | AS(openbsd_poll_args), (sy_call_t *)openbsd_poll },	/* 252 = openbsd_poll */
 	{ SYF_MPSAFE | 0, (sy_call_t *)issetugid },	/* 253 = issetugid */
-	{ AS(lchown_args), (sy_call_t *)lchown },	/* 254 = lchown */
+	{ SYF_MPSAFE | AS(lchown_args), (sy_call_t *)lchown },	/* 254 = lchown */
 	{ 0, (sy_call_t *)nosys },			/* 255 = nosys */
 	{ 0, (sy_call_t *)nosys },			/* 256 = nosys */
 	{ 0, (sy_call_t *)nosys },			/* 257 = nosys */
@@ -300,15 +300,15 @@
 	{ 0, (sy_call_t *)nosys },			/* 269 = nosys */
 	{ 0, (sy_call_t *)nosys },			/* 270 = nosys */
 	{ 0, (sy_call_t *)nosys },			/* 271 = nosys */
-	{ AS(getdents_args), (sy_call_t *)getdents },	/* 272 = getdents */
+	{ SYF_MPSAFE | AS(getdents_args), (sy_call_t *)getdents },	/* 272 = getdents */
 	{ 0, (sy_call_t *)nosys },			/* 273 = nosys */
-	{ AS(lchmod_args), (sy_call_t *)lchmod },	/* 274 = lchmod */
+	{ SYF_MPSAFE | AS(lchmod_args), (sy_call_t *)lchmod },	/* 274 = lchmod */
 	{ AS(lchown_args), (sy_call_t *)lchown },	/* 275 = netbsd_lchown */
-	{ AS(lutimes_args), (sy_call_t *)lutimes },	/* 276 = lutimes */
+	{ SYF_MPSAFE | AS(lutimes_args), (sy_call_t *)lutimes },	/* 276 = lutimes */
 	{ SYF_MPSAFE | AS(msync_args), (sy_call_t *)msync },	/* 277 = netbsd_msync */
-	{ AS(nstat_args), (sy_call_t *)nstat },		/* 278 = nstat */
+	{ SYF_MPSAFE | AS(nstat_args), (sy_call_t *)nstat },	/* 278 = nstat */
 	{ SYF_MPSAFE | AS(nfstat_args), (sy_call_t *)nfstat },	/* 279 = nfstat */
-	{ AS(nlstat_args), (sy_call_t *)nlstat },	/* 280 = nlstat */
+	{ SYF_MPSAFE | AS(nlstat_args), (sy_call_t *)nlstat },	/* 280 = nlstat */
 	{ 0, (sy_call_t *)nosys },			/* 281 = nosys */
 	{ 0, (sy_call_t *)nosys },			/* 282 = nosys */
 	{ 0, (sy_call_t *)nosys },			/* 283 = nosys */
@@ -354,7 +354,7 @@
 	{ 0, (sy_call_t *)nosys },			/* 323 = obsolete thr_wakeup */
 	{ SYF_MPSAFE | AS(mlockall_args), (sy_call_t *)mlockall },	/* 324 = mlockall */
 	{ SYF_MPSAFE | 0, (sy_call_t *)munlockall },	/* 325 = munlockall */
-	{ AS(__getcwd_args), (sy_call_t *)__getcwd },	/* 326 = __getcwd */
+	{ SYF_MPSAFE | AS(__getcwd_args), (sy_call_t *)__getcwd },	/* 326 = __getcwd */
 	{ SYF_MPSAFE | AS(sched_setparam_args), (sy_call_t *)sched_setparam },	/* 327 = sched_setparam */
 	{ SYF_MPSAFE | AS(sched_getparam_args), (sy_call_t *)sched_getparam },	/* 328 = sched_getparam */
 	{ SYF_MPSAFE | AS(sched_setscheduler_args), (sy_call_t *)sched_setscheduler },	/* 329 = sched_setscheduler */
@@ -404,7 +404,7 @@
 	{ AS(extattr_delete_fd_args), (sy_call_t *)extattr_delete_fd },	/* 373 = extattr_delete_fd */
 	{ SYF_MPSAFE | AS(__setugid_args), (sy_call_t *)__setugid },	/* 374 = __setugid */
 	{ AS(nfsclnt_args), (sy_call_t *)nosys },	/* 375 = nfsclnt */
-	{ AS(eaccess_args), (sy_call_t *)eaccess },	/* 376 = eaccess */
+	{ SYF_MPSAFE | AS(eaccess_args), (sy_call_t *)eaccess },	/* 376 = eaccess */
 	{ 0, (sy_call_t *)nosys },			/* 377 = afs_syscall */
 	{ SYF_MPSAFE | AS(nmount_args), (sy_call_t *)nmount },	/* 378 = nmount */
 	{ SYF_MPSAFE | 0, (sy_call_t *)kse_exit },	/* 379 = kse_exit */
@@ -419,13 +419,13 @@
 	{ SYF_MPSAFE | AS(__mac_set_fd_args), (sy_call_t *)__mac_set_fd },	/* 388 = __mac_set_fd */
 	{ SYF_MPSAFE | AS(__mac_set_file_args), (sy_call_t *)__mac_set_file },	/* 389 = __mac_set_file */
 	{ AS(kenv_args), (sy_call_t *)kenv },		/* 390 = kenv */
-	{ AS(lchflags_args), (sy_call_t *)lchflags },	/* 391 = lchflags */
+	{ SYF_MPSAFE | AS(lchflags_args), (sy_call_t *)lchflags },	/* 391 = lchflags */
 	{ AS(uuidgen_args), (sy_call_t *)uuidgen },	/* 392 = uuidgen */
 	{ SYF_MPSAFE | AS(sendfile_args), (sy_call_t *)sendfile },	/* 393 = sendfile */
 	{ SYF_MPSAFE | AS(mac_syscall_args), (sy_call_t *)mac_syscall },	/* 394 = mac_syscall */
-	{ AS(getfsstat_args), (sy_call_t *)getfsstat },	/* 395 = getfsstat */
-	{ AS(statfs_args), (sy_call_t *)statfs },	/* 396 = statfs */
-	{ AS(fstatfs_args), (sy_call_t *)fstatfs },	/* 397 = fstatfs */
+	{ SYF_MPSAFE | AS(getfsstat_args), (sy_call_t *)getfsstat },	/* 395 = getfsstat */
+	{ SYF_MPSAFE | AS(statfs_args), (sy_call_t *)statfs },	/* 396 = statfs */
+	{ SYF_MPSAFE | AS(fstatfs_args), (sy_call_t *)fstatfs },	/* 397 = fstatfs */
 	{ AS(fhstatfs_args), (sy_call_t *)fhstatfs },	/* 398 = fhstatfs */
 	{ 0, (sy_call_t *)nosys },			/* 399 = nosys */
 	{ SYF_MPSAFE | AS(ksem_close_args), (sy_call_t *)lkmressys },	/* 400 = ksem_close */

==== //depot/projects/smpffs/kern/kern_descrip.c#2 (text+ko) ====

@@ -1141,11 +1141,12 @@
 	}
 	vp = fp->f_vnode;
 	if (vp != NULL) {
-		mtx_lock(&Giant);
+		int vfslocked;
+		vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
 		error = VOP_PATHCONF(vp, uap->name, td->td_retval);
 		VOP_UNLOCK(vp, 0, td);
-		mtx_unlock(&Giant);
+		VFS_UNLOCK_GIANT(vfslocked);
 	} else if (fp->f_type == DTYPE_PIPE || fp->f_type == DTYPE_SOCKET) {
 		if (uap->name != _PC_PIPE_BUF) {
 			error = EINVAL;
@@ -1480,8 +1481,6 @@
 	struct vnode *vp;
 	struct flock lf;
 
-	GIANT_REQUIRED;		/* VFS */
-
 	/* Certain daemons might not have file descriptors. */
 	fdp = td->td_proc->p_fd;
 	if (fdp == NULL)
@@ -1512,6 +1511,7 @@
 				lf.l_len = 0;
 				lf.l_type = F_UNLCK;
 				vp = fp->f_vnode;
+				VFS_ASSERT_GIANT(vp->v_mount);
 				(void) VOP_ADVLOCK(vp,
 						   (caddr_t)td->td_proc->
 						   p_leader,
@@ -1814,13 +1814,15 @@
 	 * aren't passed with the descriptor.
 	 */
 	if (fp->f_type == DTYPE_VNODE) {
-		mtx_lock(&Giant);
+		int vfslocked;
+
+		vp = fp->f_vnode;
+		vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 		if ((td->td_proc->p_leader->p_flag & P_ADVLOCK) != 0) {
 			lf.l_whence = SEEK_SET;
 			lf.l_start = 0;
 			lf.l_len = 0;
 			lf.l_type = F_UNLCK;
-			vp = fp->f_vnode;
 			(void) VOP_ADVLOCK(vp, (caddr_t)td->td_proc->p_leader,
 					   F_UNLCK, &lf, F_POSIX);
 		}
@@ -1858,7 +1860,7 @@
 			}
 			FILEDESC_UNLOCK(fdp);
 		}
-		mtx_unlock(&Giant);
+		VFS_UNLOCK_GIANT(vfslocked);
 	}
 	return (fdrop(fp, td));
 }
@@ -1952,8 +1954,6 @@
 	struct file *fp;
 	int error;
 
-	GIANT_REQUIRED;		/* VFS */
-
 	*vpp = NULL;
 	if ((error = _fget(td, fd, &fp, 0, 0)) != 0)
 		return (error);

==== //depot/projects/smpffs/kern/kern_lock.c#2 (text+ko) ====

@@ -136,10 +136,10 @@
 }
 
 static int
-acquire(struct lock **lkpp, int extflags, int wanted) {
+acquire(struct lock **lkpp, int extflags, int wanted)
+{
 	struct lock *lkp = *lkpp;
 	int s, error;
-
 	CTR3(KTR_LOCK,
 	    "acquire(): lkp == %p, extflags == 0x%x, wanted == 0x%x",
 	    lkp, extflags, wanted);
@@ -148,7 +148,7 @@
 		return EBUSY;
 	}
 
-	if (((lkp->lk_flags | extflags) & LK_NOPAUSE) == 0) {
+	if (((lkp->lk_flags | extflags) & (LK_NOPAUSE|LK_INTERLOCK)) == 0) {
 		error = apause(lkp, wanted);
 		if (error == 0)
 			return 0;
@@ -214,10 +214,6 @@
 	struct thread *thr;
 	int extflags, lockflags;
 
-	CTR5(KTR_LOCK,
-	    "lockmgr(): lkp == %p (lk_wmesg == \"%s\"), flags == 0x%x, "
-	    "interlkp == %p, td == %p", lkp, lkp->lk_wmesg, flags, interlkp, td);
-
 	error = 0;
 	if (td == NULL)
 		thr = LK_KERNPROC;
@@ -226,6 +222,17 @@
 
 	if ((flags & LK_INTERNAL) == 0)
 		mtx_lock(lkp->lk_interlock);
+#ifdef DEBUG_LOCKS
+	CTR6(KTR_LOCK,
+	    "lockmgr(): lkp == %p (lk_wmesg == \"%s\"), flags == 0x%x, "
+	    "td == %p %s:%d", lkp, lkp->lk_wmesg, flags, td, file, line);
+#else
+	CTR6(KTR_LOCK,
+	    "lockmgr(): lkp == %p (lk_wmesg == \"%s\"), owner == %p, exclusivecount == %d, flags == 0x%x, "
+	    "td == %p", lkp, lkp->lk_wmesg, lkp->lk_lockholder,
+	    lkp->lk_exclusivecount, flags, td);
+#endif
+
 	if (flags & LK_INTERLOCK) {
 		mtx_assert(interlkp, MA_OWNED | MA_NOTRECURSED);
 		mtx_unlock(interlkp);
@@ -479,9 +486,11 @@
 		return EBUSY;
 	}
 
-	error = apause(lkp, LK_ALL);
-	if (error == 0)
-		return 0;
+	if ((extflags & LK_INTERLOCK) == 0) {
+		error = apause(lkp, LK_ALL);
+		if (error == 0)
+			return 0;
+	}
 
 	while (lkp->lk_flags & LK_ALL) {
 		lkp->lk_flags |= LK_WAITDRAIN;

==== //depot/projects/smpffs/kern/syscalls.c#2 (text+ko) ====

@@ -2,7 +2,7 @@
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/kern/syscalls.c,v 1.166 2004/11/25 12:08:16 phk Exp $
+ * $FreeBSD$
  * created from FreeBSD: src/sys/kern/syscalls.master,v 1.180 2004/11/25 12:07:28 phk Exp 
  */
 

==== //depot/projects/smpffs/kern/syscalls.master#2 (text+ko) ====

@@ -61,11 +61,11 @@
 9	MSTD	{ int link(char *path, char *link); }
 10	MSTD	{ int unlink(char *path); }
 11	OBSOL	execv
-12	STD	{ int chdir(char *path); }
-13	STD	{ int fchdir(int fd); }
-14	STD	{ int mknod(char *path, int mode, int dev); }
-15	STD	{ int chmod(char *path, int mode); }
-16	STD	{ int chown(char *path, int uid, int gid); }
+12	MSTD	{ int chdir(char *path); }
+13	MSTD	{ int fchdir(int fd); }
+14	MSTD	{ int mknod(char *path, int mode, int dev); }
+15	MSTD	{ int chmod(char *path, int mode); }
+16	MSTD	{ int chown(char *path, int uid, int gid); }
 17	MSTD	{ int obreak(char *nsize); } break obreak_args int
 18	COMPAT4	{ int getfsstat(struct ostatfs *buf, long bufsize, int flags); }
 19	COMPAT	{ long lseek(int fd, long offset, int whence); }
@@ -88,10 +88,10 @@
 		    __socklen_t * __restrict alen); }
 32	MSTD	{ int getsockname(int fdes, struct sockaddr * __restrict asa, \
 		    __socklen_t * __restrict alen); }
-33	STD	{ int access(char *path, int flags); }
-34	STD	{ int chflags(char *path, int flags); }
-35	STD	{ int fchflags(int fd, int flags); }
-36	STD	{ int sync(void); }
+33	MSTD	{ int access(char *path, int flags); }
+34	MSTD	{ int chflags(char *path, int flags); }
+35	MSTD	{ int fchflags(int fd, int flags); }
+36	MSTD	{ int sync(void); }
 37	MSTD	{ int kill(int pid, int signum); }
 38	COMPAT	{ int stat(char *path, struct ostat *ub); }
 39	MSTD	{ pid_t getppid(void); }
@@ -116,12 +116,12 @@
 53	MSTD	{ int sigaltstack(stack_t *ss, stack_t *oss); }
 54	MSTD	{ int ioctl(int fd, u_long com, caddr_t data); }
 55	MSTD	{ int reboot(int opt); }
-56	STD	{ int revoke(char *path); }
-57	STD	{ int symlink(char *path, char *link); }
-58	STD	{ int readlink(char *path, char *buf, int count); }
+56	MSTD	{ int revoke(char *path); }
+57	MSTD	{ int symlink(char *path, char *link); }
+58	MSTD	{ int readlink(char *path, char *buf, int count); }
 59	MSTD	{ int execve(char *fname, char **argv, char **envv); }
 60	MSTD	{ int umask(int newmask); } umask umask_args int
-61	STD	{ int chroot(char *path); }
+61	MSTD	{ int chroot(char *path); }
 62	MCOMPAT	{ int fstat(int fd, struct ostat *sb); }
 63	MCOMPAT	{ int getkerninfo(int op, char *where, size_t *size, \
 		    int arg); } getkerninfo getkerninfo_args int
@@ -163,7 +163,7 @@
 93	MSTD	{ int select(int nd, fd_set *in, fd_set *ou, \
 		    fd_set *ex, struct timeval *tv); }
 94	UNIMPL	setdopt
-95	STD	{ int fsync(int fd); }
+95	MSTD	{ int fsync(int fd); }
 96	MSTD	{ int setpriority(int which, int who, int prio); }
 97	MSTD	{ int socket(int domain, int type, int protocol); }
 98	MSTD	{ int connect(int s, caddr_t name, int namelen); }
@@ -197,26 +197,26 @@
 120	MSTD	{ int readv(int fd, struct iovec *iovp, u_int iovcnt); }
 121	MSTD	{ int writev(int fd, struct iovec *iovp, u_int iovcnt); }
 122	MSTD	{ int settimeofday(struct timeval *tv, struct timezone *tzp); }
-123	STD	{ int fchown(int fd, int uid, int gid); }
-124	STD	{ int fchmod(int fd, int mode); }
+123	MSTD	{ int fchown(int fd, int uid, int gid); }
+124	MSTD	{ int fchmod(int fd, int mode); }
 125	MCPT_NOA { int recvfrom(int s, caddr_t buf, size_t len, int flags, \
 		    caddr_t from, int *fromlenaddr); } \
 		    recvfrom recvfrom_args int
 126	MSTD	{ int setreuid(int ruid, int euid); }
 127	MSTD	{ int setregid(int rgid, int egid); }
-128	STD	{ int rename(char *from, char *to); }
+128	MSTD	{ int rename(char *from, char *to); }
 129	COMPAT	{ int truncate(char *path, long length); }
 130	COMPAT	{ int ftruncate(int fd, long length); }
 131	MSTD	{ int flock(int fd, int how); }
-132	STD	{ int mkfifo(char *path, int mode); }
+132	MSTD	{ int mkfifo(char *path, int mode); }
 133	MSTD	{ int sendto(int s, caddr_t buf, size_t len, int flags, \
 		    caddr_t to, int tolen); }
 134	MSTD	{ int shutdown(int s, int how); }
 135	MSTD	{ int socketpair(int domain, int type, int protocol, \
 		    int *rsv); }
-136	STD	{ int mkdir(char *path, int mode); }
-137	STD	{ int rmdir(char *path); }
-138	STD	{ int utimes(char *path, struct timeval *tptr); }
+136	MSTD	{ int mkdir(char *path, int mode); }
+137	MSTD	{ int rmdir(char *path); }
+138	MSTD	{ int utimes(char *path, struct timeval *tptr); }
 139	OBSOL	4.2 sigreturn
 140	MSTD	{ int adjtime(struct timeval *delta, \
 		    struct timeval *olddelta); }
@@ -247,8 +247,8 @@
 157	COMPAT4	{ int statfs(char *path, struct ostatfs *buf); }
 158	COMPAT4	{ int fstatfs(int fd, struct ostatfs *buf); }
 159	UNIMPL	nosys
-160	STD	{ int lgetfh(char *fname, struct fhandle *fhp); }
-161	STD	{ int getfh(char *fname, struct fhandle *fhp); }
+160	MSTD	{ int lgetfh(char *fname, struct fhandle *fhp); }
+161	MSTD	{ int getfh(char *fname, struct fhandle *fhp); }
 162	MSTD	{ int getdomainname(char *domainname, int len); }
 163	MSTD	{ int setdomainname(char *domainname, int len); }
 164	MSTD	{ int uname(struct utsname *name); }
@@ -286,31 +286,31 @@
 185	UNIMPL	lfs_markv
 186	UNIMPL	lfs_segclean
 187	UNIMPL	lfs_segwait
-188	STD	{ int stat(char *path, struct stat *ub); }
+188	MSTD	{ int stat(char *path, struct stat *ub); }
 189	MSTD	{ int fstat(int fd, struct stat *sb); }
-190	STD	{ int lstat(char *path, struct stat *ub); }
-191	STD	{ int pathconf(char *path, int name); }
+190	MSTD	{ int lstat(char *path, struct stat *ub); }
+191	MSTD	{ int pathconf(char *path, int name); }
 192	MSTD	{ int fpathconf(int fd, int name); }
 193	UNIMPL	nosys
 194	MSTD	{ int getrlimit(u_int which, struct rlimit *rlp); } \
 		    getrlimit __getrlimit_args int
 195	MSTD	{ int setrlimit(u_int which, struct rlimit *rlp); } \
 		    setrlimit __setrlimit_args int
-196	STD	{ int getdirentries(int fd, char *buf, u_int count, \
+196	MSTD	{ int getdirentries(int fd, char *buf, u_int count, \
 		    long *basep); }
 197	MSTD	{ caddr_t mmap(caddr_t addr, size_t len, int prot, \
 		    int flags, int fd, int pad, off_t pos); }
-198	STD	{ int nosys(void); } __syscall __syscall_args int
-199	STD	{ off_t lseek(int fd, int pad, off_t offset, int whence); }
-200	STD	{ int truncate(char *path, int pad, off_t length); }
-201	STD	{ int ftruncate(int fd, int pad, off_t length); }
+198	MSTD	{ int nosys(void); } __syscall __syscall_args int
+199	MSTD	{ off_t lseek(int fd, int pad, off_t offset, int whence); }
+200	MSTD	{ int truncate(char *path, int pad, off_t length); }
+201	MSTD	{ int ftruncate(int fd, int pad, off_t length); }
 202	MSTD	{ int __sysctl(int *name, u_int namelen, void *old, \
 		    size_t *oldlenp, void *new, size_t newlen); } \
 		    __sysctl sysctl_args int
 203	MSTD	{ int mlock(const void *addr, size_t len); }
 204	MSTD	{ int munlock(const void *addr, size_t len); }
-205	STD	{ int undelete(char *path); }
-206	STD	{ int futimes(int fd, struct timeval *tptr); }
+205	MSTD	{ int undelete(char *path); }
+206	MSTD	{ int futimes(int fd, struct timeval *tptr); }
 207	MSTD	{ int getpgid(pid_t pid); }
 208	UNIMPL	newreboot (NetBSD)
 209	MSTD	{ int poll(struct pollfd *fds, u_int nfds, int timeout); }
@@ -374,7 +374,7 @@
 252	MSTD	{ int openbsd_poll(struct pollfd *fds, u_int nfds, \
 		    int timeout); }
 253	MSTD	{ int issetugid(void); }
-254	STD	{ int lchown(char *path, int uid, int gid); }
+254	MSTD	{ int lchown(char *path, int uid, int gid); }
 255	UNIMPL	nosys
 256	UNIMPL	nosys
 257	UNIMPL	nosys
@@ -392,17 +392,17 @@
 269	UNIMPL	nosys
 270	UNIMPL	nosys
 271	UNIMPL	nosys
-272	STD	{ int getdents(int fd, char *buf, size_t count); }
+272	MSTD	{ int getdents(int fd, char *buf, size_t count); }
 273	UNIMPL	nosys
-274	STD	{ int lchmod(char *path, mode_t mode); }
+274	MSTD	{ int lchmod(char *path, mode_t mode); }
 275	NOPROTO { int lchown(char *path, uid_t uid, gid_t gid); } \
 		    netbsd_lchown lchown_args int
-276	STD	{ int lutimes(char *path, struct timeval *tptr); }
+276	MSTD	{ int lutimes(char *path, struct timeval *tptr); }
 277	MNOPROTO { int msync(void *addr, size_t len, int flags); } \
 		    netbsd_msync msync_args int
-278	STD	{ int nstat(char *path, struct nstat *ub); }
+278	MSTD	{ int nstat(char *path, struct nstat *ub); }
 279	MSTD	{ int nfstat(int fd, struct nstat *sb); }
-280	STD	{ int nlstat(char *path, struct nstat *ub); }
+280	MSTD	{ int nlstat(char *path, struct nstat *ub); }
 281	UNIMPL	nosys
 282	UNIMPL	nosys
 283	UNIMPL	nosys
@@ -453,7 +453,7 @@
 323	OBSOL	thr_wakeup
 324     MSTD	{ int mlockall(int how); }
 325     MSTD	{ int munlockall(void); }
-326     STD	{ int __getcwd(u_char *buf, u_int buflen); }
+326     MSTD	{ int __getcwd(u_char *buf, u_int buflen); }
 
 327     MSTD	{ int sched_setparam (pid_t pid, \
 		    const struct sched_param *param); }
@@ -471,7 +471,7 @@
 335	MSTD	{ int utrace(const void *addr, size_t len); }
 336	MCOMPAT4 { int sendfile(int fd, int s, off_t offset, size_t nbytes, \
 		    struct sf_hdtr *hdtr, off_t *sbytes, int flags); }
-337	STD	{ int kldsym(int fileid, int cmd, void *data); }
+337	MSTD	{ int kldsym(int fileid, int cmd, void *data); }
 338	MSTD	{ int jail(struct jail *jail); }
 339	UNIMPL	pioctl
 340	MSTD	{ int sigprocmask(int how, const sigset_t *set, \
@@ -534,7 +534,7 @@
 		    const char *attrname); }
 374	MSTD	{ int __setugid(int flag); }
 375	NOIMPL	{ int nfsclnt(int flag, caddr_t argp); }
-376	STD	{ int eaccess(char *path, int flags); }
+376	MSTD	{ int eaccess(char *path, int flags); }
 377	UNIMPL	afs_syscall
 378	MSTD	{ int nmount(struct iovec *iovp, unsigned int iovcnt, \
 		    int flags); }
@@ -555,16 +555,16 @@
 		    struct mac *mac_p); }
 390	STD	{ int kenv(int what, const char *name, char *value, \
 		    int len); }
-391	STD	{ int lchflags(const char *path, int flags); }
+391	MSTD	{ int lchflags(const char *path, int flags); }
 392	STD	{ int uuidgen(struct uuid *store, int count); }
 393	MSTD	{ int sendfile(int fd, int s, off_t offset, size_t nbytes, \
 		    struct sf_hdtr *hdtr, off_t *sbytes, int flags); }
 394	MSTD	{ int mac_syscall(const char *policy, int call, \
 		    void *arg); }
-395	STD	{ int getfsstat(struct statfs *buf, long bufsize, \
+395	MSTD	{ int getfsstat(struct statfs *buf, long bufsize, \
 		    int flags); }
-396	STD	{ int statfs(char *path, struct statfs *buf); }
-397	STD	{ int fstatfs(int fd, struct statfs *buf); }
+396	MSTD	{ int statfs(char *path, struct statfs *buf); }
+397	MSTD	{ int fstatfs(int fd, struct statfs *buf); }
 398	STD	{ int fhstatfs(const struct fhandle *u_fhp, \
 		    struct statfs *buf); }
 399	UNIMPL	nosys

==== //depot/projects/smpffs/kern/vfs_bio.c#2 (text+ko) ====

@@ -403,8 +403,6 @@
 		  vm_page_t m)
 {
 
-	GIANT_REQUIRED;
-
 	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
 	if (bp->b_flags & B_CACHE) {
 		int base = (foff + off) & PAGE_MASK;
@@ -523,8 +521,6 @@
 	struct buf *bp;
 	int i;
 
-	GIANT_REQUIRED;
-
 	mtx_init(&bqlock, "buf queue lock", NULL, MTX_DEF);
 	mtx_init(&rbreqlock, "runningbufspace lock", NULL, MTX_DEF);
 	mtx_init(&nblock, "needsbuffer lock", NULL, MTX_DEF);
@@ -628,8 +624,6 @@
 bfreekva(struct buf *bp)
 {
 
-	GIANT_REQUIRED;
-
 	if (bp->b_kvasize) {
 		atomic_add_int(&buffreekvacnt, 1);
 		atomic_subtract_int(&bufspace, bp->b_kvasize);
@@ -652,9 +646,10 @@
 bremfree(struct buf *bp)
 {
 
+	CTR3(KTR_BUF, "bremfree(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags);
 	KASSERT(BUF_REFCNT(bp), ("bremfree: buf must be locked."));
 	KASSERT((bp->b_flags & B_REMFREE) == 0 && bp->b_qindex != QUEUE_NONE,
-	    ("bremfree: buffer not on a queue."));
+	    ("bremfree: buffer %p not on a queue.", bp));
 
 	bp->b_flags |= B_REMFREE;
 	/* Fixup numfreebuffers count.  */
@@ -687,16 +682,15 @@
 {
 	int s = splbio();
 
+	CTR3(KTR_BUF, "bremfreel(%p) vp %p flags %X",
+	    bp, bp->b_vp, bp->b_flags);
+	KASSERT(BUF_REFCNT(bp), ("bremfreel: buffer %p not locked.", bp));
+	KASSERT(bp->b_qindex != QUEUE_NONE,
+	    ("bremfreel: buffer %p not on a queue.", bp));
 	mtx_assert(&bqlock, MA_OWNED);
 
-	if (bp->b_qindex != QUEUE_NONE) {
-		KASSERT(BUF_REFCNT(bp) == 1, ("bremfree: bp %p not locked",bp));
-		TAILQ_REMOVE(&bufqueues[bp->b_qindex], bp, b_freelist);
-		bp->b_qindex = QUEUE_NONE;
-	} else {
-		if (BUF_REFCNT(bp) <= 1)
-			panic("bremfree: removing a buffer not on a queue");
-	}
+	TAILQ_REMOVE(&bufqueues[bp->b_qindex], bp, b_freelist);
+	bp->b_qindex = QUEUE_NONE;
 	/*
 	 * If this was a delayed bremfree() we only need to remove the buffer
 	 * from the queue and return the stats are already done.
@@ -746,6 +740,7 @@
 	int i;
 	int rv = 0, readwait = 0;
 
+	CTR3(KTR_BUF, "breadn(%p, %jd, %d)", vp, blkno, size);
 	*bpp = bp = getblk(vp, blkno, size, 0, 0, 0);
 
 	/* if not found in cache, do some I/O */
@@ -809,6 +804,7 @@
 	int oldflags, s;
 	struct buf *newbp;
 
+	CTR3(KTR_BUF, "bufwrite(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags);
 	if (bp->b_flags & B_INVAL) {
 		brelse(bp);
 		return (0);
@@ -1004,8 +1000,7 @@
 	struct buf *nbp;
 	struct bufobj *bo;
 
-	GIANT_REQUIRED;
-
+	CTR3(KTR_BUF, "bdwrite(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags);
 	KASSERT(bp->b_bufobj != NULL, ("No b_bufobj %p", bp));
 	KASSERT(BUF_REFCNT(bp) != 0, ("bdwrite: buffer is not busy"));
 
@@ -1023,38 +1018,45 @@
 	 */
 	vp = bp->b_vp;
 	bo = bp->b_bufobj;
-	BO_LOCK(bo);
-	if (td->td_pflags & TDP_COWINPROGRESS) {
-		recursiveflushes++;
-	} else if (bo->bo_dirty.bv_cnt > dirtybufthresh + 10) {
-		BO_UNLOCK(bo);
-		(void) VOP_FSYNC(vp, td->td_ucred, MNT_NOWAIT, td);
+	if ((td->td_pflags & TDP_COWINPROGRESS) == 0) {
 		BO_LOCK(bo);
-		altbufferflushes++;
-	} else if (bo->bo_dirty.bv_cnt > dirtybufthresh) {
-		/*
-		 * Try to find a buffer to flush.
-		 */
-		TAILQ_FOREACH(nbp, &bo->bo_dirty.bv_hd, b_bobufs) {
-			if ((nbp->b_vflags & BV_BKGRDINPROG) ||
-			    buf_countdeps(nbp, 0) ||
-			    BUF_LOCK(nbp, LK_EXCLUSIVE | LK_NOWAIT, NULL))
-				continue;
-			if (bp == nbp)
-				panic("bdwrite: found ourselves");
+		if (bo->bo_dirty.bv_cnt > dirtybufthresh + 10) {
 			BO_UNLOCK(bo);
-			if (nbp->b_flags & B_CLUSTEROK) {
-				vfs_bio_awrite(nbp);
-			} else {
-				bremfree(nbp);
-				bawrite(nbp);
+			(void) VOP_FSYNC(vp, td->td_ucred, MNT_NOWAIT, td);
+			altbufferflushes++;
+		} else if (bo->bo_dirty.bv_cnt > dirtybufthresh) {
+			/*
+			 * Try to find a buffer to flush.
+			 */
+			TAILQ_FOREACH(nbp, &bo->bo_dirty.bv_hd, b_bobufs) {
+				if ((nbp->b_vflags & BV_BKGRDINPROG) ||
+				    BUF_LOCK(nbp,
+				    LK_EXCLUSIVE | LK_NOWAIT, NULL))
+					continue;
+				if (bp == nbp)
+					panic("bdwrite: found ourselves");
+				BO_UNLOCK(bo);
+				/* Don't countdeps with the bo lock held. */
+				if (buf_countdeps(nbp, 0)) {
+					BO_LOCK(bo);
+					BUF_UNLOCK(nbp);
+					continue;
+				}
+				if (nbp->b_flags & B_CLUSTEROK) {
+					vfs_bio_awrite(nbp);
+				} else {
+					bremfree(nbp);
+					bawrite(nbp);
+				}
+				dirtybufferflushes++;
+				break;
 			}
-			BO_LOCK(bo);
-			dirtybufferflushes++;
-			break;
-		}
-	}
-	BO_UNLOCK(bo);
+			if (nbp == NULL)
+				BO_UNLOCK(bo);
+		} else
+			BO_UNLOCK(bo);
+	} else
+		recursiveflushes++;
 
 	bdirty(bp);
 	/*
@@ -1127,6 +1129,9 @@
 bdirty(struct buf *bp)
 {
 
+	CTR3(KTR_BUF, "bdirty(%p) vp %p flags %X",
+	    bp, bp->b_vp, bp->b_flags);
+	KASSERT(BUF_REFCNT(bp) == 1, ("bdirty: bp %p not locked",bp));
 	KASSERT(bp->b_bufobj != NULL, ("No b_bufobj %p", bp));
 	KASSERT(bp->b_flags & B_REMFREE || bp->b_qindex == QUEUE_NONE,
 	    ("bdirty: buffer %p still on queue %d", bp, bp->b_qindex));
@@ -1134,7 +1139,7 @@
 	bp->b_iocmd = BIO_WRITE;
 
 	if ((bp->b_flags & B_DELWRI) == 0) {
-		bp->b_flags |= B_DONE | B_DELWRI;
+		bp->b_flags |= /* XXX B_DONE | */ B_DELWRI;
 		reassignbuf(bp);
 		atomic_add_int(&numdirtybuffers, 1);
 		bd_wakeup((lodirtybuffers + hidirtybuffers) / 2);
@@ -1157,9 +1162,11 @@
 bundirty(struct buf *bp)
 {
 
+	CTR3(KTR_BUF, "bundirty(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags);
 	KASSERT(bp->b_bufobj != NULL, ("No b_bufobj %p", bp));
 	KASSERT(bp->b_flags & B_REMFREE || bp->b_qindex == QUEUE_NONE,
 	    ("bundirty: buffer %p still on queue %d", bp, bp->b_qindex));
+	KASSERT(BUF_REFCNT(bp) == 1, ("bundirty: bp %p not locked",bp));
 
 	if (bp->b_flags & B_DELWRI) {
 		bp->b_flags &= ~B_DELWRI;
@@ -1207,7 +1214,6 @@
 	if (numdirtybuffers >= hidirtybuffers) {
 		int s;
 
-		mtx_lock(&Giant);
 		s = splbio();
 		mtx_lock(&nblock);
 		while (numdirtybuffers >= hidirtybuffers) {
@@ -1218,7 +1224,6 @@
 		}
 		splx(s);
 		mtx_unlock(&nblock);
-		mtx_unlock(&Giant);
 	}
 }
 
@@ -1244,8 +1249,8 @@
 {
 	int s;
 
-	GIANT_REQUIRED;
-
+	CTR3(KTR_BUF, "brelse(%p) vp %p flags %X",
+	    bp, bp->b_vp, bp->b_flags);
 	KASSERT(!(bp->b_flags & (B_CLUSTER|B_PAGING)),
 	    ("brelse: inappropriate B_PAGING or B_CLUSTER bp %p", bp));
 
@@ -1525,6 +1530,7 @@
 
 	s = splbio();
 
+	CTR3(KTR_BUF, "bqrelse(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags);
 	KASSERT(!(bp->b_flags & (B_CLUSTER|B_PAGING)),
 	    ("bqrelse: inappropriate B_PAGING or B_CLUSTER bp %p", bp));
 
@@ -1595,7 +1601,6 @@
 	int i;
 	vm_page_t m;
 
-	GIANT_REQUIRED;
 	VM_OBJECT_LOCK(bp->b_bufobj->bo_object);
 	vm_page_lock_queues();
 	for (i = 0; i < bp->b_npages; i++) {
@@ -1787,8 +1792,6 @@
 	int nqindex;
 	static int flushingbufs;
 
-	GIANT_REQUIRED;
-
 	/*
 	 * We can't afford to block since we might be holding a vnode lock,
 	 * which may prevent system daemons from running.  We deal with
@@ -1873,15 +1876,6 @@
 				break;
 			}
 		}
-		if (bp->b_vp) {
-			BO_LOCK(bp->b_bufobj);
-			if (bp->b_vflags & BV_BKGRDINPROG) {
-				BO_UNLOCK(bp->b_bufobj);
-				continue;
-			}
-			BO_UNLOCK(bp->b_bufobj);
-		}
-
 		/*
 		 * If we are defragging then we need a buffer with 
 		 * b_kvasize != 0.  XXX this situation should no longer
@@ -1899,6 +1893,18 @@
 		 */
 		if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL) != 0)
 			continue;
+		if (bp->b_vp) {
+			BO_LOCK(bp->b_bufobj);
+			if (bp->b_vflags & BV_BKGRDINPROG) {
+				BO_UNLOCK(bp->b_bufobj);
+				BUF_UNLOCK(bp);
+				continue;
+			}
+			BO_UNLOCK(bp->b_bufobj);
+		}
+		CTR3(KTR_BUF, "getnewbuf(%p) vp %p flags %X (recycling)",
+		    bp, bp->b_vp, bp->b_flags);
+
 		/*
 		 * Sanity Checks
 		 */
@@ -2185,10 +2191,9 @@
 	TAILQ_FOREACH(bp, &bufqueues[QUEUE_DIRTY], b_freelist) {
 		if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL) != 0)
 			continue;
-		KASSERT((bp->b_flags & B_DELWRI),
-		    ("unexpected clean buffer %p", bp));
 		BO_LOCK(bp->b_bufobj);
-		if ((bp->b_vflags & BV_BKGRDINPROG) != 0) {
+		if ((bp->b_vflags & BV_BKGRDINPROG) != 0 ||
+		    (bp->b_flags & B_DELWRI) == 0) {
 			BO_UNLOCK(bp->b_bufobj);
 			BUF_UNLOCK(bp);
 			continue;
@@ -2226,6 +2231,8 @@
 		}
 		if (vn_lock(vp, LK_EXCLUSIVE | LK_NOWAIT, td) == 0) {
 			mtx_unlock(&bqlock);
+			CTR3(KTR_BUF, "flushbufqueue(%p) vp %p flags %X",
+			    bp, bp->b_vp, bp->b_flags);
 			vfs_bio_awrite(bp);
 			vn_finished_write(mp);
 			VOP_UNLOCK(vp, 0, td);
@@ -2269,7 +2276,6 @@
 	vm_page_t m;
 	vm_ooffset_t off;
 
-	GIANT_REQUIRED;
 	ASSERT_VOP_LOCKED(vp, "inmem");
 
 	if (incore(&vp->v_bufobj, blkno))
@@ -2321,7 +2327,6 @@
 	int i;
 	vm_object_t object;
 
-	GIANT_REQUIRED;
 	/*
 	 * Degenerate case - empty buffer
 	 */
@@ -2442,9 +2447,10 @@
 	struct bufobj *bo;
 	int s;
 	int error;
-	ASSERT_VOP_LOCKED(vp, "getblk");
 	struct vm_object *vmo;
 
+	CTR3(KTR_BUF, "getblk(%p, %ld, %d)", vp, (long)blkno, size);
+	ASSERT_VOP_LOCKED(vp, "getblk");
 	if (size > MAXBSIZE)
 		panic("getblk: size(%d) > MAXBSIZE(%d)\n", size, MAXBSIZE);
 
@@ -2677,6 +2683,7 @@
 		splx(s);
 		bp->b_flags &= ~B_DONE;
 	}
+	CTR4(KTR_BUF, "getblk(%p, %ld, %d) = %p", vp, (long)blkno, size, bp);
 	KASSERT(BUF_REFCNT(bp) == 1, ("getblk: bp %p not locked",bp));
 	KASSERT(bp->b_bufobj == bo,
 	    ("wrong b_bufobj %p should be %p", bp->b_bufobj, bo));
@@ -2728,8 +2735,6 @@
 	int newbsize, mbsize;
 	int i;
 
-	GIANT_REQUIRED;
-
 	if (BUF_REFCNT(bp) == 0)

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412140159.iBE1xdaU098544>