clean up unused/required #ifdefs
This commit is contained in:
parent
c122afdfb4
commit
e6ef2d67dd
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs.h,v 1.13 1999/03/17 18:38:34 perseant Exp $ */
|
||||
/* $NetBSD: lfs.h,v 1.14 1999/03/25 21:39:18 perseant Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -74,13 +74,7 @@
|
||||
* Compile-time options for LFS.
|
||||
*/
|
||||
#define LFS_EAGAIN_FAIL /* markv fail with EAGAIN if ino is locked */
|
||||
#define LFS_CONSERVATIVE_LOCK /* lock ifile ino in lfs_segwrite, if safe */
|
||||
|
||||
#define LFS_TOGGLE_SB /* toggle between first 2 sbs for checkpoint */
|
||||
#define LFS_TRACK_IOS /* attempt to avoid cleaning segments not yet fully written to disk */
|
||||
#define LFS_USEDIROP /* use VDIROP segregation */
|
||||
#define LFS_STINGY_CLEAN /* write only cleaned inodes when cleaning */
|
||||
#define LFS_STINGY_BLOCKS /* write only cleaned blocks when cleaning */
|
||||
#define LFS_TRACK_IOS /* attempt to avoid cleaning segments not yet fully written to disk */
|
||||
#define LFS_CANNOT_ROLLFW /* No roll-forward agent exists */
|
||||
|
||||
/* #define DEBUG_LFS */ /* Intensive debugging of LFS subsystem */
|
||||
@ -311,21 +305,16 @@ struct lfs {
|
||||
int8_t lfs_fmod; /* super block modified flag */
|
||||
int8_t lfs_ronly; /* mounted read-only flag */
|
||||
int8_t lfs_flags; /* currently unused flag */
|
||||
#ifdef LFS_TOGGLE_SB
|
||||
u_int16_t lfs_activesb; /* toggle between superblocks */
|
||||
#endif /* LFS_TOGGLE_SB */
|
||||
#ifdef LFS_TRACK_IOS
|
||||
daddr_t lfs_pending[LFS_THROTTLE]; /* daddrs of pending writes */
|
||||
#endif /* LFS_TRACK_IOS */
|
||||
#ifdef LFS_USEDIROP
|
||||
# define LFS_MAXDIROP 32
|
||||
int lfs_dirvcount; /* number of VDIROP-marked vnodes */
|
||||
#endif /* LFS_USEDIROP */
|
||||
#ifdef LFS_CANNOT_ROLLFW
|
||||
daddr_t lfs_sbactive; /* disk address of in-progress sb write */
|
||||
#endif
|
||||
struct vnode *lfs_flushvp; /* vnode being flushed */
|
||||
int lfs_loanedbytes; /* Temp. byte loans for removed inodes */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_bio.c,v 1.7 1999/03/10 00:20:00 perseant Exp $ */
|
||||
/* $NetBSD: lfs_bio.c,v 1.8 1999/03/25 21:39:18 perseant Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -228,11 +228,6 @@ lfs_bwrite_ext(bp, flags)
|
||||
}
|
||||
|
||||
ip = VTOI(bp->b_vp);
|
||||
#ifndef LFS_STINGY_CLEAN
|
||||
if (!(ip->i_flag & IN_MODIFIED))
|
||||
++fs->lfs_uinodes;
|
||||
ip->i_flag |= IN_CHANGE | IN_MODIFIED | IN_UPDATE;
|
||||
#else /* LFS_STINGY_CLEAN */
|
||||
if ((bp->b_flags & (B_CALL|B_INVAL)) == (B_CALL|B_INVAL))
|
||||
{
|
||||
if(!(ip->i_flag & IN_CLEANING))
|
||||
@ -243,7 +238,6 @@ lfs_bwrite_ext(bp, flags)
|
||||
++fs->lfs_uinodes;
|
||||
ip->i_flag |= IN_CHANGE | IN_MODIFIED | IN_UPDATE;
|
||||
}
|
||||
#endif /* LFS_STINGY_CLEAN */
|
||||
fs->lfs_avail -= db;
|
||||
++locked_queue_count;
|
||||
locked_queue_bytes += bp->b_bufsize;
|
||||
@ -260,17 +254,6 @@ lfs_bwrite_ext(bp, flags)
|
||||
bp->b_flags |= B_DELWRI | B_LOCKED;
|
||||
bp->b_flags &= ~(B_READ | B_ERROR);
|
||||
s = splbio();
|
||||
/* XXX - KS - if it's fake and there's another in core, forget it */
|
||||
if((bp->b_flags & (B_CALL|B_INVAL)) == (B_CALL|B_INVAL)
|
||||
&& incore(bp->b_vp,bp->b_lblkno))
|
||||
{
|
||||
#ifdef DIAGNOSTIC
|
||||
printf("lfs_bwrite_ext: dropping fake buffer %d/%d",VTOI(bp->b_vp)->i_number, bp->b_lblkno);
|
||||
#endif
|
||||
lfs_freebuf(bp);
|
||||
splx(s);
|
||||
return 0;
|
||||
}
|
||||
reassignbuf(bp, bp->b_vp);
|
||||
splx(s);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_inode.c,v 1.19 1999/03/24 05:51:31 mrg Exp $ */
|
||||
/* $NetBSD: lfs_inode.c,v 1.20 1999/03/25 21:39:18 perseant Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -237,15 +237,17 @@ lfs_truncate(v)
|
||||
return (VOP_UPDATE(vp, NULL, NULL, 0));
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Make sure no writes happen while we're truncating
|
||||
* XXX KS - I don't remember why....
|
||||
* Make sure no writes happen while we're truncating.
|
||||
* Otherwise, blocks which are accounted for on the inode
|
||||
* *and* which have been created for cleaning can coexist,
|
||||
* and cause us to overcount, and panic below.
|
||||
*
|
||||
* XXX KS - too restrictive? Maybe only when cleaning?
|
||||
*/
|
||||
while(fs->lfs_seglock) {
|
||||
tsleep(&fs->lfs_seglock, (PRIBIO+1), "lfs_truncate", 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Calculate index into inode's block list of last direct and indirect
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_segment.c,v 1.15 1999/03/10 00:20:00 perseant Exp $ */
|
||||
/* $NetBSD: lfs_segment.c,v 1.16 1999/03/25 21:39:18 perseant Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -70,6 +70,8 @@
|
||||
* @(#)lfs_segment.c 8.10 (Berkeley) 6/10/95
|
||||
*/
|
||||
|
||||
#define ivndebug(vp,str) printf("ino %d: %s\n",VTOI(vp)->i_number,(str))
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/namei.h>
|
||||
@ -260,18 +262,11 @@ lfs_vflush(vp)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#define vndebug(vp,str) if(VTOI(vp)->i_flag & IN_CLEANING) printf("not writing ino %d because %s\n",VTOI(vp)->i_number,(str))
|
||||
|
||||
/* XXX KS - This is ugly */
|
||||
#define BYTE_BORROW(FS,SP,SZ) do { \
|
||||
SEGUSE *_sup; \
|
||||
struct buf *_bp; \
|
||||
\
|
||||
LFS_SEGENTRY(_sup, (FS), (SP)->seg_number, _bp); \
|
||||
_sup->su_nbytes += (SZ); \
|
||||
(FS)->lfs_loaned_bytes += (SZ); \
|
||||
VOP_BWRITE(_bp); \
|
||||
} while(0)
|
||||
#ifdef DEBUG_LFS_VERBOSE
|
||||
# define vndebug(vp,str) if(VTOI(vp)->i_flag & IN_CLEANING) printf("not writing ino %d because %s (op %d)\n",VTOI(vp)->i_number,(str),op)
|
||||
#else
|
||||
# define vndebug(vp,str)
|
||||
#endif
|
||||
|
||||
int
|
||||
lfs_writevnodes(fs, mp, sp, op)
|
||||
@ -309,13 +304,11 @@ lfs_writevnodes(fs, mp, sp, op)
|
||||
goto loop;
|
||||
|
||||
ip = VTOI(vp);
|
||||
#ifdef LFS_USEDIROP
|
||||
if ((op == VN_DIROP && !(vp->v_flag & VDIROP)) ||
|
||||
(op != VN_DIROP && op != VN_CLEAN && (vp->v_flag & VDIROP))) {
|
||||
vndebug(vp,"dirop");
|
||||
continue;
|
||||
}
|
||||
#endif /* LFS_USEDIROP */
|
||||
|
||||
if (op == VN_EMPTY && vp->v_dirtyblkhd.lh_first) {
|
||||
vndebug(vp,"empty");
|
||||
@ -326,46 +319,26 @@ lfs_writevnodes(fs, mp, sp, op)
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef LFS_STINGY_CLEAN
|
||||
if(op == VN_CLEAN && ip->i_number != LFS_IFILE_INUM
|
||||
&& !(ip->i_flag & IN_CLEANING)) {
|
||||
vndebug(vp,"cleaning");
|
||||
continue;
|
||||
}
|
||||
#endif /* LFS_STINGY_CLEAN */
|
||||
|
||||
if (lfs_vref(vp)) {
|
||||
vndebug(vp,"vref");
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef LFS_USEDIROP
|
||||
/*
|
||||
* A removed Inode from a dirop we're writing
|
||||
*/
|
||||
if((vp->v_flag & VDIROP)
|
||||
&& !WRITEINPROG(vp)
|
||||
&& vp->v_usecount<3
|
||||
&& ip->i_ffs_nlink == 0
|
||||
&& !VOP_ISLOCKED(vp))
|
||||
{
|
||||
vndebug(vp,"vinactive");
|
||||
--fs->lfs_dirvcount;
|
||||
vp->v_flag &= ~VDIROP;
|
||||
wakeup(&fs->lfs_dirvcount);
|
||||
/*
|
||||
* vrele() will call VOP_INACTIVE for us, if
|
||||
* there are no active references to this vnode
|
||||
* (i.e. it was really removed).
|
||||
*/
|
||||
if(vp->v_usecount==2)
|
||||
lfs_vunref(vp);
|
||||
VOP_LOCK(vp,LK_EXCLUSIVE);
|
||||
vput(vp);
|
||||
continue; /* Don't lfs_vunref again */
|
||||
#if 0 /* XXX KS - if we skip the ifile, things could go badly for us. */
|
||||
if(WRITEINPROG(vp)) {
|
||||
lfs_vunref(vp);
|
||||
#ifdef DEBUG_LFS
|
||||
ivndebug(vp,"writevnodes/writeinprog");
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
#endif /* LFS_USEDIROP */
|
||||
|
||||
#endif
|
||||
/*
|
||||
* Write the inode/file if dirty and it's not the
|
||||
* the IFILE.
|
||||
@ -382,7 +355,7 @@ lfs_writevnodes(fs, mp, sp, op)
|
||||
if(vp->v_dirtyblkhd.lh_first != NULL) {
|
||||
if(WRITEINPROG(vp)) {
|
||||
#ifdef DEBUG_LFS
|
||||
printf("W");
|
||||
ivndebug(vp,"writevnodes/write2");
|
||||
#endif
|
||||
} else if(!(ip->i_flag & (IN_ACCESS|IN_CHANGE|IN_MODIFIED|IN_UPDATE|IN_CLEANING))) {
|
||||
#ifdef DEBUG_LFS
|
||||
@ -396,14 +369,12 @@ lfs_writevnodes(fs, mp, sp, op)
|
||||
inodes_written++;
|
||||
}
|
||||
|
||||
#ifdef LFS_USEDIROP
|
||||
if(vp->v_flag & VDIROP) {
|
||||
--fs->lfs_dirvcount;
|
||||
vp->v_flag &= ~VDIROP;
|
||||
wakeup(&fs->lfs_dirvcount);
|
||||
lfs_vunref(vp);
|
||||
}
|
||||
#endif /* LFS_USEDIROP */
|
||||
|
||||
lfs_vunref(vp);
|
||||
}
|
||||
@ -433,9 +404,7 @@ lfs_segwrite(mp, flags)
|
||||
ufs_daddr_t ibno;
|
||||
int do_ckp, error, i;
|
||||
int writer_set = 0;
|
||||
#ifdef LFS_CONSERVATIVE_LOCK
|
||||
int need_unlock = 0;
|
||||
#endif /* LFS_CONSERVATIVE_LOCK */
|
||||
|
||||
fs = VFSTOUFS(mp)->um_lfs;
|
||||
|
||||
@ -473,17 +442,13 @@ lfs_segwrite(mp, flags)
|
||||
sp = fs->lfs_sp;
|
||||
|
||||
/*
|
||||
* XXX KS - If lfs_flushvp is non-NULL, we are called from
|
||||
* lfs_vflush, in which case we have to flush *all* buffers
|
||||
* off of this vnode.
|
||||
* If lfs_flushvp is non-NULL, we are called from lfs_vflush,
|
||||
* in which case we have to flush *all* buffers off of this vnode.
|
||||
*/
|
||||
#ifdef LFS_STINGY_CLEAN
|
||||
if((sp->seg_flags & SEGM_CLEAN) && !(fs->lfs_flushvp))
|
||||
lfs_writevnodes(fs, mp, sp, VN_CLEAN);
|
||||
else {
|
||||
#endif /* LFS_STINGY_CLEAN */
|
||||
lfs_writevnodes(fs, mp, sp, VN_REG);
|
||||
#ifdef LFS_USEDIROP
|
||||
/*
|
||||
* XXX KS - If we're cleaning, we can't wait for dirops,
|
||||
* because they might be waiting on us. The downside of this
|
||||
@ -505,15 +470,7 @@ lfs_segwrite(mp, flags)
|
||||
lfs_writevnodes(fs, mp, sp, VN_DIROP);
|
||||
((SEGSUM *)(sp->segsum))->ss_flags &= ~(SS_CONT);
|
||||
}
|
||||
#if defined(DEBUG_LFS) && !defined(LFS_STINGY_BLOCKS)
|
||||
else if(fs->lfs_dirops) {
|
||||
printf("ignoring active dirops in favor of the cleaner\n");
|
||||
}
|
||||
#endif /* DEBUG_LFS && !LFS_STINGY_BLOCKS */
|
||||
#endif /* LFS_USEDIROP */
|
||||
#ifdef LFS_STINGY_CLEAN
|
||||
}
|
||||
#endif /* LFS_STINGY_CLEAN */
|
||||
|
||||
/*
|
||||
* If we are doing a checkpoint, mark everything since the
|
||||
@ -539,10 +496,6 @@ lfs_segwrite(mp, flags)
|
||||
if (do_ckp || fs->lfs_doifile) {
|
||||
redo:
|
||||
vp = fs->lfs_ivnode;
|
||||
#ifndef LFS_CONSERVATIVE_LOCK
|
||||
while (vget(vp, LK_EXCLUSIVE))
|
||||
continue;
|
||||
#else /* LFS_CONSERVATIVE_LOCK */
|
||||
/*
|
||||
* Depending on the circumstances of our calling, the ifile
|
||||
* inode might be locked. If it is, and if it is locked by
|
||||
@ -557,21 +510,16 @@ lfs_segwrite(mp, flags)
|
||||
continue;
|
||||
need_unlock = 1;
|
||||
}
|
||||
#endif /* LFS_CONSERVATIVE_LOCK */
|
||||
ip = VTOI(vp);
|
||||
if (vp->v_dirtyblkhd.lh_first != NULL)
|
||||
lfs_writefile(fs, sp, vp);
|
||||
(void)lfs_writeinode(fs, sp, ip);
|
||||
|
||||
#ifndef LFS_CONSERVATIVE_LOCK
|
||||
vput(vp);
|
||||
#else /* LFS_CONSERVATIVE_LOCK */
|
||||
/* Only vput if we used vget() above. */
|
||||
if(need_unlock)
|
||||
vput(vp);
|
||||
else
|
||||
vrele(vp);
|
||||
#endif /* LFS_CONSERVATIVE_LOCK */
|
||||
|
||||
if (lfs_writeseg(fs, sp) && do_ckp)
|
||||
goto redo;
|
||||
@ -584,11 +532,9 @@ lfs_segwrite(mp, flags)
|
||||
* At the moment, the user's process hangs around so we can
|
||||
* sleep.
|
||||
*/
|
||||
#ifdef LFS_USEDIROP
|
||||
fs->lfs_doifile = 0;
|
||||
if(writer_set && --fs->lfs_writer==0)
|
||||
wakeup(&fs->lfs_dirops);
|
||||
#endif /* LFS_USEDIROP */
|
||||
|
||||
if(lfs_dostats) {
|
||||
++lfs_stats.nwrites;
|
||||
@ -622,10 +568,8 @@ lfs_writefile(fs, sp, vp)
|
||||
sp->sum_bytes_left -= sizeof(struct finfo) - sizeof(ufs_daddr_t);
|
||||
++((SEGSUM *)(sp->segsum))->ss_nfinfo;
|
||||
|
||||
#ifdef LFS_USEDIROP
|
||||
if(vp->v_flag & VDIROP)
|
||||
((SEGSUM *)(sp->segsum))->ss_flags |= (SS_DIROP|SS_CONT);
|
||||
#endif
|
||||
|
||||
fip = sp->fip;
|
||||
fip->fi_nblocks = 0;
|
||||
@ -643,15 +587,14 @@ lfs_writefile(fs, sp, vp)
|
||||
* vnode is being flushed (for reuse by vinvalbuf); or (2) we are
|
||||
* checkpointing.
|
||||
*/
|
||||
#ifdef LFS_STINGY_BLOCKS
|
||||
if((sp->seg_flags & SEGM_CLEAN)
|
||||
&& VTOI(vp)->i_number != LFS_IFILE_INUM
|
||||
&& !IS_FLUSHING(fs,vp))
|
||||
{
|
||||
lfs_gather(fs, sp, vp, lfs_match_fake);
|
||||
} else
|
||||
#endif /* LFS_STINGY_BLOCKS */
|
||||
lfs_gather(fs, sp, vp, lfs_match_data);
|
||||
|
||||
if(lfs_writeindir
|
||||
|| IS_FLUSHING(fs,vp)
|
||||
|| (sp->seg_flags & SEGM_CKP))
|
||||
@ -721,20 +664,12 @@ lfs_writeinode(fs, sp, ip)
|
||||
/* Update the inode times and copy the inode onto the inode page. */
|
||||
if (ip->i_flag & (IN_CLEANING|IN_MODIFIED))
|
||||
--fs->lfs_uinodes;
|
||||
#ifdef DEBUG_LFS
|
||||
if((int32_t)fs->lfs_uinodes < 0) {
|
||||
printf("U2");
|
||||
fs->lfs_uinodes=0;
|
||||
}
|
||||
#endif
|
||||
TIMEVAL_TO_TIMESPEC(&time, &ts);
|
||||
LFS_ITIMES(ip, &ts, &ts, &ts);
|
||||
|
||||
#ifdef LFS_STINGY_CLEAN
|
||||
|
||||
if(ip->i_flag & IN_CLEANING)
|
||||
ip->i_flag &= ~IN_CLEANING;
|
||||
else
|
||||
#endif
|
||||
ip->i_flag &= ~(IN_ACCESS|IN_CHANGE|IN_MODIFIED|IN_UPDATE);
|
||||
|
||||
bp = sp->ibp;
|
||||
@ -1166,10 +1101,6 @@ lfs_writeseg(fs, sp)
|
||||
sup->su_ninos += ninos;
|
||||
++sup->su_nsums;
|
||||
|
||||
/* Now we can recover the bytes we lost to writevnodes */
|
||||
sup->su_nbytes -= fs->lfs_loanedbytes;
|
||||
fs->lfs_loanedbytes = 0;
|
||||
|
||||
do_again = !(bp->b_flags & B_GATHERED);
|
||||
(void)VOP_BWRITE(bp);
|
||||
/*
|
||||
@ -1255,11 +1186,6 @@ lfs_writeseg(fs, sp)
|
||||
* XXX == what do I do on an error?
|
||||
*/
|
||||
if ((bp->b_flags & (B_CALL|B_INVAL)) == (B_CALL|B_INVAL)) {
|
||||
#ifdef DEBUG
|
||||
if(incore(bp->b_vp, bp->b_lblkno)) {
|
||||
printf("lfs_writeseg: fake block (ino %d lbn %d) is also in core!\n", VTOI(bp->b_vp)->i_number, bp->b_lblkno);
|
||||
}
|
||||
#endif
|
||||
if (copyin(bp->b_saveaddr, p, bp->b_bcount))
|
||||
panic("lfs_writeseg: copyin failed [2]");
|
||||
} else
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_subr.c,v 1.8 1999/03/10 00:20:00 perseant Exp $ */
|
||||
/* $NetBSD: lfs_subr.c,v 1.9 1999/03/25 21:39:18 perseant Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -213,15 +213,11 @@ lfs_segunlock(fs)
|
||||
splx(s);
|
||||
if (ckp) {
|
||||
fs->lfs_nactive = 0;
|
||||
#ifndef LFS_TOGGLE_SB
|
||||
lfs_writesuper(fs,fs->lfs_sboffs[0]);
|
||||
#else
|
||||
/* If we *know* everything's on disk, write both sbs */
|
||||
if(sync)
|
||||
lfs_writesuper(fs,fs->lfs_sboffs[fs->lfs_activesb]);
|
||||
fs->lfs_activesb = 1 - fs->lfs_activesb;
|
||||
lfs_writesuper(fs,fs->lfs_sboffs[fs->lfs_activesb]);
|
||||
#endif
|
||||
}
|
||||
--fs->lfs_seglock;
|
||||
fs->lfs_lockpid = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_syscalls.c,v 1.22 1999/03/10 00:20:00 perseant Exp $ */
|
||||
/* $NetBSD: lfs_syscalls.c,v 1.23 1999/03/25 21:39:18 perseant Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -167,9 +167,6 @@ lfs_markv(p, v, retval)
|
||||
#endif /* CHECK_COPYIN */
|
||||
#ifdef LFS_TRACK_IOS
|
||||
int j;
|
||||
#endif
|
||||
#ifdef THROTTLE_REFERENCES
|
||||
ino_t refed_vnodes[LFS_VREF_THRESHOLD];
|
||||
#endif
|
||||
int numlocked=0, numrefed=0;
|
||||
|
||||
@ -258,26 +255,8 @@ lfs_markv(p, v, retval)
|
||||
VOP_UNLOCK(vp,0);
|
||||
numlocked--;
|
||||
}
|
||||
#ifndef THROTTLE_REFERENCES
|
||||
lfs_vunref(vp);
|
||||
numrefed--;
|
||||
#else
|
||||
/*
|
||||
* Have to do this so that getnewvnode doesn't
|
||||
* get ahold of one of these vnodes while
|
||||
* we're still processing others, set VXLOCK,
|
||||
* and prevent us from writing it out.
|
||||
* XXX Yuck.
|
||||
*/
|
||||
if(numrefed == LFS_VREF_THRESHOLD-1) {
|
||||
lfs_segwrite(mntp, SEGM_SYNC|SEGM_CLEAN|SEGM_CKP);
|
||||
while(--numrefed) {
|
||||
vp = ufs_ihashlookup(VFSTOUFS(mntp)->um_dev, refed_vnodes[numrefed]);
|
||||
if(vp && (VTOI(vp)->i_flag & IN_CLEANING))
|
||||
lfs_vunref(vp);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -315,11 +294,7 @@ lfs_markv(p, v, retval)
|
||||
numlocked++;
|
||||
|
||||
if(!error) {
|
||||
#ifndef THROTTLE_REFERENCES
|
||||
numrefed++;
|
||||
#else
|
||||
refed_vnodes[numrefed++] = blkp->bi_inode;
|
||||
#endif
|
||||
}
|
||||
if(error) {
|
||||
#ifdef DIAGNOSTIC
|
||||
@ -375,15 +350,9 @@ lfs_markv(p, v, retval)
|
||||
if(ifp->if_daddr == blkp->bi_daddr
|
||||
|| blkp->bi_daddr == LFS_FORCE_WRITE)
|
||||
{
|
||||
#ifndef STINGY_CLEAN
|
||||
if(!(ip->i_flag & IN_MODIFIED))
|
||||
fs->lfs_uinodes++;
|
||||
ip->i_flag |= IN_MODIFIED;
|
||||
#else
|
||||
if(!(ip->i_flag & IN_CLEANING))
|
||||
fs->lfs_uinodes++;
|
||||
ip->i_flag |= IN_CLEANING;
|
||||
#endif
|
||||
}
|
||||
brelse(bp);
|
||||
}
|
||||
@ -412,11 +381,6 @@ lfs_markv(p, v, retval)
|
||||
* allocate a fake buffer so that writeseg can perform
|
||||
* the copyin and write the buffer.
|
||||
*/
|
||||
#if 0 && defined(LFS_STINGY_CLEAN)
|
||||
if(!(ip->i_flag & IN_CLEANING))
|
||||
fs->lfs_uinodes++;
|
||||
ip->i_flag |= IN_CLEANING;
|
||||
#endif
|
||||
/*
|
||||
* XXX - if the block we are reading has been *extended* since
|
||||
* it was written to disk, then we risk throwing away
|
||||
@ -435,15 +399,10 @@ lfs_markv(p, v, retval)
|
||||
}
|
||||
if (blkp->bi_lbn >= 0) { /* Data Block */
|
||||
/* XXX KS - should we use incore here, or just always use getblk()? */
|
||||
if((bp=incore(vp, blkp->bi_lbn))!=NULL) {
|
||||
if(bp && bp->b_bcount > blkp->bi_size) {
|
||||
printf("lfs_markv: %ld > %d (fixed)\n",
|
||||
bp->b_bcount, blkp->bi_size);
|
||||
blkp->bi_size = bp->b_bcount;
|
||||
}
|
||||
bp = getblk(vp, blkp->bi_lbn, blkp->bi_size, 0, 0);
|
||||
} else
|
||||
bp = lfs_fakebuf(vp, blkp->bi_lbn, blkp->bi_size, blkp->bi_bp);
|
||||
bp = lfs_fakebuf(vp, blkp->bi_lbn,
|
||||
blkp->bi_size, blkp->bi_bp);
|
||||
/* Pretend we used bread() to get it */
|
||||
bp->b_blkno = blkp->bi_daddr;
|
||||
} else { /* Indirect block */
|
||||
bp = getblk(vp, blkp->bi_lbn, blkp->bi_size, 0, 0);
|
||||
if (!(bp->b_flags & (B_DONE|B_DELWRI))) { /* B_CACHE */
|
||||
@ -464,14 +423,6 @@ lfs_markv(p, v, retval)
|
||||
goto err2;
|
||||
}
|
||||
}
|
||||
#ifndef LFS_STINGY_CLEAN
|
||||
/*
|
||||
* At this point, we just write the block to be written again.
|
||||
* lfs_bwrite will not block for us since we are calling it
|
||||
* with the no-wait flag.
|
||||
*/
|
||||
ip->i_flag |= IN_UPDATE;
|
||||
#endif /* LFS_STINGY_CLEAN */
|
||||
if ((error = lfs_bwrite_ext(bp,BW_CLEAN)) != 0)
|
||||
goto err2;
|
||||
}
|
||||
@ -488,10 +439,8 @@ lfs_markv(p, v, retval)
|
||||
VOP_UNLOCK(vp,0);
|
||||
numlocked--;
|
||||
}
|
||||
#ifndef THROTTLE_REFERENCES
|
||||
lfs_vunref(vp);
|
||||
numrefed--;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -501,54 +450,8 @@ lfs_markv(p, v, retval)
|
||||
* we'd be unhappy at recovery time.
|
||||
*/
|
||||
lfs_segwrite(mntp, SEGM_SYNC|SEGM_CLEAN|SEGM_CKP);
|
||||
#ifdef THROTTLE_REFERENCES
|
||||
/* unref the last few vnodes */
|
||||
while(--numrefed) {
|
||||
vp = ufs_ihashlookup(VFSTOUFS(mntp)->um_dev, refed_vnodes[numrefed]);
|
||||
if(vp && (VTOI(vp)->i_flag & IN_CLEANING))
|
||||
lfs_vunref(vp);
|
||||
}
|
||||
#endif
|
||||
free(start, M_SEGMENT);
|
||||
|
||||
#ifdef LFS_STINGY_CLEAN
|
||||
/* Now that we've finished the segwrite, go back and unmark all
|
||||
of the vnodes */
|
||||
/* XXX this inverts the vnode freelist, use the back-hack instead */
|
||||
loop:
|
||||
for (vp = mntp->mnt_vnodelist.lh_first;
|
||||
vp != NULL;
|
||||
vp = vp->v_mntvnodes.le_next)
|
||||
{
|
||||
if (vp->v_mount != mntp)
|
||||
goto loop;
|
||||
if(lfs_vref(vp))
|
||||
continue;
|
||||
ip = VTOI(vp);
|
||||
if(ip->i_flag & IN_CLEANING) {
|
||||
ip->i_flag &= ~IN_CLEANING;
|
||||
printf("{%d}",ip->i_number);
|
||||
if(ip->i_flag & IN_MODIFIED) {
|
||||
fs->lfs_uinodes--;
|
||||
#ifdef DEBUG_LFS
|
||||
if((int32_t)fs->lfs_uinodes<0) {
|
||||
printf("U3");
|
||||
fs->lfs_uinodes=0;
|
||||
}
|
||||
#endif
|
||||
} else
|
||||
ip->i_flag |= IN_MODIFIED;
|
||||
if(lfs_clean_vnhead
|
||||
&& (VTOI(vp)->i_flag & (IN_ACCESS|IN_UPDATE|IN_CHANGE|IN_MODIFIED))==0)
|
||||
{
|
||||
lfs_vunref_head(vp);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
lfs_vunref(vp);
|
||||
}
|
||||
#endif /* LFS_STINGY_CLEAN */
|
||||
|
||||
lfs_segunlock(fs);
|
||||
|
||||
#ifdef DEBUG_LFS
|
||||
@ -1018,11 +921,6 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp, need_unlock)
|
||||
VOP_LOCK(*vpp,LK_EXCLUSIVE);
|
||||
*need_unlock |= FVG_UNLOCK;
|
||||
}
|
||||
#ifndef LFS_STINGY_CLEAN
|
||||
if (!(ip->i_flag & IN_MODIFIED))
|
||||
++ump->um_lfs->lfs_uinodes;
|
||||
ip->i_flag |= IN_MODIFIED;
|
||||
#endif /* LFS_STINGY_CLEAN */
|
||||
return (0);
|
||||
}
|
||||
#ifdef USE_UFS_HASHLOCK
|
||||
@ -1117,10 +1015,6 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp, need_unlock)
|
||||
* Finish inode initialization now that aliasing has been resolved.
|
||||
*/
|
||||
ip->i_devvp = ump->um_devvp;
|
||||
#ifndef LFS_STINGY_CLEAN
|
||||
ip->i_flag |= IN_MODIFIED;
|
||||
++ump->um_lfs->lfs_uinodes;
|
||||
#endif
|
||||
VREF(ip->i_devvp);
|
||||
*vpp = vp;
|
||||
*need_unlock |= FVG_PUT;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_vfsops.c,v 1.27 1999/03/24 11:05:31 tron Exp $ */
|
||||
/* $NetBSD: lfs_vfsops.c,v 1.28 1999/03/25 21:39:19 perseant Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -310,17 +310,11 @@ lfs_mountfs(devvp, mp, p)
|
||||
struct proc *p;
|
||||
{
|
||||
extern struct vnode *rootvp;
|
||||
struct dlfs *dfs;
|
||||
#ifdef LFS_TOGGLE_SB
|
||||
struct dlfs *adfs;
|
||||
#endif
|
||||
struct dlfs *dfs, *adfs;
|
||||
register struct lfs *fs;
|
||||
register struct ufsmount *ump;
|
||||
struct vnode *vp;
|
||||
struct buf *bp;
|
||||
#ifdef LFS_TOGGLE_SB
|
||||
struct buf *abp;
|
||||
#endif
|
||||
struct buf *bp, *abp;
|
||||
struct partinfo dpart;
|
||||
dev_t dev;
|
||||
int error, i, ronly, size;
|
||||
@ -361,7 +355,6 @@ lfs_mountfs(devvp, mp, p)
|
||||
goto out;
|
||||
dfs = (struct dlfs *)bp->b_data;
|
||||
|
||||
#ifdef LFS_TOGGLE_SB
|
||||
/*
|
||||
* Check the second superblock to see which is newer; then mount
|
||||
* using the older of the two. This is necessary to ensure that
|
||||
@ -373,7 +366,6 @@ lfs_mountfs(devvp, mp, p)
|
||||
adfs = (struct dlfs *)abp->b_data;
|
||||
if(adfs->dlfs_tstamp < dfs->dlfs_tstamp) /* XXX KS - 1s resolution? */
|
||||
dfs = adfs;
|
||||
#endif /* LFS_TOGGLE_SB */
|
||||
|
||||
/* Check the basics. */
|
||||
if (dfs->dlfs_magic != LFS_MAGIC || dfs->dlfs_bsize > MAXBSIZE ||
|
||||
@ -390,17 +382,13 @@ lfs_mountfs(devvp, mp, p)
|
||||
bp->b_flags |= B_INVAL;
|
||||
brelse(bp);
|
||||
bp = NULL;
|
||||
#ifdef LFS_TOGGLE_SB
|
||||
brelse(abp);
|
||||
abp = NULL;
|
||||
#endif
|
||||
|
||||
/* Set up the I/O information */
|
||||
fs->lfs_iocount = 0;
|
||||
fs->lfs_dirvcount = 0;
|
||||
#ifdef LFS_TOGGLE_SB
|
||||
fs->lfs_activesb = 0;
|
||||
#endif
|
||||
#ifdef LFS_CANNOT_ROLLFW
|
||||
fs->lfs_sbactive = NULL;
|
||||
#endif
|
||||
@ -408,7 +396,6 @@ lfs_mountfs(devvp, mp, p)
|
||||
for(i=0;i<LFS_THROTTLE;i++)
|
||||
fs->lfs_pending[i] = LFS_UNUSED_DADDR;
|
||||
#endif
|
||||
fs->lfs_loanedbytes=0;
|
||||
|
||||
/* Set up the ifile and lock aflags */
|
||||
fs->lfs_doifile = 0;
|
||||
@ -455,10 +442,8 @@ lfs_mountfs(devvp, mp, p)
|
||||
out:
|
||||
if (bp)
|
||||
brelse(bp);
|
||||
#ifdef TOGGLE_SB
|
||||
if (abp)
|
||||
brelse(abp);
|
||||
#endif
|
||||
(void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, cred, p);
|
||||
if (ump) {
|
||||
free(ump->um_lfs, M_UFSMNT);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_vnops.c,v 1.22 1999/03/10 00:20:00 perseant Exp $ */
|
||||
/* $NetBSD: lfs_vnops.c,v 1.23 1999/03/25 21:39:19 perseant Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -106,15 +106,9 @@ int (**lfs_vnodeop_p) __P((void *));
|
||||
struct vnodeopv_entry_desc lfs_vnodeop_entries[] = {
|
||||
{ &vop_default_desc, vn_default_error },
|
||||
{ &vop_lookup_desc, ufs_lookup }, /* lookup */
|
||||
#ifndef LFS_USEDIROP
|
||||
{ &vop_create_desc, ufs_create }, /* create */
|
||||
{ &vop_whiteout_desc, ufs_whiteout }, /* whiteout */
|
||||
{ &vop_mknod_desc, ufs_mknod }, /* mknod */
|
||||
#else
|
||||
{ &vop_create_desc, lfs_create }, /* create */
|
||||
{ &vop_whiteout_desc, lfs_whiteout }, /* whiteout */
|
||||
{ &vop_mknod_desc, lfs_mknod }, /* mknod */
|
||||
#endif
|
||||
{ &vop_open_desc, ufs_open }, /* open */
|
||||
{ &vop_close_desc, lfs_close }, /* close */
|
||||
{ &vop_access_desc, ufs_access }, /* access */
|
||||
@ -129,21 +123,12 @@ struct vnodeopv_entry_desc lfs_vnodeop_entries[] = {
|
||||
{ &vop_mmap_desc, ufs_mmap }, /* mmap */
|
||||
{ &vop_fsync_desc, lfs_fsync }, /* fsync */
|
||||
{ &vop_seek_desc, ufs_seek }, /* seek */
|
||||
#ifndef LFS_USEDIROP
|
||||
{ &vop_remove_desc, ufs_remove }, /* remove */
|
||||
{ &vop_link_desc, ufs_link }, /* link */
|
||||
{ &vop_rename_desc, ufs_rename }, /* rename */
|
||||
{ &vop_mkdir_desc, ufs_mkdir }, /* mkdir */
|
||||
{ &vop_rmdir_desc, ufs_rmdir }, /* rmdir */
|
||||
{ &vop_symlink_desc, ufs_symlink }, /* symlink */
|
||||
#else
|
||||
{ &vop_remove_desc, lfs_remove }, /* remove */
|
||||
{ &vop_link_desc, lfs_link }, /* link */
|
||||
{ &vop_rename_desc, lfs_rename }, /* rename */
|
||||
{ &vop_mkdir_desc, lfs_mkdir }, /* mkdir */
|
||||
{ &vop_rmdir_desc, lfs_rmdir }, /* rmdir */
|
||||
{ &vop_symlink_desc, lfs_symlink }, /* symlink */
|
||||
#endif
|
||||
{ &vop_readdir_desc, ufs_readdir }, /* readdir */
|
||||
{ &vop_readlink_desc, ufs_readlink }, /* readlink */
|
||||
{ &vop_abortop_desc, ufs_abortop }, /* abortop */
|
||||
@ -291,7 +276,6 @@ lfs_fsync(v)
|
||||
(ap->a_flags & FSYNC_WAIT) != 0 ? LFS_SYNC : 0)); /* XXX */
|
||||
}
|
||||
|
||||
#ifdef LFS_USEDIROP
|
||||
/*
|
||||
* These macros are used to bracket UFS directory ops, so that we can
|
||||
* identify all the pages touched during directory ops which need to
|
||||
@ -507,7 +491,6 @@ lfs_rename(v)
|
||||
SET_ENDOP(VTOI(ap->a_fdvp)->i_lfs);
|
||||
return (ret);
|
||||
}
|
||||
#endif /* LFS_USEDIROP */
|
||||
|
||||
/* XXX hack to avoid calling ITIMES in getattr */
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user