summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/ufs/lfs/lfs.h86
-rw-r--r--sys/ufs/lfs/lfs_alloc.c14
-rw-r--r--sys/ufs/lfs/lfs_balloc.c155
-rw-r--r--sys/ufs/lfs/lfs_bio.c14
-rw-r--r--sys/ufs/lfs/lfs_debug.c24
-rw-r--r--sys/ufs/lfs/lfs_extern.h16
-rw-r--r--sys/ufs/lfs/lfs_inode.c101
-rw-r--r--sys/ufs/lfs/lfs_segment.c144
-rw-r--r--sys/ufs/lfs/lfs_subr.c11
-rw-r--r--sys/ufs/lfs/lfs_syscalls.c49
-rw-r--r--sys/ufs/lfs/lfs_vfsops.c31
-rw-r--r--sys/ufs/lfs/lfs_vnops.c6
12 files changed, 424 insertions, 227 deletions
diff --git a/sys/ufs/lfs/lfs.h b/sys/ufs/lfs/lfs.h
index 7f9be0158a3..f0b710341d4 100644
--- a/sys/ufs/lfs/lfs.h
+++ b/sys/ufs/lfs/lfs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lfs.h,v 1.2 1996/02/27 07:13:18 niklas Exp $ */
+/* $OpenBSD: lfs.h,v 1.3 1996/07/01 07:41:46 downsj Exp $ */
/* $NetBSD: lfs.h,v 1.7 1996/02/09 22:28:45 christos Exp $ */
/*-
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)lfs.h 8.5 (Berkeley) 7/8/94
+ * @(#)lfs.h 8.9 (Berkeley) 5/8/95
*/
#define LFS_LABELPAD 8192 /* LFS label size */
@@ -79,7 +79,8 @@ struct finfo {
u_int32_t fi_nblocks; /* number of blocks */
u_int32_t fi_version; /* version number */
u_int32_t fi_ino; /* inode number */
- daddr_t fi_blocks[1]; /* array of logical block numbers */
+ u_int32_t fi_lastlength; /* length of last block in array */
+ ufs_daddr_t fi_blocks[1]; /* array of logical block numbers */
};
/* On-disk and in-memory super block. */
@@ -102,13 +103,13 @@ struct lfs {
u_int32_t lfs_nfiles; /* number of allocated inodes */
int32_t lfs_avail; /* blocks available for writing */
u_int32_t lfs_uinodes; /* inodes in cache not yet on disk */
- daddr_t lfs_idaddr; /* inode file disk address */
+ ufs_daddr_t lfs_idaddr; /* inode file disk address */
ino_t lfs_ifile; /* inode file inode number */
- daddr_t lfs_lastseg; /* address of last segment written */
- daddr_t lfs_nextseg; /* address of next segment to write */
- daddr_t lfs_curseg; /* current segment being written */
- daddr_t lfs_offset; /* offset in curseg for next partial */
- daddr_t lfs_lastpseg; /* address of last partial written */
+ ufs_daddr_t lfs_lastseg; /* address of last segment written */
+ ufs_daddr_t lfs_nextseg; /* address of next segment to write */
+ ufs_daddr_t lfs_curseg; /* current segment being written */
+ ufs_daddr_t lfs_offset; /* offset in curseg for next partial */
+ ufs_daddr_t lfs_lastpseg; /* address of last partial written */
u_int32_t lfs_tstamp; /* time stamp */
/* These are configuration parameters. */
@@ -128,11 +129,11 @@ struct lfs {
u_int32_t lfs_segmask; /* calculate offset within a segment */
u_int32_t lfs_segshift; /* fast mult/div for segments */
- u_int32_t lfs_bmask; /* calc block offset from file offset */
+ u_int64_t lfs_bmask; /* calc block offset from file offset */
u_int32_t lfs_bshift; /* calc block number from file offset */
- u_int32_t lfs_ffmask; /* calc frag offset from file offset */
+ u_int64_t lfs_ffmask; /* calc frag offset from file offset */
u_int32_t lfs_ffshift; /* fast mult/div for frag from file */
- u_int32_t lfs_fbmask; /* calc frag offset from block offset */
+ u_int64_t lfs_fbmask; /* calc frag offset from block offset */
u_int32_t lfs_fbshift; /* fast mult/div for frag from block */
u_int32_t lfs_fsbtodb; /* fsbtodb and dbtofsb shift constant */
u_int32_t lfs_sushift; /* fast mult/div for segusage table */
@@ -141,7 +142,7 @@ struct lfs {
#define LFS_MIN_SBINTERVAL 5 /* minimum superblock segment spacing */
#define LFS_MAXNUMSB 10 /* superblock disk offsets */
- daddr_t lfs_sboffs[LFS_MAXNUMSB];
+ ufs_daddr_t lfs_sboffs[LFS_MAXNUMSB];
/* Checksum -- last valid disk field. */
u_int32_t lfs_cksum; /* checksum for superblock checking */
@@ -191,7 +192,7 @@ typedef struct ifile IFILE;
struct ifile {
u_int32_t if_version; /* inode version number */
#define LFS_UNUSED_DADDR 0 /* out-of-band daddr */
- daddr_t if_daddr; /* inode disk address */
+ ufs_daddr_t if_daddr; /* inode disk address */
ino_t if_nextfree; /* next-unallocated inode */
};
@@ -218,7 +219,9 @@ typedef struct segsum SEGSUM;
struct segsum {
u_int32_t ss_sumsum; /* check sum of summary block */
u_int32_t ss_datasum; /* check sum of data */
- daddr_t ss_next; /* next segment */
+ u_int32_t ss_magic; /* segment summary magic number */
+#define SS_MAGIC 0x061561
+ ufs_daddr_t ss_next; /* next segment */
u_int32_t ss_create; /* creation time stamp */
u_int16_t ss_nfinfo; /* number of file info structures */
u_int16_t ss_ninos; /* number of inodes in summary */
@@ -236,26 +239,48 @@ struct segsum {
/* INOPB is the number of inodes in a secondary storage block. */
#define INOPB(fs) ((fs)->lfs_inopb)
-#define blksize(fs) ((fs)->lfs_bsize)
-#define blkoff(fs, loc) ((loc) & (fs)->lfs_bmask)
+#define blksize(fs, ip, lbn) \
+ (((lbn) >= NDADDR || (ip)->i_size >= ((lbn) + 1) << (fs)->lfs_bshift) \
+ ? (fs)->lfs_bsize \
+ : (fragroundup(fs, blkoff(fs, (ip)->i_size))))
+#define blkoff(fs, loc) ((int)((loc) & (fs)->lfs_bmask))
+#define fragoff(fs, loc) /* calculates (loc % fs->lfs_fsize) */ \
+ ((int)((loc) & (fs)->lfs_ffmask))
#define fsbtodb(fs, b) ((b) << (fs)->lfs_fsbtodb)
#define dbtofsb(fs, b) ((b) >> (fs)->lfs_fsbtodb)
+#define fragstodb(fs, b) ((b) << (fs)->lfs_fsbtodb - (fs)->lfs_fbshift)
+#define dbtofrags(fs, b) ((b) >> (fs)->lfs_fsbtodb - (fs)->lfs_fbshift)
#define lblkno(fs, loc) ((loc) >> (fs)->lfs_bshift)
#define lblktosize(fs, blk) ((blk) << (fs)->lfs_bshift)
-#define numfrags(fs, loc) /* calculates (loc / fs->fs_fsize) */ \
- ((loc) >> (fs)->lfs_bshift)
-
+#define numfrags(fs, loc) /* calculates (loc / fs->lfs_fsize) */ \
+ ((loc) >> (fs)->lfs_ffshift)
+#define blkroundup(fs, size) /* calculates roundup(size, fs->lfs_bsize) */ \
+ ((int)(((size) + (fs)->lfs_bmask) & (~(fs)->lfs_bmask)))
+#define fragroundup(fs, size) /* calculates roundup(size, fs->lfs_fsize) */ \
+ ((int)(((size) + (fs)->lfs_ffmask) & (~(fs)->lfs_ffmask)))
+#define fragstoblks(fs, frags) /* calculates (frags / fs->lfs_frag) */ \
+ ((frags) >> (fs)->lfs_fbshift)
+#define blkstofrags(fs, blks) /* calculates (blks * fs->lfs_frag) */ \
+ ((blks) << (fs)->lfs_fbshift)
+#define fragnum(fs, fsb) /* calculates (fsb % fs->lfs_frag) */ \
+ ((fsb) & ((fs)->lfs_frag - 1))
+#define blknum(fs, fsb) /* calculates rounddown(fsb, fs->lfs_frag) */ \
+ ((fsb) &~ ((fs)->lfs_frag - 1))
+#define dblksize(fs, dip, lbn) \
+ (((lbn) >= NDADDR || (dip)->di_size >= ((lbn) + 1) << (fs)->lfs_bshift)\
+ ? (fs)->lfs_bsize \
+ : (fragroundup(fs, blkoff(fs, (dip)->di_size))))
#define datosn(fs, daddr) /* disk address to segment number */ \
(((daddr) - (fs)->lfs_sboffs[0]) / fsbtodb((fs), (fs)->lfs_ssize))
#define sntoda(fs, sn) /* segment number to disk address */ \
- ((daddr_t)((sn) * ((fs)->lfs_ssize << (fs)->lfs_fsbtodb) + \
+ ((ufs_daddr_t)((sn) * ((fs)->lfs_ssize << (fs)->lfs_fsbtodb) + \
(fs)->lfs_sboffs[0]))
/* Read in the block with the cleaner info from the ifile. */
#define LFS_CLEANERINFO(CP, F, BP) { \
VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS; \
if (bread((F)->lfs_ivnode, \
- (daddr_t)0, (F)->lfs_bsize, NOCRED, &(BP))) \
+ (ufs_daddr_t)0, (F)->lfs_bsize, NOCRED, &(BP))) \
panic("lfs: ifile read"); \
(CP) = (CLEANERINFO *)(BP)->b_data; \
}
@@ -264,9 +289,9 @@ struct segsum {
#define LFS_IENTRY(IP, F, IN, BP) { \
int _e; \
VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS; \
- if ((_e = bread((F)->lfs_ivnode, \
+ if (_e = bread((F)->lfs_ivnode, \
(IN) / (F)->lfs_ifpb + (F)->lfs_cleansz + (F)->lfs_segtabsz,\
- (F)->lfs_bsize, NOCRED, &(BP))) != 0) \
+ (F)->lfs_bsize, NOCRED, &(BP))) \
panic("lfs: ifile read %d", _e); \
(IP) = (IFILE *)(BP)->b_data + (IN) % (F)->lfs_ifpb; \
}
@@ -275,11 +300,11 @@ struct segsum {
#define LFS_SEGENTRY(SP, F, IN, BP) { \
int _e; \
VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS; \
- if ((_e = bread((F)->lfs_ivnode, \
+ if (_e = bread((F)->lfs_ivnode, \
((IN) >> (F)->lfs_sushift) + (F)->lfs_cleansz, \
- (F)->lfs_bsize, NOCRED, &(BP))) != 0) \
+ (F)->lfs_bsize, NOCRED, &(BP))) \
panic("lfs: ifile read: %d", _e); \
- (SP) = (SEGUSE *)(BP)->b_data + ((IN) & ((F)->lfs_sepb - 1)); \
+ (SP) = (SEGUSE *)(BP)->b_data + ((IN) & (F)->lfs_sepb - 1); \
}
/*
@@ -302,11 +327,12 @@ struct segsum {
*/
typedef struct block_info {
ino_t bi_inode; /* inode # */
- daddr_t bi_lbn; /* logical block w/in file */
- daddr_t bi_daddr; /* disk address of block */
+ ufs_daddr_t bi_lbn; /* logical block w/in file */
+ ufs_daddr_t bi_daddr; /* disk address of block */
time_t bi_segcreate; /* origin segment create time */
int bi_version; /* file version number */
void *bi_bp; /* data buffer */
+ int bi_size; /* size of the block (if fragment) */
} BLOCK_INFO;
/* In-memory description of a segment about to be written. */
@@ -323,7 +349,7 @@ struct segment {
u_int32_t seg_bytes_left; /* bytes left in segment */
u_int32_t sum_bytes_left; /* bytes left in summary block */
u_int32_t seg_number; /* number of this segment */
- daddr_t *start_lbp; /* beginning lbn for this set */
+ ufs_daddr_t *start_lbp; /* beginning lbn for this set */
#define SEGM_CKP 0x01 /* doing a checkpoint */
#define SEGM_CLEAN 0x02 /* cleaner call; don't sort */
diff --git a/sys/ufs/lfs/lfs_alloc.c b/sys/ufs/lfs/lfs_alloc.c
index b499ebd5b06..ec177b159ab 100644
--- a/sys/ufs/lfs/lfs_alloc.c
+++ b/sys/ufs/lfs/lfs_alloc.c
@@ -1,8 +1,8 @@
-/* $OpenBSD: lfs_alloc.c,v 1.4 1996/04/21 22:32:39 deraadt Exp $ */
+/* $OpenBSD: lfs_alloc.c,v 1.5 1996/07/01 07:41:47 downsj Exp $ */
/* $NetBSD: lfs_alloc.c,v 1.4 1996/03/25 12:53:37 pk Exp $ */
/*
- * Copyright (c) 1991, 1993
+ * Copyright (c) 1991, 1993, 1995
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)lfs_alloc.c 8.4 (Berkeley) 1/4/94
+ * @(#)lfs_alloc.c 8.7 (Berkeley) 5/14/95
*/
#include <sys/param.h>
@@ -75,7 +75,7 @@ lfs_valloc(v)
struct ifile *ifp;
struct inode *ip;
struct vnode *vp;
- daddr_t blkno;
+ ufs_daddr_t blkno;
ino_t new_ino;
u_long i, max;
int error;
@@ -102,7 +102,7 @@ lfs_valloc(v)
vp = fs->lfs_ivnode;
ip = VTOI(vp);
blkno = lblkno(fs, ip->i_size);
- lfs_balloc(vp, fs->lfs_bsize, blkno, &bp);
+ lfs_balloc(vp, 0, fs->lfs_bsize, blkno, &bp);
ip->i_size += fs->lfs_bsize;
vnode_pager_setsize(vp, (u_long)ip->i_size);
vnode_pager_uncache(vp);
@@ -189,8 +189,6 @@ lfs_vcreate(mp, ino, vpp)
ip->i_flag = IN_MODIFIED;
ip->i_dev = ump->um_dev;
ip->i_number = ip->i_din.di_inumber = ino;
-ip->i_din.di_spare[0] = 0xdeadbeef;
-ip->i_din.di_spare[1] = 0xdeadbeef;
ip->i_lfs = ump->um_lfs;
#ifdef QUOTA
for (i = 0; i < MAXQUOTAS; i++)
@@ -221,7 +219,7 @@ lfs_vfree(v)
struct ifile *ifp;
struct inode *ip;
struct lfs *fs;
- daddr_t old_iaddr;
+ ufs_daddr_t old_iaddr;
ino_t ino;
/* Get the inode number and file system. */
diff --git a/sys/ufs/lfs/lfs_balloc.c b/sys/ufs/lfs/lfs_balloc.c
index 72c1fb4ee52..f00ee4b9203 100644
--- a/sys/ufs/lfs/lfs_balloc.c
+++ b/sys/ufs/lfs/lfs_balloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lfs_balloc.c,v 1.2 1996/02/27 07:13:20 niklas Exp $ */
+/* $OpenBSD: lfs_balloc.c,v 1.3 1996/07/01 07:41:48 downsj Exp $ */
/* $NetBSD: lfs_balloc.c,v 1.3 1996/02/09 22:28:48 christos Exp $ */
/*
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)lfs_balloc.c 8.1 (Berkeley) 6/11/93
+ * @(#)lfs_balloc.c 8.4 (Berkeley) 5/8/95
*/
#include <sys/param.h>
#include <sys/systm.h>
@@ -55,18 +55,20 @@
#include <ufs/lfs/lfs_extern.h>
int
-lfs_balloc(vp, iosize, lbn, bpp)
+lfs_balloc(vp, offset, iosize, lbn, bpp)
struct vnode *vp;
+ int offset;
u_long iosize;
- daddr_t lbn;
+ ufs_daddr_t lbn;
struct buf **bpp;
{
struct buf *ibp, *bp;
struct inode *ip;
struct lfs *fs;
struct indir indirs[NIADDR+2];
- daddr_t daddr;
- int bb, error, i, num;
+ ufs_daddr_t daddr, lastblock;
+ int bb; /* number of disk blocks in a block disk blocks */
+ int error, frags, i, nsize, osize, num;
ip = VTOI(vp);
fs = ip->i_lfs;
@@ -79,6 +81,9 @@ lfs_balloc(vp, iosize, lbn, bpp)
* or written earlier). If it did, make sure we don't count it as a
* new block or zero out its contents. If it did not, make sure
* we allocate any necessary indirect blocks.
+ * If we are writing a block beyond the end of the file, we need to
+ * check if the old last block was a fragment. If it was, we need
+ * to rewrite it.
*/
*bpp = NULL;
@@ -86,37 +91,81 @@ lfs_balloc(vp, iosize, lbn, bpp)
if (error)
return (error);
- *bpp = bp = getblk(vp, lbn, fs->lfs_bsize, 0, 0);
+ /* Check for block beyond end of file and fragment extension needed. */
+ lastblock = lblkno(fs, ip->i_size);
+ if (lastblock < NDADDR && lastblock < lbn) {
+ osize = blksize(fs, ip, lastblock);
+ if (osize < fs->lfs_bsize && osize > 0) {
+ if (error = lfs_fragextend(vp, osize, fs->lfs_bsize,
+ lastblock, &bp))
+ return(error);
+ ip->i_size = (lastblock + 1) * fs->lfs_bsize;
+ vnode_pager_setsize(vp, (u_long)ip->i_size);
+ ip->i_flag |= IN_CHANGE | IN_UPDATE;
+ VOP_BWRITE(bp);
+ }
+ }
+
bb = VFSTOUFS(vp->v_mount)->um_seqinc;
if (daddr == UNASSIGNED)
/* May need to allocate indirect blocks */
for (i = 1; i < num; ++i)
if (!indirs[i].in_exists) {
- ibp =
- getblk(vp, indirs[i].in_lbn, fs->lfs_bsize,
- 0, 0);
- if (!(ibp->b_flags & (B_DONE | B_DELWRI))) {
- if (!ISSPACE(fs, bb, curproc->p_ucred)){
- ibp->b_flags |= B_INVAL;
- brelse(ibp);
- error = ENOSPC;
- } else {
- ip->i_blocks += bb;
- ip->i_lfs->lfs_bfree -= bb;
- clrbuf(ibp);
- error = VOP_BWRITE(ibp);
- }
- } else
+ ibp = getblk(vp, indirs[i].in_lbn, fs->lfs_bsize,
+ 0, 0);
+ if ((ibp->b_flags & (B_DONE | B_DELWRI)))
panic ("Indirect block should not exist");
- }
- if (error) {
- if (bp)
- brelse(bp);
- return(error);
- }
+ if (!ISSPACE(fs, bb, curproc->p_ucred)){
+ ibp->b_flags |= B_INVAL;
+ brelse(ibp);
+ return(ENOSPC);
+ } else {
+ ip->i_blocks += bb;
+ ip->i_lfs->lfs_bfree -= bb;
+ clrbuf(ibp);
+ if(error = VOP_BWRITE(ibp))
+ return(error);
+ }
+ }
+
+ /*
+ * If the block we are writing is a direct block, it's the last
+ * block in the file, and offset + iosize is less than a full
+ * block, we can write one or more fragments. There are two cases:
+ * the block is brand new and we should allocate it the correct
+ * size or it already exists and contains some fragments and
+ * may need to extend it.
+ */
+ if (lbn < NDADDR && lblkno(fs, ip->i_size) == lbn) {
+ nsize = fragroundup(fs, offset + iosize);
+ frags = numfrags(fs, nsize);
+ bb = fragstodb(fs, frags);
+ if (lblktosize(fs, lbn) == ip->i_size)
+ /* Brand new block or fragment */
+ *bpp = bp = getblk(vp, lbn, nsize, 0, 0);
+ else {
+ /* Extend existing block */
+ if (error = lfs_fragextend(vp, (int)blksize(fs, ip, lbn),
+ nsize, lbn, &bp))
+ return(error);
+ *bpp = bp;
+ }
+ } else {
+ /*
+ * Get the existing block from the cache either because the
+ * block is 1) not a direct block or because it's not the last
+ * block in the file.
+ */
+ frags = dbtofrags(fs, bb);
+ *bpp = bp = getblk(vp, lbn, blksize(fs, ip, lbn), 0, 0);
+ }
- /* Now, we may need to allocate the data block */
+ /*
+ * The block we are writing may be a brand new block
+ * in which case we need to do accounting (i.e. check
+ * for free space and update the inode number of blocks.
+ */
if (!(bp->b_flags & (B_CACHE | B_DONE | B_DELWRI))) {
if (daddr == UNASSIGNED)
if (!ISSPACE(fs, bb, curproc->p_ucred)) {
@@ -130,13 +179,57 @@ lfs_balloc(vp, iosize, lbn, bpp)
clrbuf(bp);
}
else if (iosize == fs->lfs_bsize)
- bp->b_blkno = daddr; /* Skip the I/O */
+ /* Optimization: I/O is unnecessary. */
+ bp->b_blkno = daddr;
else {
+ /*
+ * We need to read the block to preserve the
+ * existing bytes.
+ */
bp->b_blkno = daddr;
bp->b_flags |= B_READ;
VOP_STRATEGY(bp);
return(biowait(bp));
}
}
- return (error);
+ return (0);
+}
+
+lfs_fragextend(vp, osize, nsize, lbn, bpp)
+ struct vnode *vp;
+ int osize;
+ int nsize;
+ daddr_t lbn;
+ struct buf **bpp;
+{
+ struct inode *ip;
+ struct lfs *fs;
+ long bb;
+ int error;
+
+ ip = VTOI(vp);
+ fs = ip->i_lfs;
+ bb = (long)fragstodb(fs, numfrags(fs, nsize - osize));
+ if (!ISSPACE(fs, bb, curproc->p_ucred)) {
+ return(ENOSPC);
+ }
+
+ error = bread(vp, lbn, osize, NOCRED, bpp);
+ if (error != 0) {
+ brelse(*bpp);
+ return(error);
+ }
+#ifdef QUOTA
+ error = chkdq(ip, bb, curproc->p_ucred, 0);
+ if (error != 0) {
+ brelse(*bpp);
+ return (error);
+ }
+#endif
+ ip->i_blocks += bb;
+ ip->i_flag |= IN_CHANGE | IN_UPDATE;
+ fs->lfs_bfree -= fragstodb(fs, numfrags(fs, (nsize - osize)));
+ allocbuf(*bpp, nsize);
+ bzero((char *)((*bpp)->b_data) + osize, (u_int)(nsize - osize));
+ return(0);
}
diff --git a/sys/ufs/lfs/lfs_bio.c b/sys/ufs/lfs/lfs_bio.c
index 436de8780d9..9d8aec4ae3d 100644
--- a/sys/ufs/lfs/lfs_bio.c
+++ b/sys/ufs/lfs/lfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lfs_bio.c,v 1.3 1996/06/14 04:39:13 tholo Exp $ */
+/* $OpenBSD: lfs_bio.c,v 1.4 1996/07/01 07:41:49 downsj Exp $ */
/* $NetBSD: lfs_bio.c,v 1.5 1996/02/09 22:28:49 christos Exp $ */
/*
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)lfs_bio.c 8.4 (Berkeley) 12/30/93
+ * @(#)lfs_bio.c 8.10 (Berkeley) 6/10/95
*/
#include <sys/param.h>
@@ -82,7 +82,7 @@ lfs_bwrite(v)
register struct buf *bp = ap->a_bp;
struct lfs *fs;
struct inode *ip;
- int error, s;
+ int db, error, s;
/*
* Set the delayed write flag and use reassignbuf to move the buffer
@@ -100,10 +100,12 @@ lfs_bwrite(v)
*/
if (!(bp->b_flags & B_LOCKED)) {
fs = VFSTOUFS(bp->b_vp->v_mount)->um_lfs;
- while (!LFS_FITS(fs, fsbtodb(fs, 1)) && !IS_IFILE(bp) &&
+ db = fragstodb(fs, numfrags(fs, bp->b_bcount));
+ while (!LFS_FITS(fs, db) && !IS_IFILE(bp) &&
bp->b_lblkno > 0) {
/* Out of space, need cleaner to run */
wakeup(&lfs_allclean_wakeup);
+ wakeup(&fs->lfs_nextseg);
error = tsleep(&fs->lfs_avail, PCATCH | PUSER,
"cleaner", NULL);
if (error) {
@@ -115,7 +117,7 @@ lfs_bwrite(v)
if (!(ip->i_flag & IN_MODIFIED))
++fs->lfs_uinodes;
ip->i_flag |= IN_CHANGE | IN_MODIFIED | IN_UPDATE;
- fs->lfs_avail -= fsbtodb(fs, 1);
+ fs->lfs_avail -= db;
++locked_queue_count;
bp->b_flags |= B_DELWRI | B_LOCKED;
TAILQ_INSERT_TAIL(&bdirties, bp, b_synclist);
@@ -176,7 +178,7 @@ lfs_flush()
int
lfs_check(vp, blkno)
struct vnode *vp;
- daddr_t blkno;
+ ufs_daddr_t blkno;
{
int error;
diff --git a/sys/ufs/lfs/lfs_debug.c b/sys/ufs/lfs/lfs_debug.c
index dea18884d51..f2b1d99f5d6 100644
--- a/sys/ufs/lfs/lfs_debug.c
+++ b/sys/ufs/lfs/lfs_debug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lfs_debug.c,v 1.3 1996/04/21 22:32:42 deraadt Exp $ */
+/* $OpenBSD: lfs_debug.c,v 1.4 1996/07/01 07:41:50 downsj Exp $ */
/* $NetBSD: lfs_debug.c,v 1.4 1996/03/17 02:16:28 christos Exp $ */
/*
@@ -54,7 +54,7 @@ lfs_dump_super(lfsp)
{
int i;
- (void)printf("%s%x\t%s%x\t%s%d\t%s%d\n",
+ (void)printf("%s%lx\t%s%lx\t%s%d\t%s%d\n",
"magic ", lfsp->lfs_magic,
"version ", lfsp->lfs_version,
"size ", lfsp->lfs_size,
@@ -77,19 +77,19 @@ lfs_dump_super(lfsp)
"cleansz ", lfsp->lfs_cleansz,
"segtabsz ", lfsp->lfs_segtabsz);
- (void)printf("%s%x\t%s%d\t%s%x\t%s%d\n",
+ (void)printf("%s%lx\t%s%d\t%s%lx\t%s%d\n",
"segmask ", lfsp->lfs_segmask,
"segshift ", lfsp->lfs_segshift,
"bmask ", lfsp->lfs_bmask,
"bshift ", lfsp->lfs_bshift);
- (void)printf("%s%x\t%s%d\t%s%x\t%s%d\n",
+ (void)printf("%s%lx\t%s%d\t%s%lx\t%s%d\n",
"ffmask ", lfsp->lfs_ffmask,
"ffshift ", lfsp->lfs_ffshift,
"fbmask ", lfsp->lfs_fbmask,
"fbshift ", lfsp->lfs_fbshift);
- (void)printf("%s%d\t%s%d\t%s%x\t%s%qx\n",
+ (void)printf("%s%d\t%s%d\t%s%lx\t%s%qx\n",
"sushift ", lfsp->lfs_sushift,
"fsbtodb ", lfsp->lfs_fsbtodb,
"cksum ", lfsp->lfs_cksum,
@@ -97,22 +97,22 @@ lfs_dump_super(lfsp)
(void)printf("Superblock disk addresses:");
for (i = 0; i < LFS_MAXNUMSB; i++)
- (void)printf(" %x", lfsp->lfs_sboffs[i]);
+ (void)printf(" %lx", lfsp->lfs_sboffs[i]);
(void)printf("\n");
(void)printf("Checkpoint Info\n");
- (void)printf("%s%d\t%s%x\t%s%d\n",
+ (void)printf("%s%d\t%s%lx\t%s%d\n",
"free ", lfsp->lfs_free,
"idaddr ", lfsp->lfs_idaddr,
"ifile ", lfsp->lfs_ifile);
- (void)printf("%s%x\t%s%d\t%s%x\t%s%x\t%s%x\t%s%x\n",
+ (void)printf("%s%lx\t%s%d\t%s%lx\t%s%lx\t%s%lx\t%s%lx\n",
"bfree ", lfsp->lfs_bfree,
"nfiles ", lfsp->lfs_nfiles,
"lastseg ", lfsp->lfs_lastseg,
"nextseg ", lfsp->lfs_nextseg,
"curseg ", lfsp->lfs_curseg,
"offset ", lfsp->lfs_offset);
- (void)printf("tstamp %x\n", lfsp->lfs_tstamp);
+ (void)printf("tstamp %lx\n", lfsp->lfs_tstamp);
}
void
@@ -127,15 +127,15 @@ lfs_dump_dinode(dip)
"uid ", dip->di_uid,
"gid ", dip->di_gid,
"size ", dip->di_size);
- (void)printf("inum %d\n", dip->di_inumber);
+ (void)printf("inum %ld\n", dip->di_inumber);
(void)printf("Direct Addresses\n");
for (i = 0; i < NDADDR; i++) {
- (void)printf("\t%x", dip->di_db[i]);
+ (void)printf("\t%lx", dip->di_db[i]);
if ((i % 6) == 5)
(void)printf("\n");
}
for (i = 0; i < NIADDR; i++)
- (void)printf("\t%x", dip->di_ib[i]);
+ (void)printf("\t%lx", dip->di_ib[i]);
(void)printf("\n");
}
#endif /* DEBUG */
diff --git a/sys/ufs/lfs/lfs_extern.h b/sys/ufs/lfs/lfs_extern.h
index 826e7f14356..0cfd6467838 100644
--- a/sys/ufs/lfs/lfs_extern.h
+++ b/sys/ufs/lfs/lfs_extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lfs_extern.h,v 1.2 1996/02/27 07:13:24 niklas Exp $ */
+/* $OpenBSD: lfs_extern.h,v 1.3 1996/07/01 07:41:51 downsj Exp $ */
/* $NetBSD: lfs_extern.h,v 1.5 1996/02/12 15:20:12 christos Exp $ */
/*-
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)lfs_extern.h 8.3 (Berkeley) 6/16/94
+ * @(#)lfs_extern.h 8.6 (Berkeley) 5/8/95
*/
struct fid;
@@ -52,17 +52,19 @@ struct lfs;
struct segment;
struct ucred;
+#include <ufs/ufs/dinode.h>
+
__BEGIN_DECLS
/* lfs_alloc.c */
int lfs_vcreate __P((struct mount *, ino_t, struct vnode **));
/* lfs_balloc.c */
-int lfs_balloc __P((struct vnode *, u_long, daddr_t, struct buf **));
+int lfs_balloc __P((struct vnode *, int, u_long, ufs_daddr_t, struct buf **));
/* lfs_bio.c */
void lfs_flush __P((void));
-int lfs_check __P((struct vnode *, daddr_t));
+int lfs_check __P((struct vnode *, ufs_daddr_t));
/* lfs_cksum.c */
u_long cksum __P((void *, size_t));
@@ -94,10 +96,10 @@ int lfs_match_data __P((struct lfs *, struct buf *));
int lfs_match_indir __P((struct lfs *, struct buf *));
int lfs_match_dindir __P((struct lfs *, struct buf *));
int lfs_match_tindir __P((struct lfs *, struct buf *));
-struct buf *lfs_newbuf __P((struct vnode *, daddr_t, size_t));
+struct buf *lfs_newbuf __P((struct vnode *, ufs_daddr_t, size_t));
void lfs_callback __P((struct buf *));
void lfs_supercallback __P((struct buf *));
-void lfs_shellsort __P((struct buf **, daddr_t *, int));
+void lfs_shellsort __P((struct buf **, ufs_daddr_t *, int));
int lfs_vref __P((struct vnode *));
void lfs_vunref __P((struct vnode *));
@@ -106,7 +108,7 @@ void lfs_seglock __P((struct lfs *, unsigned long));
void lfs_segunlock __P((struct lfs *));
/* lfs_syscalls.c */
-int lfs_fastvget __P((struct mount *, ino_t, daddr_t, struct vnode **, struct dinode *));
+int lfs_fastvget __P((struct mount *, ino_t, ufs_daddr_t, struct vnode **, struct dinode *));
struct buf *lfs_fakebuf __P((struct vnode *, int, size_t, caddr_t));
/* lfs_vfsops.c */
diff --git a/sys/ufs/lfs/lfs_inode.c b/sys/ufs/lfs/lfs_inode.c
index 882e7c535c8..b778b7db9fd 100644
--- a/sys/ufs/lfs/lfs_inode.c
+++ b/sys/ufs/lfs/lfs_inode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lfs_inode.c,v 1.3 1996/05/22 11:47:19 deraadt Exp $ */
+/* $OpenBSD: lfs_inode.c,v 1.4 1996/07/01 07:41:51 downsj Exp $ */
/* $NetBSD: lfs_inode.c,v 1.5 1996/05/11 18:27:35 mycroft Exp $ */
/*
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)lfs_inode.c 8.5 (Berkeley) 12/30/93
+ * @(#)lfs_inode.c 8.9 (Berkeley) 5/8/95
*/
#include <sys/param.h>
@@ -56,12 +56,6 @@
#include <ufs/lfs/lfs.h>
#include <ufs/lfs/lfs_extern.h>
-void
-lfs_init()
-{
- ufs_init();
-}
-
/* Search a block for a specific dinode. */
struct dinode *
lfs_ifind(fs, ino, dip)
@@ -126,22 +120,22 @@ lfs_update(v)
#define UPDATE_SEGUSE \
if (lastseg != -1) { \
LFS_SEGENTRY(sup, fs, lastseg, sup_bp); \
- if ((num << fs->lfs_bshift) > sup->su_nbytes) \
+ if (num > sup->su_nbytes) \
panic("lfs_truncate: negative bytes in segment %d\n", \
lastseg); \
- sup->su_nbytes -= num << fs->lfs_bshift; \
+ sup->su_nbytes -= num; \
e1 = VOP_BWRITE(sup_bp); \
- blocksreleased += num; \
+ fragsreleased += numfrags(fs, num); \
}
-#define SEGDEC { \
+#define SEGDEC(S) { \
if (daddr != 0) { \
if (lastseg != (seg = datosn(fs, daddr))) { \
UPDATE_SEGUSE; \
- num = 1; \
+ num = (S); \
lastseg = seg; \
} else \
- ++num; \
+ num += (S); \
} \
}
@@ -163,7 +157,7 @@ lfs_truncate(v)
} */ *ap = v;
register struct indir *inp;
register int i;
- register daddr_t *daddrp;
+ register ufs_daddr_t *daddrp;
register struct vnode *vp = ap->a_vp;
off_t length = ap->a_length;
struct buf *bp, *sup_bp;
@@ -173,9 +167,10 @@ lfs_truncate(v)
struct lfs *fs;
struct indir a[NIADDR + 2], a_end[NIADDR + 2];
SEGUSE *sup;
- daddr_t daddr, lastblock, lbn, olastblock;
- long off, a_released, blocksreleased, i_released;
- int e1, e2, depth, lastseg, num, offset, seg, size;
+ ufs_daddr_t daddr, lastblock, lbn, olastblock;
+ ufs_daddr_t oldsize_lastblock, oldsize_newlast, newsize;
+ long off, a_released, fragsreleased, i_released;
+ int e1, e2, depth, lastseg, num, offset, seg, freesize;
ip = VTOI(vp);
TIMEVAL_TO_TIMESPEC(&time, &ts);
@@ -211,13 +206,18 @@ lfs_truncate(v)
* Update the size of the file. If the file is not being truncated to
* a block boundry, the contents of the partial block following the end
* of the file must be zero'ed in case it ever become accessable again
- * because of subsequent file growth.
+ * because of subsequent file growth. For this part of the code,
+ * oldsize_newlast refers to the old size of the new last block in the file.
*/
offset = blkoff(fs, length);
+ lbn = lblkno(fs, length);
+ oldsize_newlast = blksize(fs, ip, lbn);
+
+ /* Now set oldsize to the current size of the current last block */
+ oldsize_lastblock = blksize(fs, ip, olastblock);
if (offset == 0)
ip->i_size = length;
else {
- lbn = lblkno(fs, length);
#ifdef QUOTA
if ((e1 = getinoquota(ip)) != 0)
return (e1);
@@ -225,10 +225,10 @@ lfs_truncate(v)
if ((e1 = bread(vp, lbn, fs->lfs_bsize, NOCRED, &bp)) != 0)
return (e1);
ip->i_size = length;
- size = blksize(fs);
(void)vnode_pager_uncache(vp);
- bzero((char *)bp->b_data + offset, (u_int)(size - offset));
- allocbuf(bp, size);
+ newsize = blksize(fs, ip, lbn);
+ bzero((char *)bp->b_data + offset, (u_int)(newsize - offset));
+ allocbuf(bp, newsize);
if ((e1 = VOP_BWRITE(bp)) != 0)
return (e1);
}
@@ -236,20 +236,24 @@ lfs_truncate(v)
* Modify sup->su_nbyte counters for each deleted block; keep track
* of number of blocks removed for ip->i_blocks.
*/
- blocksreleased = 0;
+ fragsreleased = 0;
num = 0;
lastseg = -1;
for (lbn = olastblock; lbn >= lastblock;) {
/* XXX use run length from bmap array to make this faster */
ufs_bmaparray(vp, lbn, &daddr, a, &depth, NULL);
- if (lbn == olastblock)
+ if (lbn == olastblock) {
for (i = NIADDR + 2; i--;)
a_end[i] = a[i];
+ freesize = oldsize_lastblock;
+ } else
+ freesize = fs->lfs_bsize;
+
switch (depth) {
case 0: /* Direct block. */
daddr = ip->i_db[lbn];
- SEGDEC;
+ SEGDEC(freesize);
ip->i_db[lbn] = 0;
--lbn;
break;
@@ -271,19 +275,20 @@ lfs_truncate(v)
inp->in_lbn, fs->lfs_bsize, NOCRED, &bp))
panic("lfs_truncate: bread bno %d",
inp->in_lbn);
- daddrp = (daddr_t *)bp->b_data + inp->in_off;
+ daddrp = (ufs_daddr_t *)bp->b_data +
+ inp->in_off;
for (i = inp->in_off;
i++ <= a_end[depth].in_off;) {
daddr = *daddrp++;
- SEGDEC;
+ SEGDEC(freesize);
}
a_end[depth].in_off = NINDIR(fs) - 1;
if (inp->in_off == 0)
brelse (bp);
else {
- bzero((daddr_t *)bp->b_data +
+ bzero((ufs_daddr_t *)bp->b_data +
inp->in_off, fs->lfs_bsize -
- inp->in_off * sizeof(daddr_t));
+ inp->in_off * sizeof(ufs_daddr_t));
if ((e1 = VOP_BWRITE(bp)) != 0)
return (e1);
}
@@ -291,7 +296,7 @@ lfs_truncate(v)
if (depth == 0 && a[1].in_off == 0) {
off = a[0].in_off;
daddr = ip->i_ib[off];
- SEGDEC;
+ SEGDEC(freesize);
ip->i_ib[off] = 0;
}
if (lbn == lastblock || lbn <= NDADDR)
@@ -313,13 +318,14 @@ lfs_truncate(v)
}
#ifdef DIAGNOSTIC
- if (ip->i_blocks < fsbtodb(fs, blocksreleased)) {
- printf("lfs_truncate: block count < 0\n");
- blocksreleased = ip->i_blocks;
+ if (ip->i_blocks < fragstodb(fs, fragsreleased)) {
+ printf("lfs_truncate: frag count < 0\n");
+ fragsreleased = dbtofrags(fs, ip->i_blocks);
+ panic("lfs_truncate: frag count < 0\n");
}
#endif
- ip->i_blocks -= fsbtodb(fs, blocksreleased);
- fs->lfs_bfree += fsbtodb(fs, blocksreleased);
+ ip->i_blocks -= fragstodb(fs, fragsreleased);
+ fs->lfs_bfree += fragstodb(fs, fragsreleased);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
/*
* Traverse dirty block list counting number of dirty buffers
@@ -330,7 +336,7 @@ lfs_truncate(v)
i_released = 0;
for (bp = vp->v_dirtyblkhd.lh_first; bp; bp = bp->b_vnbufs.le_next)
if (bp->b_flags & B_LOCKED) {
- ++a_released;
+ a_released += numfrags(fs, bp->b_bcount);
/*
* XXX
* When buffers are created in the cache, their block
@@ -343,25 +349,28 @@ lfs_truncate(v)
* here.
*/
if (bp->b_blkno == bp->b_lblkno)
- ++i_released;
+ i_released += numfrags(fs, bp->b_bcount);
}
- blocksreleased = fsbtodb(fs, i_released);
+ fragsreleased = i_released;
#ifdef DIAGNOSTIC
- if (blocksreleased > ip->i_blocks) {
+ if (fragsreleased > dbtofrags(fs, ip->i_blocks)) {
printf("lfs_inode: Warning! %s\n",
- "more blocks released from inode than are in inode");
- blocksreleased = ip->i_blocks;
+ "more frags released from inode than are in inode");
+ fragsreleased = dbtofrags(fs, ip->i_blocks);
+ panic("lfs_inode: Warning. More frags released\n");
}
#endif
- fs->lfs_bfree += blocksreleased;
- ip->i_blocks -= blocksreleased;
+ fs->lfs_bfree += fragstodb(fs, fragsreleased);
+ ip->i_blocks -= fragstodb(fs, fragsreleased);
#ifdef DIAGNOSTIC
- if (length == 0 && ip->i_blocks != 0)
+ if (length == 0 && ip->i_blocks != 0) {
printf("lfs_inode: Warning! %s%d%s\n",
"Truncation to zero, but ", ip->i_blocks,
" blocks left on inode");
+ panic("lfs_inode");
+ }
#endif
- fs->lfs_avail += fsbtodb(fs, a_released);
+ fs->lfs_avail += fragstodb(fs, a_released);
e1 = vinvalbuf(vp, (length > 0) ? V_SAVE : 0, ap->a_cred, ap->a_p,
0, 0);
e2 = VOP_UPDATE(vp, &ts, &ts, 0);
diff --git a/sys/ufs/lfs/lfs_segment.c b/sys/ufs/lfs/lfs_segment.c
index f54a6e8cb01..c163df7e804 100644
--- a/sys/ufs/lfs/lfs_segment.c
+++ b/sys/ufs/lfs/lfs_segment.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lfs_segment.c,v 1.3 1996/06/14 04:39:14 tholo Exp $ */
+/* $OpenBSD: lfs_segment.c,v 1.4 1996/07/01 07:41:52 downsj Exp $ */
/* $NetBSD: lfs_segment.c,v 1.4 1996/02/09 22:28:54 christos Exp $ */
/*
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)lfs_segment.c 8.5 (Berkeley) 1/4/94
+ * @(#)lfs_segment.c 8.10 (Berkeley) 6/10/95
*/
#include <sys/param.h>
@@ -77,13 +77,13 @@ void lfs_callback __P((struct buf *));
void lfs_gather __P((struct lfs *, struct segment *,
struct vnode *, int (*) __P((struct lfs *, struct buf *))));
int lfs_gatherblock __P((struct segment *, struct buf *, int *));
-void lfs_iset __P((struct inode *, daddr_t, time_t));
+void lfs_iset __P((struct inode *, ufs_daddr_t, time_t));
int lfs_match_data __P((struct lfs *, struct buf *));
int lfs_match_dindir __P((struct lfs *, struct buf *));
int lfs_match_indir __P((struct lfs *, struct buf *));
int lfs_match_tindir __P((struct lfs *, struct buf *));
void lfs_newseg __P((struct lfs *));
-void lfs_shellsort __P((struct buf **, daddr_t *, register int));
+void lfs_shellsort __P((struct buf **, ufs_daddr_t *, register int));
void lfs_supercallback __P((struct buf *));
void lfs_updatemeta __P((struct segment *));
int lfs_vref __P((struct vnode *));
@@ -161,10 +161,23 @@ lfs_writevnodes(fs, mp, sp, op)
struct inode *ip;
struct vnode *vp;
+/* BEGIN HACK */
+#define VN_OFFSET (((void *)&vp->v_mntvnodes.le_next) - (void *)vp)
+#define BACK_VP(VP) ((struct vnode *)(((void *)VP->v_mntvnodes.le_prev) - VN_OFFSET))
+#define BEG_OF_VLIST ((struct vnode *)(((void *)&mp->mnt_vnodelist.lh_first) - VN_OFFSET))
+
+/* Find last vnode. */
+loop: for (vp = mp->mnt_vnodelist.lh_first;
+ vp && vp->v_mntvnodes.le_next != NULL;
+ vp = vp->v_mntvnodes.le_next);
+ for (; vp && vp != BEG_OF_VLIST; vp = BACK_VP(vp)) {
+/* END HACK */
+/*
loop:
for (vp = mp->mnt_vnodelist.lh_first;
vp != NULL;
vp = vp->v_mntvnodes.le_next) {
+*/
/*
* If the vnode that we are about to sync is no longer
* associated with this mount point, start over.
@@ -210,13 +223,14 @@ lfs_segwrite(mp, flags)
struct mount *mp;
int flags; /* Do a checkpoint. */
{
+ struct proc *p = curproc; /* XXX */
struct buf *bp;
struct inode *ip;
struct lfs *fs;
struct segment *sp;
struct vnode *vp;
SEGUSE *segusep;
- daddr_t ibno;
+ ufs_daddr_t ibno;
CLEANERINFO *cip;
int clean, do_ckp, error, i;
@@ -230,15 +244,16 @@ lfs_segwrite(mp, flags)
LFS_CLEANERINFO(cip, fs, bp);
clean = cip->clean;
brelse(bp);
- if (clean <= 2) {
- printf ("segs clean: %d\n", clean);
+ if (clean <= 2 || fs->lfs_avail <= 0) {
+ /* printf ("segs clean: %d\n", clean); */
wakeup(&lfs_allclean_wakeup);
+ wakeup(&fs->lfs_nextseg);
error = tsleep(&fs->lfs_avail, PRIBIO + 1,
"lfs writer", 0);
if (error)
return (error);
}
- } while (clean <= 2 );
+ } while (clean <= 2 || fs->lfs_avail <= 0);
/*
* Allocate a segment structure and enough space to hold pointers to
@@ -335,7 +350,7 @@ lfs_writefile(fs, sp, vp)
sp->sum_bytes_left < sizeof(struct finfo))
(void) lfs_writeseg(fs, sp);
- sp->sum_bytes_left -= sizeof(struct finfo) - sizeof(daddr_t);
+ sp->sum_bytes_left -= sizeof(struct finfo) - sizeof(ufs_daddr_t);
++((SEGSUM *)(sp->segsum))->ss_nfinfo;
fip = sp->fip;
@@ -361,10 +376,10 @@ lfs_writefile(fs, sp, vp)
if (fip->fi_nblocks != 0) {
sp->fip =
(struct finfo *)((caddr_t)fip + sizeof(struct finfo) +
- sizeof(daddr_t) * (fip->fi_nblocks - 1));
+ sizeof(ufs_daddr_t) * (fip->fi_nblocks - 1));
sp->start_lbp = &sp->fip->fi_blocks[0];
} else {
- sp->sum_bytes_left += sizeof(struct finfo) - sizeof(daddr_t);
+ sp->sum_bytes_left += sizeof(struct finfo) - sizeof(ufs_daddr_t);
--((SEGSUM *)(sp->segsum))->ss_nfinfo;
}
}
@@ -378,7 +393,7 @@ lfs_writeinode(fs, sp, ip)
struct buf *bp, *ibp;
IFILE *ifp;
SEGUSE *sup;
- daddr_t daddr;
+ ufs_daddr_t daddr;
ino_t ino;
int error, i, ndx;
int redo_ifile = 0;
@@ -390,7 +405,7 @@ lfs_writeinode(fs, sp, ip)
if (sp->ibp == NULL) {
/* Allocate a new segment if necessary. */
if (sp->seg_bytes_left < fs->lfs_bsize ||
- sp->sum_bytes_left < sizeof(daddr_t))
+ sp->sum_bytes_left < sizeof(ufs_daddr_t))
(void) lfs_writeseg(fs, sp);
/* Get next inode block. */
@@ -406,10 +421,10 @@ lfs_writeinode(fs, sp, ip)
fs->lfs_avail -= fsbtodb(fs, 1);
/* Set remaining space counters. */
sp->seg_bytes_left -= fs->lfs_bsize;
- sp->sum_bytes_left -= sizeof(daddr_t);
- ndx = LFS_SUMMARY_SIZE / sizeof(daddr_t) -
+ sp->sum_bytes_left -= sizeof(ufs_daddr_t);
+ ndx = LFS_SUMMARY_SIZE / sizeof(ufs_daddr_t) -
sp->ninodes / INOPB(fs) - 1;
- ((daddr_t *)(sp->segsum))[ndx] = daddr;
+ ((ufs_daddr_t *)(sp->segsum))[ndx] = daddr;
}
/* Update the inode times and copy the inode onto the inode page. */
@@ -482,8 +497,8 @@ lfs_gatherblock(sp, bp, sptr)
panic ("lfs_gatherblock: Null vp in segment");
#endif
fs = sp->fs;
- if (sp->sum_bytes_left < sizeof(daddr_t) ||
- sp->seg_bytes_left < fs->lfs_bsize) {
+ if (sp->sum_bytes_left < sizeof(ufs_daddr_t) ||
+ sp->seg_bytes_left < bp->b_bcount) {
if (sptr)
splx(*sptr);
lfs_updatemeta(sp);
@@ -496,7 +511,7 @@ lfs_gatherblock(sp, bp, sptr)
/* Add the current file to the segment summary. */
++((SEGSUM *)(sp->segsum))->ss_nfinfo;
sp->sum_bytes_left -=
- sizeof(struct finfo) - sizeof(daddr_t);
+ sizeof(struct finfo) - sizeof(ufs_daddr_t);
if (sptr)
*sptr = splbio();
@@ -508,8 +523,8 @@ lfs_gatherblock(sp, bp, sptr)
*sp->cbpp++ = bp;
sp->fip->fi_blocks[sp->fip->fi_nblocks++] = bp->b_lblkno;
- sp->sum_bytes_left -= sizeof(daddr_t);
- sp->seg_bytes_left -= fs->lfs_bsize;
+ sp->sum_bytes_left -= sizeof(ufs_daddr_t);
+ sp->seg_bytes_left -= bp->b_bcount;
return(0);
}
@@ -525,7 +540,19 @@ lfs_gather(fs, sp, vp, match)
sp->vp = vp;
s = splbio();
-loop: for (bp = vp->v_dirtyblkhd.lh_first; bp; bp = bp->b_vnbufs.le_next) {
+/* This is a hack to see if ordering the blocks in LFS makes a difference. */
+/* BEGIN HACK */
+#define BUF_OFFSET (((void *)&bp->b_vnbufs.le_next) - (void *)bp)
+#define BACK_BUF(BP) ((struct buf *)(((void *)BP->b_vnbufs.le_prev) - BUF_OFFSET))
+#define BEG_OF_LIST ((struct buf *)(((void *)&vp->v_dirtyblkhd.lh_first) - BUF_OFFSET))
+
+
+/*loop: for (bp = vp->v_dirtyblkhd.lh_first; bp; bp = bp->b_vnbufs.le_next) {*/
+/* Find last buffer. */
+loop: for (bp = vp->v_dirtyblkhd.lh_first; bp && bp->b_vnbufs.le_next != NULL;
+ bp = bp->b_vnbufs.le_next);
+ for (; bp && bp != BEG_OF_LIST; bp = BACK_BUF(bp)) {
+/* END HACK */
if (bp->b_flags & B_BUSY || !match(fs, bp) ||
bp->b_flags & B_GATHERED)
continue;
@@ -558,11 +585,13 @@ lfs_updatemeta(sp)
struct vnode *vp;
struct indir a[NIADDR + 2], *ap;
struct inode *ip;
- daddr_t daddr, lbn, off;
- int db_per_fsb, error, i, nblocks, num;
+ ufs_daddr_t daddr, lbn, off;
+ int error, i, nblocks, num;
vp = sp->vp;
nblocks = &sp->fip->fi_blocks[sp->fip->fi_nblocks] - sp->start_lbp;
+ if (nblocks < 0)
+ panic("This is a bad thing\n");
if (vp == NULL || nblocks == 0)
return;
@@ -571,15 +600,23 @@ lfs_updatemeta(sp)
lfs_shellsort(sp->start_bpp, sp->start_lbp, nblocks);
/*
+ * Record the length of the last block in case it's a fragment.
+ * If there are indirect blocks present, they sort last. An
+ * indirect block will be lfs_bsize and its presence indicates
+ * that you cannot have fragments.
+ */
+ sp->fip->fi_lastlength = sp->start_bpp[nblocks - 1]->b_bcount;
+
+ /*
* Assign disk addresses, and update references to the logical
* block and the segment usage information.
*/
fs = sp->fs;
- db_per_fsb = fsbtodb(fs, 1);
for (i = nblocks; i--; ++sp->start_bpp) {
lbn = *sp->start_lbp++;
(*sp->start_bpp)->b_blkno = off = fs->lfs_offset;
- fs->lfs_offset += db_per_fsb;
+ fs->lfs_offset +=
+ fragstodb(fs, numfrags(fs, (*sp->start_bpp)->b_bcount));
error = ufs_bmaparray(vp, lbn, &daddr, a, &num, NULL);
if (error)
@@ -602,11 +639,10 @@ lfs_updatemeta(sp)
* to get counted for the inode.
*/
if (bp->b_blkno == -1 && !(bp->b_flags & B_CACHE)) {
-printf ("Updatemeta allocating indirect block: shouldn't happen\n");
- ip->i_blocks += btodb(fs->lfs_bsize);
- fs->lfs_bfree -= btodb(fs->lfs_bsize);
+ ip->i_blocks += fsbtodb(fs, 1);
+ fs->lfs_bfree -= fragstodb(fs, fs->lfs_frag);
}
- ((daddr_t *)bp->b_data)[ap->in_off] = off;
+ ((ufs_daddr_t *)bp->b_data)[ap->in_off] = off;
VOP_BWRITE(bp);
}
@@ -615,14 +651,16 @@ printf ("Updatemeta allocating indirect block: shouldn't happen\n");
!(daddr >= fs->lfs_lastpseg && daddr <= off)) {
LFS_SEGENTRY(sup, fs, datosn(fs, daddr), bp);
#ifdef DIAGNOSTIC
- if (sup->su_nbytes < fs->lfs_bsize) {
+ if (sup->su_nbytes < (*sp->start_bpp)->b_bcount) {
/* XXX -- Change to a panic. */
printf("lfs: negative bytes (segment %d)\n",
datosn(fs, daddr));
+ printf("lfs: bp = 0x%x, addr = 0x%x\n",
+ bp, bp->b_un.b_addr);
panic ("Negative Bytes");
}
#endif
- sup->su_nbytes -= fs->lfs_bsize;
+ sup->su_nbytes -= (*sp->start_bpp)->b_bcount;
error = VOP_BWRITE(bp);
}
}
@@ -648,6 +686,7 @@ lfs_initseg(fs)
if (!LFS_PARTIAL_FITS(fs)) {
/* Wake up any cleaning procs waiting on this file system. */
wakeup(&lfs_allclean_wakeup);
+ wakeup(&fs->lfs_nextseg);
lfs_newseg(fs);
repeat = 1;
@@ -689,11 +728,13 @@ lfs_initseg(fs)
ssp = sp->segsum;
ssp->ss_next = fs->lfs_nextseg;
ssp->ss_nfinfo = ssp->ss_ninos = 0;
+ ssp->ss_magic = SS_MAGIC;
/* Set pointer to first FINFO, initialize it. */
sp->fip = (struct finfo *)((caddr_t)sp->segsum + sizeof(SEGSUM));
sp->fip->fi_nblocks = 0;
sp->start_lbp = &sp->fip->fi_blocks[0];
+ sp->fip->fi_lastlength = 0;
sp->seg_bytes_left -= LFS_SUMMARY_SIZE;
sp->sum_bytes_left = LFS_SUMMARY_SIZE - sizeof(SEGSUM);
@@ -755,9 +796,8 @@ lfs_writeseg(fs, sp)
SEGUSE *sup;
SEGSUM *ssp;
dev_t i_dev;
- size_t size;
u_long *datap, *dp;
- int ch_per_blk, do_again, i, nblocks, num, s;
+ int do_again, i, nblocks, s;
int (*strategy)__P((void *));
struct vop_strategy_args vop_strategy_a;
u_short ninos;
@@ -771,12 +811,16 @@ lfs_writeseg(fs, sp)
if ((nblocks = sp->cbpp - sp->bpp) == 1)
return (0);
- ssp = (SEGSUM *)sp->segsum;
-
/* Update the segment usage information. */
LFS_SEGENTRY(sup, fs, sp->seg_number, bp);
+
+ /* Loop through all blocks, except the segment summary. */
+ for (bpp = sp->bpp; ++bpp < sp->cbpp; )
+ sup->su_nbytes += (*bpp)->b_bcount;
+
+ ssp = (SEGSUM *)sp->segsum;
+
ninos = (ssp->ss_ninos + INOPB(fs) - 1) / INOPB(fs);
- sup->su_nbytes += (nblocks - 1 - ninos) << fs->lfs_bshift;
sup->su_nbytes += ssp->ss_ninos * sizeof(struct dinode);
sup->su_nbytes += LFS_SUMMARY_SIZE;
sup->su_lastmod = time.tv_sec;
@@ -829,23 +873,21 @@ lfs_writeseg(fs, sp)
* easily make the buffers contiguous in kernel memory and if that's
* fast enough.
*/
- ch_per_blk = MAXPHYS / fs->lfs_bsize;
for (bpp = sp->bpp, i = nblocks; i;) {
- num = ch_per_blk;
- if (num > i)
- num = i;
- i -= num;
- size = num * fs->lfs_bsize;
-
cbp = lfs_newbuf(VTOI(fs->lfs_ivnode)->i_devvp,
- (*bpp)->b_blkno, size);
+ (*bpp)->b_blkno, MAXPHYS);
cbp->b_dev = i_dev;
cbp->b_flags |= B_ASYNC | B_BUSY;
+ cbp->b_bcount = 0;
s = splbio();
++fs->lfs_iocount;
- for (p = cbp->b_data; num--;) {
- bp = *bpp++;
+ for (p = cbp->b_data; i && cbp->b_bcount < MAXPHYS; i--) {
+ bp = *bpp;
+ if (bp->b_bcount > (MAXPHYS - cbp->b_bcount))
+ break;
+ bpp++;
+
/*
* Fake buffers from the cleaner are marked as B_INVAL.
* We need to copy the data from user space rather than
@@ -858,6 +900,7 @@ lfs_writeseg(fs, sp)
} else
bcopy(bp->b_data, p, bp->b_bcount);
p += bp->b_bcount;
+ cbp->b_bcount += bp->b_bcount;
if (bp->b_flags & B_LOCKED)
--locked_queue_count;
if (bp->b_flags & B_DELWRI)
@@ -879,7 +922,6 @@ lfs_writeseg(fs, sp)
}
++cbp->b_vp->v_numoutput;
splx(s);
- cbp->b_bcount = p - (char *)cbp->b_data;
/*
* XXXX This is a gross and disgusting hack. Since these
* buffers are physically addressed, they hang off the
@@ -1001,7 +1043,7 @@ lfs_match_tindir(fs, bp)
struct buf *
lfs_newbuf(vp, daddr, size)
struct vnode *vp;
- daddr_t daddr;
+ ufs_daddr_t daddr;
size_t size;
{
struct buf *bp;
@@ -1068,7 +1110,7 @@ lfs_supercallback(bp)
void
lfs_shellsort(bp_array, lb_array, nmemb)
struct buf **bp_array;
- daddr_t *lb_array;
+ ufs_daddr_t *lb_array;
register int nmemb;
{
static int __rsshell_increments[] = { 4, 1, 0 };
@@ -1099,7 +1141,7 @@ lfs_vref(vp)
register struct vnode *vp;
{
- if (vp->v_flag & VXLOCK)
+ if (vp->v_flag & VXLOCK) /* XXX */
return(1);
return (vget(vp, 0));
}
diff --git a/sys/ufs/lfs/lfs_subr.c b/sys/ufs/lfs/lfs_subr.c
index 613ea339eaf..4ca1a3b7ef2 100644
--- a/sys/ufs/lfs/lfs_subr.c
+++ b/sys/ufs/lfs/lfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lfs_subr.c,v 1.2 1996/02/27 07:13:27 niklas Exp $ */
+/* $OpenBSD: lfs_subr.c,v 1.3 1996/07/01 07:41:53 downsj Exp $ */
/* $NetBSD: lfs_subr.c,v 1.3 1996/02/09 22:28:55 christos Exp $ */
/*
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)lfs_subr.c 8.2 (Berkeley) 9/21/93
+ * @(#)lfs_subr.c 8.4 (Berkeley) 5/8/95
*/
#include <sys/param.h>
@@ -68,13 +68,13 @@ lfs_blkatoff(v)
register struct lfs *fs;
struct inode *ip;
struct buf *bp;
- daddr_t lbn;
+ ufs_daddr_t lbn;
int bsize, error;
ip = VTOI(ap->a_vp);
fs = ip->i_lfs;
lbn = lblkno(fs, ap->a_offset);
- bsize = blksize(fs);
+ bsize = blksize(fs, ip, lbn);
*ap->a_bpp = NULL;
if ((error = bread(ap->a_vp, lbn, bsize, NOCRED, &bp)) != 0) {
@@ -114,7 +114,8 @@ lfs_seglock(fs, flags)
sp = fs->lfs_sp = malloc(sizeof(struct segment), M_SEGMENT, M_WAITOK);
sp->bpp = malloc(((LFS_SUMMARY_SIZE - sizeof(SEGSUM)) /
- sizeof(daddr_t) + 1) * sizeof(struct buf *), M_SEGMENT, M_WAITOK);
+ sizeof(ufs_daddr_t) + 1) * sizeof(struct buf *),
+ M_SEGMENT, M_WAITOK);
sp->seg_flags = flags;
sp->vp = NULL;
(void) lfs_initseg(fs);
diff --git a/sys/ufs/lfs/lfs_syscalls.c b/sys/ufs/lfs/lfs_syscalls.c
index 2ffb3b70cbc..a9b7633c1a6 100644
--- a/sys/ufs/lfs/lfs_syscalls.c
+++ b/sys/ufs/lfs/lfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lfs_syscalls.c,v 1.2 1996/02/27 07:13:28 niklas Exp $ */
+/* $OpenBSD: lfs_syscalls.c,v 1.3 1996/07/01 07:41:54 downsj Exp $ */
/* $NetBSD: lfs_syscalls.c,v 1.10 1996/02/09 22:28:56 christos Exp $ */
/*-
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)lfs_syscalls.c 8.6 (Berkeley) 6/16/94
+ * @(#)lfs_syscalls.c 8.10 (Berkeley) 5/14/95
*/
#include <sys/param.h>
@@ -71,6 +71,10 @@ if (sp->sum_bytes_left < (s)) { \
}
struct buf *lfs_fakebuf __P((struct vnode *, int, size_t, caddr_t));
+int debug_cleaner = 0;
+int clean_vnlocked = 0;
+int clean_inlocked = 0;
+
/*
* lfs_markv:
*
@@ -99,14 +103,14 @@ lfs_markv(p, v, retval)
BLOCK_INFO *blkp;
IFILE *ifp;
struct buf *bp, **bpp;
- struct inode *ip = NULL;
+ struct inode *ip;
struct lfs *fs;
struct mount *mntp;
struct vnode *vp;
fsid_t fsid;
void *start;
ino_t lastino;
- daddr_t b_daddr, v_daddr;
+ ufs_daddr_t b_daddr, v_daddr;
u_long bsize;
int cnt, error;
@@ -143,7 +147,7 @@ lfs_markv(p, v, retval)
if (sp->fip->fi_nblocks == 0) {
DEC_FINFO(sp);
sp->sum_bytes_left +=
- sizeof(FINFO) - sizeof(daddr_t);
+ sizeof(FINFO) - sizeof(ufs_daddr_t);
} else {
lfs_updatemeta(sp);
BUMP_FIP(sp);
@@ -155,7 +159,7 @@ lfs_markv(p, v, retval)
/* Start a new file */
CHECK_SEG(sizeof(FINFO));
- sp->sum_bytes_left -= sizeof(FINFO) - sizeof(daddr_t);
+ sp->sum_bytes_left -= sizeof(FINFO) - sizeof(ufs_daddr_t);
INC_FINFO(sp);
sp->start_lbp = &sp->fip->fi_blocks[0];
sp->vp = NULL;
@@ -180,6 +184,7 @@ lfs_markv(p, v, retval)
#ifdef DIAGNOSTIC
printf("lfs_markv: VFS_VGET failed (%d)\n",
blkp->bi_inode);
+ panic("lfs_markv VFS_VGET FAILED");
#endif
lastino = LFS_UNUSED_INUM;
v_daddr = LFS_UNUSED_DADDR;
@@ -221,7 +226,7 @@ lfs_markv(p, v, retval)
if (sp->fip->fi_nblocks == 0) {
DEC_FINFO(sp);
sp->sum_bytes_left +=
- sizeof(FINFO) - sizeof(daddr_t);
+ sizeof(FINFO) - sizeof(ufs_daddr_t);
} else
lfs_updatemeta(sp);
@@ -275,10 +280,11 @@ lfs_bmapv(p, v, retval)
} */ *uap = v;
BLOCK_INFO *blkp;
struct mount *mntp;
+ struct ufsmount *ump;
struct vnode *vp;
fsid_t fsid;
void *start;
- daddr_t daddr;
+ ufs_daddr_t daddr;
int cnt, error, step;
if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
@@ -301,10 +307,18 @@ lfs_bmapv(p, v, retval)
for (step = cnt; step--; ++blkp) {
if (blkp->bi_lbn == LFS_UNUSED_LBN)
continue;
- /* Could be a deadlock ? */
- if (VFS_VGET(mntp, blkp->bi_inode, &vp))
+ /*
+ * A regular call to VFS_VGET could deadlock
+ * here. Instead, we try an unlocked access.
+ */
+ ump = VFSTOUFS(mntp);
+ if ((vp =
+ ufs_ihashlookup(ump->um_dev, blkp->bi_inode)) != NULL) {
+ if (VOP_BMAP(vp, blkp->bi_lbn, NULL, &daddr, NULL))
+ daddr = LFS_UNUSED_DADDR;
+ } else if (VFS_VGET(mntp, blkp->bi_inode, &vp))
daddr = LFS_UNUSED_DADDR;
- else {
+ else {
if (VOP_BMAP(vp, blkp->bi_lbn, NULL, &daddr, NULL))
daddr = LFS_UNUSED_DADDR;
vput(vp);
@@ -452,7 +466,7 @@ int
lfs_fastvget(mp, ino, daddr, vpp, dinp)
struct mount *mp;
ino_t ino;
- daddr_t daddr;
+ ufs_daddr_t daddr;
struct vnode **vpp;
struct dinode *dinp;
{
@@ -473,14 +487,12 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp)
if ((*vpp = ufs_ihashlookup(dev, ino)) != NULL) {
lfs_vref(*vpp);
if ((*vpp)->v_flag & VXLOCK)
- printf ("Cleaned vnode VXLOCKED\n");
+ clean_vnlocked++;
ip = VTOI(*vpp);
if (ip->i_flag & IN_LOCKED)
- printf("cleaned vnode locked\n");
- if (!(ip->i_flag & IN_MODIFIED)) {
+ clean_inlocked++;
+ if (!(ip->i_flag & IN_MODIFIED))
++ump->um_lfs->lfs_uinodes;
- ip->i_flag |= IN_MODIFIED;
- }
ip->i_flag |= IN_MODIFIED;
return (0);
}
@@ -536,9 +548,6 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp)
brelse(bp);
}
- /* Inode was just read from user space or disk, make sure it's locked */
- ip->i_flag |= IN_LOCKED;
-
/*
* Initialize the vnode from the inode, check for aliases. In all
* cases re-init ip, the underlying vnode/inode may have changed.
diff --git a/sys/ufs/lfs/lfs_vfsops.c b/sys/ufs/lfs/lfs_vfsops.c
index ac8ee6d327f..6023f14073e 100644
--- a/sys/ufs/lfs/lfs_vfsops.c
+++ b/sys/ufs/lfs/lfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lfs_vfsops.c,v 1.5 1996/06/27 06:42:07 downsj Exp $ */
+/* $OpenBSD: lfs_vfsops.c,v 1.6 1996/07/01 07:41:55 downsj Exp $ */
/* $NetBSD: lfs_vfsops.c,v 1.11 1996/03/25 12:53:35 pk Exp $ */
/*
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)lfs_vfsops.c 8.10 (Berkeley) 11/21/94
+ * @(#)lfs_vfsops.c 8.20 (Berkeley) 6/10/95
*/
#include <sys/param.h>
@@ -425,11 +425,17 @@ lfs_statfs(mp, sbp, p)
sbp->f_type = 0;
sbp->f_bsize = fs->lfs_bsize;
sbp->f_iosize = fs->lfs_bsize;
- sbp->f_blocks = dbtofsb(fs,fs->lfs_dsize);
- sbp->f_bfree = dbtofsb(fs, fs->lfs_bfree);
- sbp->f_bavail = (fs->lfs_dsize * (100 - fs->lfs_minfree) / 100) -
- (fs->lfs_dsize - fs->lfs_bfree);
- sbp->f_bavail = dbtofsb(fs, sbp->f_bavail);
+ sbp->f_blocks = dbtofrags(fs,fs->lfs_dsize);
+ sbp->f_bfree = dbtofrags(fs, fs->lfs_bfree);
+ /*
+ * To compute the available space. Subtract the minimum free
+ * from the total number of blocks in the file system. Set avail
+ * to the smaller of this number and fs->lfs_bfree.
+ */
+ sbp->f_bavail = fs->lfs_dsize * (100 - fs->lfs_minfree) / 100;
+ sbp->f_bavail =
+ sbp->f_bavail > fs->lfs_bfree ? fs->lfs_bfree : sbp->f_bavail;
+ sbp->f_bavail = dbtofrags(fs, sbp->f_bavail);
sbp->f_files = fs->lfs_nfiles;
sbp->f_ffree = sbp->f_bfree * INOPB(fs);
if (sbp != &mp->mnt_stat) {
@@ -481,7 +487,7 @@ lfs_vget(mp, ino, vpp)
struct ifile *ifp;
struct vnode *vp;
struct ufsmount *ump;
- daddr_t daddr;
+ ufs_daddr_t daddr;
dev_t dev;
int error;
@@ -612,3 +618,12 @@ lfs_vptofh(vp, fhp)
ufhp->ufid_gen = ip->i_gen;
return (0);
}
+
+/*
+ * Initialize the filesystem, most work done by ufs_init.
+ */
+void
+lfs_init()
+{
+ ufs_init();
+}
diff --git a/sys/ufs/lfs/lfs_vnops.c b/sys/ufs/lfs/lfs_vnops.c
index f0b80c6edc7..76bc7608ed1 100644
--- a/sys/ufs/lfs/lfs_vnops.c
+++ b/sys/ufs/lfs/lfs_vnops.c
@@ -1,8 +1,8 @@
-/* $OpenBSD: lfs_vnops.c,v 1.3 1996/05/22 11:47:20 deraadt Exp $ */
+/* $OpenBSD: lfs_vnops.c,v 1.4 1996/07/01 07:41:56 downsj Exp $ */
/* $NetBSD: lfs_vnops.c,v 1.11 1996/05/11 18:27:41 mycroft Exp $ */
/*
- * Copyright (c) 1986, 1989, 1991, 1993
+ * Copyright (c) 1986, 1989, 1991, 1993, 1995
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)lfs_vnops.c 8.8 (Berkeley) 8/10/94
+ * @(#)lfs_vnops.c 8.13 (Berkeley) 6/10/95
*/
#include <sys/param.h>