change lfs_nextsegsleep and lfs_allclean_wakeup to use condvar
XXX had to use lfs_lock in lfs_segwait, removed kernel_lock, is this appropriate?
This commit is contained in:
parent
dc3136e8aa
commit
8f5758dbf8
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs.h,v 1.202 2017/06/05 01:01:42 maya Exp $ */
|
||||
/* $NetBSD: lfs.h,v 1.203 2017/07/26 16:42:37 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 */
|
||||
|
@ -1047,7 +1047,7 @@ struct lfs {
|
|||
/* XXX: should be replaced with a condvar */
|
||||
int lfs_availsleep;
|
||||
/* This one replaces &lfs_nextseg... all ditto */
|
||||
int lfs_nextsegsleep;
|
||||
kcondvar_t lfs_nextsegsleep;
|
||||
|
||||
/* Cleaner lwp, set on first bmapv syscall. */
|
||||
struct lwp *lfs_cleaner_thread;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_extern.h,v 1.112 2017/06/08 01:23:01 chs Exp $ */
|
||||
/* $NetBSD: lfs_extern.h,v 1.113 2017/07/26 16:42:37 maya Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -109,7 +109,7 @@ __BEGIN_DECLS
|
|||
|
||||
#if defined(_KERNEL)
|
||||
|
||||
extern int lfs_allclean_wakeup;
|
||||
extern kcondvar_t lfs_allclean_wakeup;
|
||||
extern struct pool lfs_inode_pool; /* memory pool for inodes */
|
||||
extern struct pool lfs_dinode_pool; /* memory pool for dinodes */
|
||||
extern struct pool lfs_inoext_pool; /* memory pool for inode extension */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_segment.c,v 1.273 2017/07/26 15:07:27 maya Exp $ */
|
||||
/* $NetBSD: lfs_segment.c,v 1.274 2017/07/26 16:42:37 maya Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -60,7 +60,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.273 2017/07/26 15:07:27 maya Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.274 2017/07/26 16:42:37 maya Exp $");
|
||||
|
||||
#ifdef DEBUG
|
||||
# define vndebug(vp, str) do { \
|
||||
|
@ -145,7 +145,7 @@ int lfs_writevnodes(struct lfs *fs, struct mount *mp,
|
|||
static void lfs_shellsort(struct lfs *, struct buf **, union lfs_blocks *,
|
||||
int, int);
|
||||
|
||||
int lfs_allclean_wakeup; /* Cleaner wakeup address. */
|
||||
kcondvar_t lfs_allclean_wakeup; /* Cleaner wakeup address. */
|
||||
int lfs_writeindir = 1; /* whether to flush indir on non-ckp */
|
||||
int lfs_clean_vnhead = 0; /* Allow freeing to head of vn list */
|
||||
int lfs_dirvcount = 0; /* # active dirops */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_subr.c,v 1.96 2017/07/26 14:38:59 maya Exp $ */
|
||||
/* $NetBSD: lfs_subr.c,v 1.97 2017/07/26 16:42:37 maya Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -60,7 +60,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.96 2017/07/26 14:38:59 maya Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.97 2017/07/26 16:42:37 maya Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -649,6 +649,6 @@ lfs_wakeup_cleaner(struct lfs *fs)
|
|||
if (fs->lfs_nowrap > 0)
|
||||
return;
|
||||
|
||||
wakeup(&fs->lfs_nextsegsleep);
|
||||
wakeup(&lfs_allclean_wakeup);
|
||||
cv_broadcast(&fs->lfs_nextsegsleep);
|
||||
cv_broadcast(&lfs_allclean_wakeup);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_syscalls.c,v 1.174 2017/04/17 08:32:01 hannken Exp $ */
|
||||
/* $NetBSD: lfs_syscalls.c,v 1.175 2017/07/26 16:42:37 maya Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007, 2008
|
||||
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.174 2017/04/17 08:32:01 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.175 2017/07/26 16:42:37 maya Exp $");
|
||||
|
||||
#ifndef LFS
|
||||
# define LFS /* for prototypes in syscallargs.h */
|
||||
|
@ -899,7 +899,7 @@ lfs_segwait(fsid_t *fsidp, struct timeval *tv)
|
|||
u_long timeout;
|
||||
int error;
|
||||
|
||||
KERNEL_LOCK(1, NULL);
|
||||
mutex_enter(&lfs_lock);
|
||||
if (fsidp == NULL || (mntp = vfs_getvfs(fsidp)) == NULL)
|
||||
addr = &lfs_allclean_wakeup;
|
||||
else
|
||||
|
@ -909,8 +909,8 @@ lfs_segwait(fsid_t *fsidp, struct timeval *tv)
|
|||
* XXX IS THAT WHAT IS INTENDED?
|
||||
*/
|
||||
timeout = tvtohz(tv);
|
||||
error = tsleep(addr, PCATCH | PVFS, "segment", timeout);
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
error = cv_timedwait_sig(addr, &lfs_lock, timeout);
|
||||
mutex_exit(&lfs_lock);
|
||||
return (error == ERESTART ? EINTR : 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_vfsops.c,v 1.359 2017/04/17 08:32:01 hannken Exp $ */
|
||||
/* $NetBSD: lfs_vfsops.c,v 1.360 2017/07/26 16:42:37 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.359 2017/04/17 08:32:01 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.360 2017/07/26 16:42:37 maya Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_lfs.h"
|
||||
|
@ -860,6 +860,7 @@ lfs_checkmagic(struct lfs *fs)
|
|||
int
|
||||
lfs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l)
|
||||
{
|
||||
static bool lfs_mounted_once = false;
|
||||
struct lfs *primarysb, *altsb, *thesb;
|
||||
struct buf *primarybuf, *altbuf;
|
||||
struct lfs *fs;
|
||||
|
@ -1091,6 +1092,13 @@ lfs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l)
|
|||
cv_init(&fs->lfs_sleeperscv, "lfs_slp");
|
||||
cv_init(&fs->lfs_diropscv, "lfs_dirop");
|
||||
cv_init(&fs->lfs_stopcv, "lfsstop");
|
||||
cv_init(&fs->lfs_nextsegsleep, "segment");
|
||||
|
||||
/* Initialize values for all LFS mounts */
|
||||
if (!lfs_mounted_once) {
|
||||
cv_init(&lfs_allclean_wakeup, "segment");
|
||||
lfs_mounted_once = true;
|
||||
}
|
||||
|
||||
/* Set the file system readonly/modify bits. */
|
||||
fs->lfs_ronly = ronly;
|
||||
|
@ -1409,6 +1417,8 @@ lfs_unmount(struct mount *mp, int mntflags)
|
|||
cv_destroy(&fs->lfs_sleeperscv);
|
||||
cv_destroy(&fs->lfs_diropscv);
|
||||
cv_destroy(&fs->lfs_stopcv);
|
||||
cv_destroy(&fs->lfs_nextsegsleep);
|
||||
|
||||
rw_destroy(&fs->lfs_fraglock);
|
||||
rw_destroy(&fs->lfs_iflock);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_vnops.c,v 1.317 2017/06/10 05:29:36 maya Exp $ */
|
||||
/* $NetBSD: lfs_vnops.c,v 1.318 2017/07/26 16:42:37 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.317 2017/06/10 05:29:36 maya Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.318 2017/07/26 16:42:37 maya Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -1305,8 +1305,7 @@ lfs_wrapgo(struct lfs *fs, struct inode *ip, int waitfor)
|
|||
lfs_wakeup_cleaner(fs);
|
||||
}
|
||||
if (waitfor) {
|
||||
mtsleep(&fs->lfs_nextsegsleep, PCATCH | PUSER, "segment",
|
||||
0, &lfs_lock);
|
||||
cv_wait_sig(&fs->lfs_nextsegsleep, &lfs_lock);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue