Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/lfs switch lfs_sleepers to condvar (from mtsleep)



details:   https://anonhg.NetBSD.org/src/rev/2a8522fa5225
branches:  trunk
changeset: 352439:2a8522fa5225
user:      maya <maya%NetBSD.org@localhost>
date:      Sat Apr 01 01:50:02 2017 +0000

description:
switch lfs_sleepers to condvar (from mtsleep)

diffstat:

 sys/ufs/lfs/lfs.h        |   3 ++-
 sys/ufs/lfs/lfs_vfsops.c |   9 +++++----
 sys/ufs/lfs/lfs_vnops.c  |  10 +++++-----
 3 files changed, 12 insertions(+), 10 deletions(-)

diffs (106 lines):

diff -r ad1c77b16136 -r 2a8522fa5225 sys/ufs/lfs/lfs.h
--- a/sys/ufs/lfs/lfs.h Sat Apr 01 00:40:42 2017 +0000
+++ b/sys/ufs/lfs/lfs.h Sat Apr 01 01:50:02 2017 +0000
@@ -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 @@
        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 */
diff -r ad1c77b16136 -r 2a8522fa5225 sys/ufs/lfs/lfs_vfsops.c
--- a/sys/ufs/lfs/lfs_vfsops.c  Sat Apr 01 00:40:42 2017 +0000
+++ b/sys/ufs/lfs/lfs_vfsops.c  Sat Apr 01 01:50:02 2017 +0000
@@ -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 @@
        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_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 @@
        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);
diff -r ad1c77b16136 -r 2a8522fa5225 sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c   Sat Apr 01 00:40:42 2017 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c   Sat Apr 01 01:50:02 2017 +0000
@@ -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 @@
 
                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 @@
                }
                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 @@
                                        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;



Home | Main Index | Thread Index | Old Index