Module Name:    src
Committed By:   maya
Date:           Sat Apr  1 01:50:02 UTC 2017

Modified Files:
        src/sys/ufs/lfs: lfs.h lfs_vfsops.c lfs_vnops.c

Log Message:
switch lfs_sleepers to condvar (from mtsleep)


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/ufs/lfs/lfs.h
cvs rdiff -u -r1.353 -r1.354 src/sys/ufs/lfs/lfs_vfsops.c
cvs rdiff -u -r1.307 -r1.308 src/sys/ufs/lfs/lfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/lfs/lfs.h
diff -u src/sys/ufs/lfs/lfs.h:1.199 src/sys/ufs/lfs/lfs.h:1.200
--- src/sys/ufs/lfs/lfs.h:1.199	Mon Jun 20 03:25:46 2016
+++ src/sys/ufs/lfs/lfs.h	Sat Apr  1 01:50:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs.h,v 1.199 2016/06/20 03:25:46 dholland Exp $	*/
+/*	$NetBSD: lfs.h,v 1.200 2017/04/01 01:50:02 maya Exp $	*/
 
 /*  from NetBSD: dinode.h,v 1.25 2016/01/22 23:06:10 dholland Exp  */
 /*  from NetBSD: dir.h,v 1.25 2015/09/01 06:16:03 dholland Exp  */
@@ -1018,6 +1018,7 @@ struct lfs {
 	daddr_t  lfs_cleanint[LFS_MAX_CLEANIND]; /* Active cleaning intervals */
 	int 	 lfs_cleanind;		/* Index into intervals */
 	int lfs_sleepers;		/* # procs sleeping this fs */
+	kcondvar_t lfs_sleeperscv;	
 	int lfs_pages;			/* dirty pages blaming this fs */
 	lfs_bm_t *lfs_ino_bitmap;	/* Inuse inodes bitmap */
 	int lfs_nowrap;			/* Suspend log wrap */

Index: src/sys/ufs/lfs/lfs_vfsops.c
diff -u src/sys/ufs/lfs/lfs_vfsops.c:1.353 src/sys/ufs/lfs/lfs_vfsops.c:1.354
--- src/sys/ufs/lfs/lfs_vfsops.c:1.353	Mon Mar 13 14:24:20 2017
+++ src/sys/ufs/lfs/lfs_vfsops.c	Sat Apr  1 01:50:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_vfsops.c,v 1.353 2017/03/13 14:24:20 riastradh Exp $	*/
+/*	$NetBSD: lfs_vfsops.c,v 1.354 2017/04/01 01:50:02 maya Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.353 2017/03/13 14:24:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.354 2017/04/01 01:50:02 maya Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_lfs.h"
@@ -1097,6 +1097,7 @@ lfs_mountfs(struct vnode *devvp, struct 
 	fs->lfs_pages = 0;
 	rw_init(&fs->lfs_fraglock);
 	rw_init(&fs->lfs_iflock);
+	cv_init(&fs->lfs_sleeperscv, "lfs_slp");
 	cv_init(&fs->lfs_stopcv, "lfsstop");
 
 	/* Set the file system readonly/modify bits. */
@@ -1349,8 +1350,7 @@ lfs_unmount(struct mount *mp, int mntfla
 	lfs_wakeup_cleaner(fs);
 	mutex_enter(&lfs_lock);
 	while (fs->lfs_sleepers)
-		mtsleep(&fs->lfs_sleepers, PRIBIO + 1, "lfs_sleepers", 0,
-			&lfs_lock);
+		cv_wait(&fs->lfs_sleeperscv, &lfs_lock);
 	mutex_exit(&lfs_lock);
 
 #ifdef LFS_EXTATTR
@@ -1414,6 +1414,7 @@ lfs_unmount(struct mount *mp, int mntfla
 	free(fs->lfs_suflags[1], M_SEGMENT);
 	free(fs->lfs_suflags, M_SEGMENT);
 	lfs_free_resblks(fs);
+	cv_destroy(&fs->lfs_sleeperscv);
 	cv_destroy(&fs->lfs_stopcv);
 	rw_destroy(&fs->lfs_fraglock);
 	rw_destroy(&fs->lfs_iflock);

Index: src/sys/ufs/lfs/lfs_vnops.c
diff -u src/sys/ufs/lfs/lfs_vnops.c:1.307 src/sys/ufs/lfs/lfs_vnops.c:1.308
--- src/sys/ufs/lfs/lfs_vnops.c:1.307	Thu Mar 30 09:10:08 2017
+++ src/sys/ufs/lfs/lfs_vnops.c	Sat Apr  1 01:50:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_vnops.c,v 1.307 2017/03/30 09:10:08 hannken Exp $	*/
+/*	$NetBSD: lfs_vnops.c,v 1.308 2017/04/01 01:50:02 maya Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.307 2017/03/30 09:10:08 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.308 2017/04/01 01:50:02 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1890,7 +1890,7 @@ segwait_common:
 
 		mutex_enter(&lfs_lock);
 		if (--fs->lfs_sleepers == 0)
-			wakeup(&fs->lfs_sleepers);
+			cv_broadcast(&fs->lfs_sleeperscv);
 		mutex_exit(&lfs_lock);
 		return error;
 
@@ -1933,7 +1933,7 @@ segwait_common:
 		}
 		mutex_enter(&lfs_lock);
 		if (--fs->lfs_sleepers == 0)
-			wakeup(&fs->lfs_sleepers);
+			cv_broadcast(&fs->lfs_sleeperscv);
 		mutex_exit(&lfs_lock);
 		lfs_free(fs, blkiov, LFS_NB_BLKIOV);
 		return error;
@@ -1964,7 +1964,7 @@ segwait_common:
 					blkcnt * sizeof(BLOCK_INFO));
 		mutex_enter(&lfs_lock);
 		if (--fs->lfs_sleepers == 0)
-			wakeup(&fs->lfs_sleepers);
+			cv_broadcast(&fs->lfs_sleeperscv);
 		mutex_exit(&lfs_lock);
 		lfs_free(fs, blkiov, LFS_NB_BLKIOV);
 		return error;

Reply via email to