Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Bring back vrele_flush() to flush deferred vrele() o an ...
details: https://anonhg.NetBSD.org/src/rev/c9a2ac73044e
branches: trunk
changeset: 821787:c9a2ac73044e
user: hannken <hannken%NetBSD.org@localhost>
date: Fri Feb 17 08:30:00 2017 +0000
description:
Bring back vrele_flush() to flush deferred vrele() o an suspended file system.
diffstat:
sys/dev/fss.c | 5 +++--
sys/kern/vfs_vnode.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
sys/sys/vnode.h | 3 ++-
sys/ufs/ffs/ffs_snapshot.c | 5 +++--
4 files changed, 51 insertions(+), 7 deletions(-)
diffs (142 lines):
diff -r 60af8ab68127 -r c9a2ac73044e sys/dev/fss.c
--- a/sys/dev/fss.c Fri Feb 17 08:29:11 2017 +0000
+++ b/sys/dev/fss.c Fri Feb 17 08:30:00 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fss.c,v 1.96 2017/02/17 08:29:11 hannken Exp $ */
+/* $NetBSD: fss.c,v 1.97 2017/02/17 08:30:00 hannken Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.96 2017/02/17 08:29:11 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.97 2017/02/17 08:30:00 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -851,6 +851,7 @@
microtime(&sc->sc_time);
+ vrele_flush(sc->sc_mount);
error = VFS_SYNC(sc->sc_mount, MNT_WAIT, curlwp->l_cred);
if (error == 0)
error = fscow_establish(sc->sc_mount, fss_copy_on_write, sc);
diff -r 60af8ab68127 -r c9a2ac73044e sys/kern/vfs_vnode.c
--- a/sys/kern/vfs_vnode.c Fri Feb 17 08:29:11 2017 +0000
+++ b/sys/kern/vfs_vnode.c Fri Feb 17 08:30:00 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_vnode.c,v 1.74 2017/02/17 08:27:58 hannken Exp $ */
+/* $NetBSD: vfs_vnode.c,v 1.75 2017/02/17 08:30:00 hannken Exp $ */
/*-
* Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -156,7 +156,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.74 2017/02/17 08:27:58 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.75 2017/02/17 08:30:00 hannken Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -455,6 +455,45 @@
}
/*
+ * Release deferred vrele vnodes for this mount.
+ * Called with file system suspended.
+ */
+void
+vrele_flush(struct mount *mp)
+{
+ vnode_impl_t *vip, *marker;
+
+ KASSERT(fstrans_is_owner(mp));
+
+ marker = VNODE_TO_VIMPL(vnalloc_marker(NULL));
+
+ mutex_enter(&vdrain_lock);
+ TAILQ_INSERT_HEAD(&lru_vrele_list, marker, vi_lrulist);
+
+ while ((vip = TAILQ_NEXT(marker, vi_lrulist))) {
+ TAILQ_REMOVE(&lru_vrele_list, marker, vi_lrulist);
+ TAILQ_INSERT_AFTER(&lru_vrele_list, vip, marker, vi_lrulist);
+ if (vnis_marker(VIMPL_TO_VNODE(vip)))
+ continue;
+
+ KASSERT(vip->vi_lrulisthd == &lru_vrele_list);
+ TAILQ_REMOVE(vip->vi_lrulisthd, vip, vi_lrulist);
+ vip->vi_lrulisthd = &lru_hold_list;
+ TAILQ_INSERT_TAIL(vip->vi_lrulisthd, vip, vi_lrulist);
+ mutex_exit(&vdrain_lock);
+
+ vrele(VIMPL_TO_VNODE(vip));
+
+ mutex_enter(&vdrain_lock);
+ }
+
+ TAILQ_REMOVE(&lru_vrele_list, marker, vi_lrulist);
+ mutex_exit(&vdrain_lock);
+
+ vnfree_marker(VIMPL_TO_VNODE(marker));
+}
+
+/*
* Reclaim a cached vnode. Used from vdrain_thread only.
*/
static __inline void
@@ -556,6 +595,8 @@
TAILQ_REMOVE(listhd[i], marker, vi_lrulist);
TAILQ_INSERT_AFTER(listhd[i], vip, marker,
vi_lrulist);
+ if (vnis_marker(VIMPL_TO_VNODE(vip)))
+ continue;
if (listhd[i] == &lru_vrele_list)
vdrain_vrele(VIMPL_TO_VNODE(vip));
else if (numvnodes < target)
diff -r 60af8ab68127 -r c9a2ac73044e sys/sys/vnode.h
--- a/sys/sys/vnode.h Fri Feb 17 08:29:11 2017 +0000
+++ b/sys/sys/vnode.h Fri Feb 17 08:30:00 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vnode.h,v 1.273 2017/01/11 12:17:34 joerg Exp $ */
+/* $NetBSD: vnode.h,v 1.274 2017/02/17 08:30:00 hannken Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -515,6 +515,7 @@
bool vrecycle(struct vnode *);
void vrele(struct vnode *);
void vrele_async(struct vnode *);
+void vrele_flush(struct mount *);
int vtruncbuf(struct vnode *, daddr_t, bool, int);
void vwakeup(struct buf *);
int vdead_check(struct vnode *, int);
diff -r 60af8ab68127 -r c9a2ac73044e sys/ufs/ffs/ffs_snapshot.c
--- a/sys/ufs/ffs/ffs_snapshot.c Fri Feb 17 08:29:11 2017 +0000
+++ b/sys/ufs/ffs/ffs_snapshot.c Fri Feb 17 08:30:00 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_snapshot.c,v 1.144 2017/02/17 08:29:11 hannken Exp $ */
+/* $NetBSD: ffs_snapshot.c,v 1.145 2017/02/17 08:30:00 hannken Exp $ */
/*
* Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.144 2017/02/17 08:29:11 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.145 2017/02/17 08:30:00 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -256,6 +256,7 @@
error = vfs_suspend(vp->v_mount, 0);
if (error == 0) {
suspended = true;
+ vrele_flush(vp->v_mount);
error = VFS_SYNC(vp->v_mount, MNT_WAIT, curlwp->l_cred);
}
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
Home |
Main Index |
Thread Index |
Old Index