summaryrefslogtreecommitdiff
path: root/sys/gnu/ext2fs
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1996-07-14 06:46:08 +0000
committerJason Downs <downsj@cvs.openbsd.org>1996-07-14 06:46:08 +0000
commitd11009a5c2631a8d539374f60952d9841f6980f3 (patch)
treea3c40d2a30fef9342c5fe0f0277caab6c31696c5 /sys/gnu/ext2fs
parente56f2f477f14da31fab26dfeb4f8a71ff80ac907 (diff)
vnode_pager initializations, changes to vnode/inode initializations.
Diffstat (limited to 'sys/gnu/ext2fs')
-rw-r--r--sys/gnu/ext2fs/ext2_alloc.c4
-rw-r--r--sys/gnu/ext2fs/ext2_balloc.c3
-rw-r--r--sys/gnu/ext2fs/ext2_inode.c6
-rw-r--r--sys/gnu/ext2fs/ext2_vfsops.c31
4 files changed, 25 insertions, 19 deletions
diff --git a/sys/gnu/ext2fs/ext2_alloc.c b/sys/gnu/ext2fs/ext2_alloc.c
index 7b3f8cc9b66..a6c3e79598d 100644
--- a/sys/gnu/ext2fs/ext2_alloc.c
+++ b/sys/gnu/ext2fs/ext2_alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2_alloc.c,v 1.1 1996/06/24 03:34:53 downsj Exp $ */
+/* $OpenBSD: ext2_alloc.c,v 1.2 1996/07/14 06:46:06 downsj Exp $ */
/*
* modified for Lites 1.1
@@ -171,6 +171,8 @@ ext2_alloc(ip, lbn, bpref, size, cred, bnp)
#endif
if (bno > 0) {
+ (void) vnode_pager_uncache(ITOV(ip));
+
/* set next_alloc fields as done in block_getblk */
ip->i_next_alloc_block = lbn;
ip->i_next_alloc_goal = bno;
diff --git a/sys/gnu/ext2fs/ext2_balloc.c b/sys/gnu/ext2fs/ext2_balloc.c
index 86f3af5fc93..502804d794a 100644
--- a/sys/gnu/ext2fs/ext2_balloc.c
+++ b/sys/gnu/ext2fs/ext2_balloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2_balloc.c,v 1.1 1996/06/24 03:34:54 downsj Exp $ */
+/* $OpenBSD: ext2_balloc.c,v 1.2 1996/07/14 06:46:06 downsj Exp $ */
/*
* modified for Lites 1.1
@@ -155,6 +155,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
if (flags & B_CLRBUF)
clrbuf(bp);
}
+ vnode_pager_setsize(vp, (u_long)ip->i_size); /* XXX */
ip->i_db[bn] = dbtofsb(fs, bp->b_blkno);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
*bpp = bp;
diff --git a/sys/gnu/ext2fs/ext2_inode.c b/sys/gnu/ext2fs/ext2_inode.c
index 0e09434f5e1..e9c5b6199b2 100644
--- a/sys/gnu/ext2fs/ext2_inode.c
+++ b/sys/gnu/ext2fs/ext2_inode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2_inode.c,v 1.1 1996/06/24 03:34:55 downsj Exp $ */
+/* $OpenBSD: ext2_inode.c,v 1.2 1996/07/14 06:46:07 downsj Exp $ */
/*
* modified for Lites 1.1
@@ -182,7 +182,7 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, ap->a_length);
* are not meaningful anyways.
*/
if (length < 0)
- return EFBIG;
+ return (EINVAL);
oip = VTOI(ovp);
TIMEVAL_TO_TIMESPEC(&time, &ts);
@@ -205,6 +205,7 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, ap->a_length);
if (error = getinoquota(oip))
return (error);
#endif
+ vnode_pager_setsize(ovp, (u_long)length);
fs = oip->i_e2fs;
osize = oip->i_size;
ext2_discard_prealloc(oip);
@@ -390,7 +391,6 @@ done:
if (oip->i_blocks < 0) /* sanity */
oip->i_blocks = 0;
oip->i_flag |= IN_CHANGE;
- vnode_pager_setsize(ovp, length);
#if QUOTA
(void) chkdq(oip, -blocksreleased, NOCRED, 0);
#endif
diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c
index 6bb0357d38b..61151ffe57c 100644
--- a/sys/gnu/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/ext2fs/ext2_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2_vfsops.c,v 1.5 1996/07/14 04:15:04 downsj Exp $ */
+/* $OpenBSD: ext2_vfsops.c,v 1.6 1996/07/14 06:46:07 downsj Exp $ */
/*
* modified for EXT2FS support in Lites 1.1
@@ -891,7 +891,7 @@ ext2_vget(mp, ino, vpp)
struct buf *bp;
struct vnode *vp;
dev_t dev;
- int i, error;
+ int error;
int used_blocks;
ump = VFSTOUFS(mp);
@@ -928,9 +928,13 @@ restart:
ip->i_e2fs = fs = ump->um_e2fs;
ip->i_dev = dev;
ip->i_number = ino;
-#if QUOTA
- for (i = 0; i < MAXQUOTAS; i++)
- ip->i_dquot[i] = NODQUOT;
+#ifdef QUOTA
+ {
+ int i;
+
+ for (i = 0; i < MAXQUOTAS; i++)
+ ip->i_dquot[i] = NODQUOT;
+ }
#endif
/*
* Put it onto its hash chain and lock it so that other requests for
@@ -945,12 +949,9 @@ restart:
ext2fs_inode_hash_lock = 0;
/* Read in the disk contents for the inode, copy into the inode. */
- /* Read in the disk contents for the inode, copy into the inode. */
-#if 0
-printf("ext2_vget(%d) dbn= %d ", ino, fsbtodb(fs, ino_to_fsba(fs, ino)));
-#endif
- if (error = bread(ump->um_devvp, fsbtodb(fs, ino_to_fsba(fs, ino)),
- (int)fs->s_blocksize, NOCRED, &bp)) {
+ error = bread(ump->um_devvp, fsbtodb(fs, ino_to_fsba(fs, ino)),
+ (int)fs->s_blocksize, NOCRED, &bp);
+ if (error) {
/*
* The inode does not contain anything useful, so it would
* be misleading to leave it on its hash chain. With mode
@@ -966,17 +967,18 @@ printf("ext2_vget(%d) dbn= %d ", ino, fsbtodb(fs, ino_to_fsba(fs, ino)));
ext2_ei2di((struct ext2_inode *) ((char *)bp->b_data + EXT2_INODE_SIZE *
ino_to_fsbo(fs, ino)), &ip->i_din);
ip->i_block_group = ino_to_cg(fs, ino);
-#if 0
ip->i_next_alloc_block = 0;
ip->i_next_alloc_goal = 0;
ip->i_prealloc_count = 0;
ip->i_prealloc_block = 0;
-#endif
+
/* now we want to make sure that block pointers for unused
blocks are zeroed out - ext2_balloc depends on this
although for regular files and directories only
*/
if(S_ISDIR(ip->i_mode) || S_ISREG(ip->i_mode)) {
+ int i;
+
used_blocks = (ip->i_size+fs->s_blocksize-1) / fs->s_blocksize;
for(i = used_blocks; i < EXT2_NDIR_BLOCKS; i++)
ip->i_db[i] = 0;
@@ -990,7 +992,8 @@ printf("ext2_vget(%d) dbn= %d ", ino, fsbtodb(fs, ino_to_fsba(fs, ino)));
* Initialize the vnode from the inode, check for aliases.
* Note that the underlying vnode may have changed.
*/
- if (error = ufs_vinit(mp, ext2_specop_p, ext2_fifoop_p, &vp)) {
+ error = ufs_vinit(mp, ext2_specop_p, EXT2_FIFOOPS, &vp);
+ if (error) {
vput(vp);
*vpp = NULL;
return (error);