Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add code to UBCify LFS. This is still behind "#ifdef LFS_UB...
details: https://anonhg.NetBSD.org/src/rev/6fab6973e050
branches: trunk
changeset: 543129:6fab6973e050
user: perseant <perseant%NetBSD.org@localhost>
date: Mon Feb 17 23:48:08 2003 +0000
description:
Add code to UBCify LFS. This is still behind "#ifdef LFS_UBC" for now
(there are still some details to work out) but expect that to go
away soon. To support these basic changes (creation of lfs_putpages,
lfs_gop_write, mods to lfs_balloc) several other changes were made, to
wit:
* Create a writer daemon kernel thread whose purpose is to handle page
writes for the pagedaemon, but which also takes over some of the
functions of lfs_check(). This thread is started the first time an
LFS is mounted.
* Add a "flags" parameter to GOP_SIZE. Current values are
GOP_SIZE_READ, meaning that the call should return the size of the
in-core version of the file, and GOP_SIZE_WRITE, meaning that it
should return the on-disk size. One of GOP_SIZE_READ or
GOP_SIZE_WRITE must be specified.
* Instead of using malloc(...M_WAITOK) for everything, reserve enough
resources to get by and use malloc(...M_NOWAIT), using the reserves if
necessary. Use the pool subsystem for structures small enough that
this is feasible. This also obsoletes LFS_THROTTLE.
And a few that are not strictly necessary:
* Moves the LFS inode extensions off onto a separately allocated
structure; getting closer to LFS as an LKM. "Welcome to 1.6O."
* Unified GOP_ALLOC between FFS and LFS.
* Update LFS copyright headers to correct values.
* Actually cast to unsigned in lfs_shellsort, like the comment says.
* Keep track of which segments were empty before the previous
checkpoint; any segments that pass two checkpoints both dirty and
empty can be summarily cleaned. Do this. Right now lfs_segclean
still works, but this should be turned into an effectless
compatibility syscall.
diffstat:
libexec/lfs_cleanerd/print.c | 6 +-
sbin/fsck_lfs/inode.c | 10 +-
sbin/fsck_lfs/pass0.c | 10 +-
sys/conf/osrelease.sh | 4 +-
sys/miscfs/genfs/genfs_node.h | 14 +-
sys/miscfs/genfs/genfs_vnops.c | 19 +-
sys/nfs/nfs_node.c | 11 +-
sys/sys/param.h | 4 +-
sys/ufs/ffs/ffs_extern.h | 4 +-
sys/ufs/ffs/ffs_vfsops.c | 6 +-
sys/ufs/ffs/ffs_vnops.c | 10 +-
sys/ufs/lfs/TODO | 23 +-
sys/ufs/lfs/lfs.h | 122 +++++-
sys/ufs/lfs/lfs_alloc.c | 75 +---
sys/ufs/lfs/lfs_balloc.c | 120 +++--
sys/ufs/lfs/lfs_bio.c | 130 +++---
sys/ufs/lfs/lfs_cksum.c | 6 +-
sys/ufs/lfs/lfs_debug.c | 8 +-
sys/ufs/lfs/lfs_extern.h | 37 +-
sys/ufs/lfs/lfs_inode.c | 108 ++++-
sys/ufs/lfs/lfs_segment.c | 730 +++++++++++++++++++++++--------------
sys/ufs/lfs/lfs_subr.c | 331 +++++++++++++----
sys/ufs/lfs/lfs_syscalls.c | 74 +--
sys/ufs/lfs/lfs_vfsops.c | 434 ++++++++++++++++++++++-
sys/ufs/lfs/lfs_vnops.c | 772 ++++++++++++++++++++++++++++++++++++++--
sys/ufs/ufs/inode.h | 14 +-
sys/ufs/ufs/ufs_extern.h | 3 +-
sys/ufs/ufs/ufs_inode.c | 8 +-
sys/ufs/ufs/ufs_readwrite.c | 21 +-
sys/ufs/ufs/ufs_vnops.c | 52 ++-
sys/uvm/uvm_page.c | 6 +-
sys/uvm/uvm_pager.h | 3 +-
usr.sbin/dumplfs/dumplfs.c | 6 +-
usr.sbin/quotaon/quotaon.c | 7 +-
34 files changed, 2403 insertions(+), 785 deletions(-)
diffs (truncated from 5493 to 300 lines):
diff -r 629fcdb3e492 -r 6fab6973e050 libexec/lfs_cleanerd/print.c
--- a/libexec/lfs_cleanerd/print.c Mon Feb 17 23:45:47 2003 +0000
+++ b/libexec/lfs_cleanerd/print.c Mon Feb 17 23:48:08 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.13 2003/01/24 21:55:05 fvdl Exp $ */
+/* $NetBSD: print.c,v 1.14 2003/02/17 23:48:08 perseant Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)print.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: print.c,v 1.13 2003/01/24 21:55:05 fvdl Exp $");
+__RCSID("$NetBSD: print.c,v 1.14 2003/02/17 23:48:08 perseant Exp $");
#endif
#endif /* not lint */
@@ -261,7 +261,7 @@
syslog(LOG_DEBUG, "Checkpoint Info\n");
syslog(LOG_DEBUG, "%s%d\t%s0x%X\t%s%d\n",
- "free ", lfsp->lfs_free,
+ "freehd ", lfsp->lfs_freehd,
"idaddr ", lfsp->lfs_idaddr,
"ifile ", lfsp->lfs_ifile);
syslog(LOG_DEBUG, "%s%d\t%s%d\t%s%d\n",
diff -r 629fcdb3e492 -r 6fab6973e050 sbin/fsck_lfs/inode.c
--- a/sbin/fsck_lfs/inode.c Mon Feb 17 23:45:47 2003 +0000
+++ b/sbin/fsck_lfs/inode.c Mon Feb 17 23:48:08 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: inode.c,v 1.14 2003/01/24 21:55:10 fvdl Exp $ */
+/* $NetBSD: inode.c,v 1.15 2003/02/17 23:48:09 perseant Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -348,8 +348,8 @@
if (reply("free")) {
ifp = lfs_ientry(inumber, &bp);
ifp->if_daddr = LFS_UNUSED_DADDR;
- ifp->if_nextfree = sblock.lfs_free;
- sblock.lfs_free = inumber;
+ ifp->if_nextfree = sblock.lfs_freehd;
+ sblock.lfs_freehd = inumber;
sbdirty();
dirty(bp);
bp->b_flags &= ~B_INUSE;
@@ -700,8 +700,8 @@
ifp = lfs_ientry(idesc->id_number, &bp);
ifp->if_daddr = LFS_UNUSED_DADDR;
- ifp->if_nextfree = sblock.lfs_free;
- sblock.lfs_free = idesc->id_number;
+ ifp->if_nextfree = sblock.lfs_freehd;
+ sblock.lfs_freehd = idesc->id_number;
sbdirty();
dirty(bp);
bp->b_flags &= ~B_INUSE;
diff -r 629fcdb3e492 -r 6fab6973e050 sbin/fsck_lfs/pass0.c
--- a/sbin/fsck_lfs/pass0.c Mon Feb 17 23:45:47 2003 +0000
+++ b/sbin/fsck_lfs/pass0.c Mon Feb 17 23:48:08 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pass0.c,v 1.12 2003/01/24 21:55:10 fvdl Exp $ */
+/* $NetBSD: pass0.c,v 1.13 2003/02/17 23:48:09 perseant Exp $ */
/*
* Copyright (c) 1998 Konrad E. Schroder.
@@ -86,7 +86,7 @@
memset(visited, 0, maxino * sizeof(ino_t));
plastino = 0;
- ino = sblock.lfs_free;
+ ino = sblock.lfs_freehd;
while (ino) {
if (ino >= maxino) {
printf("! Ino %d out of range (last was %d)\n", ino,
@@ -115,7 +115,7 @@
ino, (long long)daddr);
if (preen || reply("FIX") == 1) {
if (plastino == 0) {
- sblock.lfs_free = nextino;
+ sblock.lfs_freehd = nextino;
sbdirty();
} else {
ifp = lfs_ientry(plastino, &bp);
@@ -145,8 +145,8 @@
pwarn("! Ino %d free, but not on the free list\n", ino);
if (preen || reply("FIX") == 1) {
- ifp->if_nextfree = sblock.lfs_free;
- sblock.lfs_free = ino;
+ ifp->if_nextfree = sblock.lfs_freehd;
+ sblock.lfs_freehd = ino;
sbdirty();
dirty(bp);
}
diff -r 629fcdb3e492 -r 6fab6973e050 sys/conf/osrelease.sh
--- a/sys/conf/osrelease.sh Mon Feb 17 23:45:47 2003 +0000
+++ b/sys/conf/osrelease.sh Mon Feb 17 23:48:08 2003 +0000
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: osrelease.sh,v 1.90 2003/02/01 06:26:30 thorpej Exp $
+# $NetBSD: osrelease.sh,v 1.91 2003/02/17 23:48:09 perseant Exp $
#
# Copyright (c) 1997 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -42,7 +42,7 @@
# sys/sys/param.h: __NetBSD_Version__
# share/tmac/doc-common: ds oS
#
-release=1.6N
+release=1.6O
case $1 in
-s)
diff -r 629fcdb3e492 -r 6fab6973e050 sys/miscfs/genfs/genfs_node.h
--- a/sys/miscfs/genfs/genfs_node.h Mon Feb 17 23:45:47 2003 +0000
+++ b/sys/miscfs/genfs/genfs_node.h Mon Feb 17 23:48:08 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs_node.h,v 1.3 2001/12/18 07:49:36 chs Exp $ */
+/* $NetBSD: genfs_node.h,v 1.4 2003/02/17 23:48:10 perseant Exp $ */
/*
* Copyright (c) 2001 Chuck Silvers.
@@ -36,18 +36,22 @@
struct vm_page;
struct genfs_ops {
- void (*gop_size)(struct vnode *, off_t, off_t *);
+ void (*gop_size)(struct vnode *, off_t, off_t *, int);
int (*gop_alloc)(struct vnode *, off_t, off_t, int, struct ucred *);
int (*gop_write)(struct vnode *, struct vm_page **, int, int);
};
-#define GOP_SIZE(vp, size, eobp) \
- (*VTOG(vp)->g_op->gop_size)((vp), (size), (eobp))
+#define GOP_SIZE(vp, size, eobp, flags) \
+ (*VTOG(vp)->g_op->gop_size)((vp), (size), (eobp), (flags))
#define GOP_ALLOC(vp, off, len, flags, cred) \
(*VTOG(vp)->g_op->gop_alloc)((vp), (off), (len), (flags), (cred))
#define GOP_WRITE(vp, pgs, npages, flags) \
(*VTOG(vp)->g_op->gop_write)((vp), (pgs), (npages), (flags))
+/* Flags to GOP_SIZE */
+#define GOP_SIZE_READ 0x1 /* Advise how many pages to read/create */
+#define GOP_SIZE_WRITE 0x2 /* Tell how many pages to write */
+
struct genfs_node {
struct genfs_ops *g_op; /* ops vector */
struct lock g_glock; /* getpages lock */
@@ -55,7 +59,7 @@
#define VTOG(vp) ((struct genfs_node *)(vp)->v_data)
-void genfs_size(struct vnode *, off_t, off_t *);
+void genfs_size(struct vnode *, off_t, off_t *, int);
void genfs_node_init(struct vnode *, struct genfs_ops *);
int genfs_gop_write(struct vnode *, struct vm_page **, int, int);
int genfs_compat_gop_write(struct vnode *, struct vm_page **, int, int);
diff -r 629fcdb3e492 -r 6fab6973e050 sys/miscfs/genfs/genfs_vnops.c
--- a/sys/miscfs/genfs/genfs_vnops.c Mon Feb 17 23:45:47 2003 +0000
+++ b/sys/miscfs/genfs/genfs_vnops.c Mon Feb 17 23:48:08 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs_vnops.c,v 1.71 2003/02/05 21:38:42 pk Exp $ */
+/* $NetBSD: genfs_vnops.c,v 1.72 2003/02/17 23:48:11 perseant Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.71 2003/02/05 21:38:42 pk Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.72 2003/02/17 23:48:11 perseant Exp $");
#include "opt_nfsserver.h"
@@ -495,11 +495,11 @@
error = 0;
origoffset = ap->a_offset;
orignpages = *ap->a_count;
- GOP_SIZE(vp, vp->v_size, &diskeof);
+ GOP_SIZE(vp, vp->v_size, &diskeof, GOP_SIZE_READ);
if (flags & PGO_PASTEOF) {
newsize = MAX(vp->v_size,
origoffset + (orignpages << PAGE_SHIFT));
- GOP_SIZE(vp, newsize, &memeof);
+ GOP_SIZE(vp, newsize, &memeof, GOP_SIZE_READ);
} else {
memeof = diskeof;
}
@@ -1139,8 +1139,13 @@
yield = (l->l_cpu->ci_schedstate.spc_flags &
SPCF_SHOULDYIELD) && !pagedaemon;
if (pg->flags & PG_BUSY || yield) {
+ UVMHIST_LOG(ubchist, "busy %p", pg,0,0,0);
+ if (flags & PGO_BUSYFAIL && pg->flags & PG_BUSY) {
+ UVMHIST_LOG(ubchist, "busyfail %p", pg, 0,0,0);
+ error = EDEADLK;
+ break;
+ }
KASSERT(!pagedaemon);
- UVMHIST_LOG(ubchist, "busy %p", pg,0,0,0);
if (by_list) {
TAILQ_INSERT_BEFORE(pg, &curmp, listq);
UVMHIST_LOG(ubchist, "curmp next %p",
@@ -1381,7 +1386,7 @@
UVMHIST_LOG(ubchist, "vp %p pgs %p npages %d flags 0x%x",
vp, pgs, npages, flags);
- GOP_SIZE(vp, vp->v_size, &eof);
+ GOP_SIZE(vp, vp->v_size, &eof, GOP_SIZE_WRITE);
if (vp->v_type == VREG) {
fs_bshift = vp->v_mount->mnt_fs_bshift;
dev_bshift = vp->v_mount->mnt_dev_bshift;
@@ -1523,7 +1528,7 @@
}
void
-genfs_size(struct vnode *vp, off_t size, off_t *eobp)
+genfs_size(struct vnode *vp, off_t size, off_t *eobp, int flags)
{
int bsize;
diff -r 629fcdb3e492 -r 6fab6973e050 sys/nfs/nfs_node.c
--- a/sys/nfs/nfs_node.c Mon Feb 17 23:45:47 2003 +0000
+++ b/sys/nfs/nfs_node.c Mon Feb 17 23:48:08 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_node.c,v 1.60 2003/02/15 18:00:25 drochner Exp $ */
+/* $NetBSD: nfs_node.c,v 1.61 2003/02/17 23:48:12 perseant Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.60 2003/02/15 18:00:25 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.61 2003/02/17 23:48:12 perseant Exp $");
#include "opt_nfs.h"
@@ -80,7 +80,7 @@
#define nfs_hash(x,y) hash32_buf((x), (y), HASH32_BUF_INIT)
-void nfs_gop_size(struct vnode *, off_t, off_t *);
+void nfs_gop_size(struct vnode *, off_t, off_t *, int);
int nfs_gop_alloc(struct vnode *, off_t, off_t, int, struct ucred *);
int nfs_gop_write(struct vnode *, struct vm_page **, int, int);
@@ -315,8 +315,11 @@
}
void
-nfs_gop_size(struct vnode *vp, off_t size, off_t *eobp)
+nfs_gop_size(struct vnode *vp, off_t size, off_t *eobp, int flags)
{
+ KASSERT(flags & (GOP_SIZE_READ | GOP_SIZE_WRITE));
+ KASSERT((flags & (GOP_SIZE_READ | GOP_SIZE_WRITE))
+ != (GOP_SIZE_READ | GOP_SIZE_WRITE));
*eobp = MAX(size, vp->v_size);
}
diff -r 629fcdb3e492 -r 6fab6973e050 sys/sys/param.h
--- a/sys/sys/param.h Mon Feb 17 23:45:47 2003 +0000
+++ b/sys/sys/param.h Mon Feb 17 23:48:08 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.159 2003/02/01 06:26:30 thorpej Exp $ */
+/* $NetBSD: param.h,v 1.160 2003/02/17 23:48:13 perseant Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
* Don't forget to change conf/osrelease.sh too.
*/
-#define __NetBSD_Version__ 106140000 /* NetBSD 1.6N */
+#define __NetBSD_Version__ 106150000 /* NetBSD 1.6O */
/*
* Historical NetBSD #define
diff -r 629fcdb3e492 -r 6fab6973e050 sys/ufs/ffs/ffs_extern.h
--- a/sys/ufs/ffs/ffs_extern.h Mon Feb 17 23:45:47 2003 +0000
+++ b/sys/ufs/ffs/ffs_extern.h Mon Feb 17 23:48:08 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_extern.h,v 1.25 2003/01/24 21:55:22 fvdl Exp $ */
+/* $NetBSD: ffs_extern.h,v 1.26 2003/02/17 23:48:14 perseant Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -151,7 +151,7 @@
int ffs_reclaim __P((void *));
int ffs_getpages __P((void *));
int ffs_putpages __P((void *));
-void ffs_gop_size __P((struct vnode *, off_t, off_t *));
+void ffs_gop_size __P((struct vnode *, off_t, off_t *, int));
__END_DECLS
Home |
Main Index |
Thread Index |
Old Index