summaryrefslogtreecommitdiff
path: root/sys/ufs/ext2fs
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-12-19 08:58:08 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-12-19 08:58:08 +0000
commitd8afae924f4db99650aa0df115c6ae66ed02b950 (patch)
treea2cbc045f0eb624a394f8e45fea1a58ecf1faaf0 /sys/ufs/ext2fs
parent4a6c79ff4f05aaae32458104529a9a9e0d3d208b (diff)
UBC was a disaster. It worked very good when it worked, but on some
machines or some configurations or in some phase of the moon (we actually don't know when or why) files disappeared. Since we've not been able to track down the problem in two weeks intense debugging and we need -current to be stable, back out everything to a state it had before UBC. We apologise for the inconvenience.
Diffstat (limited to 'sys/ufs/ext2fs')
-rw-r--r--sys/ufs/ext2fs/ext2fs_balloc.c219
-rw-r--r--sys/ufs/ext2fs/ext2fs_extern.h7
-rw-r--r--sys/ufs/ext2fs/ext2fs_inode.c58
-rw-r--r--sys/ufs/ext2fs/ext2fs_readwrite.c103
-rw-r--r--sys/ufs/ext2fs/ext2fs_subr.c5
-rw-r--r--sys/ufs/ext2fs/ext2fs_vfsops.c21
-rw-r--r--sys/ufs/ext2fs/ext2fs_vnops.c17
7 files changed, 110 insertions, 320 deletions
diff --git a/sys/ufs/ext2fs/ext2fs_balloc.c b/sys/ufs/ext2fs/ext2fs_balloc.c
index 390f02dc13f..eb2d7a6f414 100644
--- a/sys/ufs/ext2fs/ext2fs_balloc.c
+++ b/sys/ufs/ext2fs/ext2fs_balloc.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ext2fs_balloc.c,v 1.8 2000/12/10 06:38:31 chs Exp $ */
+/* $OpenBSD: ext2fs_balloc.c,v 1.11 2001/12/19 08:58:07 art Exp $ */
+/* $NetBSD: ext2fs_balloc.c,v 1.10 2001/07/04 21:16:01 chs Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer.
@@ -43,9 +44,8 @@
#include <sys/proc.h>
#include <sys/file.h>
#include <sys/vnode.h>
-#include <sys/mount.h>
-#include <uvm/uvm.h>
+#include <uvm/uvm_extern.h>
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
@@ -73,13 +73,8 @@ ext2fs_buf_alloc(struct inode *ip, daddr_t bn, int size, struct ucred *cred,
u_int deallocated;
ufs_daddr_t *allocib, *blkp, *allocblk, allociblk[NIADDR + 1];
int unwindidx = -1;
- UVMHIST_FUNC("ext2fs_buf_alloc"); UVMHIST_CALLED(ubchist);
- UVMHIST_LOG(ubchist, "bn 0x%x", bn,0,0,0);
-
- if (bpp != NULL) {
- *bpp = NULL;
- }
+ *bpp = NULL;
if (bn < 0)
return (EFBIG);
fs = ip->i_e2fs;
@@ -91,29 +86,20 @@ ext2fs_buf_alloc(struct inode *ip, daddr_t bn, int size, struct ucred *cred,
if (bn < NDADDR) {
nb = fs2h32(ip->i_e2fs_blocks[bn]);
if (nb != 0) {
-
- /*
- * the block is already allocated, just read it.
- */
-
- if (bpp != NULL) {
- error = bread(vp, bn, fs->e2fs_bsize, NOCRED,
- &bp);
- if (error) {
- brelse(bp);
- return (error);
- }
- *bpp = bp;
+ error = bread(vp, bn, fs->e2fs_bsize, NOCRED, &bp);
+ if (error) {
+ brelse(bp);
+ return (error);
}
+ *bpp = bp;
return (0);
}
/*
* allocate a new direct block.
*/
-
error = ext2fs_alloc(ip, bn,
- ext2fs_blkpref(ip, bn, bn, &ip->i_e2fs_blocks[0]),
+ ext2fs_blkpref(ip, bn, (int)bn, &ip->i_e2fs_blocks[0]),
cred, &newb);
if (error)
return (error);
@@ -121,13 +107,11 @@ ext2fs_buf_alloc(struct inode *ip, daddr_t bn, int size, struct ucred *cred,
ip->i_e2fs_last_blk = newb;
ip->i_e2fs_blocks[bn] = h2fs32(newb);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
- if (bpp != NULL) {
- bp = getblk(vp, bn, fs->e2fs_bsize, 0, 0);
- bp->b_blkno = fsbtodb(fs, newb);
- if (flags & B_CLRBUF)
- clrbuf(bp);
- *bpp = bp;
- }
+ bp = getblk(vp, bn, fs->e2fs_bsize, 0, 0);
+ bp->b_blkno = fsbtodb(fs, newb);
+ if (flags & B_CLRBUF)
+ clrbuf(bp);
+ *bpp = bp;
return (0);
}
/*
@@ -245,30 +229,26 @@ ext2fs_buf_alloc(struct inode *ip, daddr_t bn, int size, struct ucred *cred,
} else {
bdwrite(bp);
}
- if (bpp != NULL) {
- nbp = getblk(vp, lbn, fs->e2fs_bsize, 0, 0);
- nbp->b_blkno = fsbtodb(fs, nb);
- if (flags & B_CLRBUF)
- clrbuf(nbp);
- *bpp = nbp;
- }
+ nbp = getblk(vp, lbn, fs->e2fs_bsize, 0, 0);
+ nbp->b_blkno = fsbtodb(fs, nb);
+ if (flags & B_CLRBUF)
+ clrbuf(nbp);
+ *bpp = nbp;
return (0);
}
brelse(bp);
- if (bpp != NULL) {
- if (flags & B_CLRBUF) {
- error = bread(vp, lbn, (int)fs->e2fs_bsize, NOCRED,
- &nbp);
- if (error) {
- brelse(nbp);
- goto fail;
- }
- } else {
- nbp = getblk(vp, lbn, fs->e2fs_bsize, 0, 0);
- nbp->b_blkno = fsbtodb(fs, nb);
+ if (flags & B_CLRBUF) {
+ error = bread(vp, lbn, (int)fs->e2fs_bsize, NOCRED, &nbp);
+ if (error) {
+ brelse(nbp);
+ goto fail;
}
- *bpp = nbp;
+ } else {
+ nbp = getblk(vp, lbn, fs->e2fs_bsize, 0, 0);
+ nbp->b_blkno = fsbtodb(fs, nb);
}
+
+ *bpp = nbp;
return (0);
fail:
/*
@@ -312,142 +292,3 @@ fail:
}
return error;
}
-
-int
-ext2fs_gop_alloc(struct vnode *vp, off_t off, off_t len, int flags,
- struct ucred *cred)
-{
- struct inode *ip = VTOI(vp);
- struct m_ext2fs *fs = ip->i_e2fs;
- int error, delta, bshift, bsize;
- UVMHIST_FUNC("ext2fs_gop_alloc"); UVMHIST_CALLED(ubchist);
-
- bshift = fs->e2fs_bshift;
- bsize = 1 << bshift;
-
- delta = off & (bsize - 1);
- off -= delta;
- len += delta;
-
- while (len > 0) {
- bsize = min(bsize, len);
- UVMHIST_LOG(ubchist, "off 0x%x len 0x%x bsize 0x%x",
- off, len, bsize, 0);
-
- error = ext2fs_buf_alloc(ip, lblkno(fs, off), bsize, cred,
- NULL, flags);
- if (error) {
- UVMHIST_LOG(ubchist, "error %d", error, 0,0,0);
- return error;
- }
-
- /*
- * increase file size now, VOP_BALLOC() requires that
- * EOF be up-to-date before each call.
- */
-
- if (ip->i_e2fs_size < off + bsize) {
- UVMHIST_LOG(ubchist, "old 0x%x new 0x%x",
- ip->i_e2fs_size, off + bsize,0,0);
- ip->i_e2fs_size = off + bsize;
- if (vp->v_size < ip->i_e2fs_size) {
- uvm_vnp_setsize(vp, ip->i_e2fs_size);
- }
- }
-
- off += bsize;
- len -= bsize;
- }
- return 0;
-}
-
-/*
- * allocate a range of blocks in a file.
- * after this function returns, any page entirely contained within the range
- * will map to invalid data and thus must be overwritten before it is made
- * accessible to others.
- */
-
-int
-ext2fs_balloc_range(vp, off, len, cred, flags)
- struct vnode *vp;
- off_t off, len;
- struct ucred *cred;
- int flags;
-{
- off_t oldeof, eof, pagestart;
- struct uvm_object *uobj;
- struct genfs_node *gp = VTOG(vp);
- int i, delta, error, npages;
- int bshift = vp->v_mount->mnt_fs_bshift;
- int bsize = 1 << bshift;
- int ppb = max(bsize >> PAGE_SHIFT, 1);
- struct vm_page *pgs[ppb];
- UVMHIST_FUNC("ext2fs_balloc_range"); UVMHIST_CALLED(ubchist);
- UVMHIST_LOG(ubchist, "vp %p off 0x%x len 0x%x u_size 0x%x",
- vp, off, len, vp->v_size);
-
- error = 0;
- uobj = &vp->v_uobj;
- oldeof = vp->v_size;
- eof = max(oldeof, off + len);
- UVMHIST_LOG(ubchist, "new eof 0x%x", eof,0,0,0);
- pgs[0] = NULL;
-
- /*
- * cache the new range of the file. this will create zeroed pages
- * where the new block will be and keep them locked until the
- * new block is allocated, so there will be no window where
- * the old contents of the new block is visible to racing threads.
- */
-
- pagestart = trunc_page(off) & ~(bsize - 1);
- npages = min(ppb, (round_page(eof) - pagestart) >> PAGE_SHIFT);
- memset(pgs, 0, npages);
- simple_lock(&uobj->vmobjlock);
- error = VOP_GETPAGES(vp, pagestart, pgs, &npages, 0,
- VM_PROT_READ, 0, PGO_SYNCIO | PGO_PASTEOF);
- if (error) {
- UVMHIST_LOG(ubchist, "getpages %d", error,0,0,0);
- goto errout;
- }
- for (i = 0; i < npages; i++) {
- UVMHIST_LOG(ubchist, "got pgs[%d] %p", i, pgs[i],0,0);
- KASSERT((pgs[i]->flags & PG_RELEASED) == 0);
- pgs[i]->flags &= ~PG_CLEAN;
- uvm_pageactivate(pgs[i]);
- }
-
- /*
- * adjust off to be block-aligned.
- */
-
- delta = off & (bsize - 1);
- off -= delta;
- len += delta;
-
- /*
- * now allocate the range.
- */
-
- lockmgr(&gp->g_glock, LK_EXCLUSIVE, NULL, curproc);
- error = GOP_ALLOC(vp, off, len, flags, cred);
- UVMHIST_LOG(ubchist, "alloc %d", error,0,0,0);
- lockmgr(&gp->g_glock, LK_RELEASE, NULL, curproc);
-
- /*
- * unbusy any pages we are holding.
- */
-
-errout:
- simple_lock(&uobj->vmobjlock);
- if (error) {
- (void) (uobj->pgops->pgo_flush)(uobj, oldeof, pagestart + ppb,
- PGO_FREE);
- }
- if (pgs[0] != NULL) {
- uvm_page_unbusy(pgs, npages);
- }
- simple_unlock(&uobj->vmobjlock);
- return (error);
-}
diff --git a/sys/ufs/ext2fs/ext2fs_extern.h b/sys/ufs/ext2fs/ext2fs_extern.h
index 5f5b2c3a47b..5063d34427a 100644
--- a/sys/ufs/ext2fs/ext2fs_extern.h
+++ b/sys/ufs/ext2fs/ext2fs_extern.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: ext2fs_extern.h,v 1.12 2001/12/10 04:45:31 art Exp $ */
-/* $NetBSD: ext2fs_extern.h,v 1.9 2000/11/27 08:39:53 chs Exp $ */
+/* $OpenBSD: ext2fs_extern.h,v 1.13 2001/12/19 08:58:07 art Exp $ */
+/* $NetBSD: ext2fs_extern.h,v 1.1 1997/06/11 09:33:55 bouyer Exp $ */
/*-
* Copyright (c) 1997 Manuel Bouyer.
@@ -74,9 +74,6 @@ int ext2fs_inode_free(struct inode *pip, ino_t ino, int mode);
/* ext2fs_balloc.c */
int ext2fs_buf_alloc(struct inode *, daddr_t, int, struct ucred *,
struct buf **, int);
-int ext2fs_gop_alloc __P((struct vnode *, off_t, off_t, int, struct ucred *));
-int ext2fs_balloc_range __P((struct vnode *, off_t, off_t, struct ucred *,
- int));
/* ext2fs_bmap.c */
int ext2fs_bmap __P((void *));
diff --git a/sys/ufs/ext2fs/ext2fs_inode.c b/sys/ufs/ext2fs/ext2fs_inode.c
index f77c99c47b5..0e2a975e333 100644
--- a/sys/ufs/ext2fs/ext2fs_inode.c
+++ b/sys/ufs/ext2fs/ext2fs_inode.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ext2fs_inode.c,v 1.23 2001/02/18 20:17:04 chs Exp $ */
+/* $OpenBSD: ext2fs_inode.c,v 1.19 2001/12/19 08:58:07 art Exp $ */
+/* $NetBSD: ext2fs_inode.c,v 1.24 2001/06/19 12:59:18 wiz Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer.
@@ -58,10 +59,8 @@
#include <ufs/ext2fs/ext2fs.h>
#include <ufs/ext2fs/ext2fs_extern.h>
-extern int prtactive;
-
static int ext2fs_indirtrunc __P((struct inode *, ufs_daddr_t, ufs_daddr_t,
- ufs_daddr_t, int, long *));
+ ufs_daddr_t, int, long *));
/*
* Last reference to an inode. If necessary, write or delete it.
@@ -79,6 +78,7 @@ ext2fs_inactive(v)
struct proc *p = ap->a_p;
struct timespec ts;
int error = 0;
+ extern int prtactive;
if (prtactive && vp->v_usecount != 0)
vprint("ext2fs_inactive: pushing active", vp);
@@ -171,13 +171,14 @@ ext2fs_truncate(struct inode *oip, off_t length, int flags, struct ucred *cred)
{
struct vnode *ovp = ITOV(oip);
ufs_daddr_t lastblock;
- ufs_daddr_t bn, lastiblock[NIADDR], indir_lbn[NIADDR];
+ ufs_daddr_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR];
ufs_daddr_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR];
struct m_ext2fs *fs;
+ struct buf *bp;
int offset, size, level;
long count, nblocks, vflags, blocksreleased = 0;
int i;
- int error, allerror;
+ int aflags, error, allerror;
off_t osize;
if (length < 0)
@@ -218,8 +219,22 @@ ext2fs_truncate(struct inode *oip, off_t length, int flags, struct ucred *cred)
if (length > fs->fs_maxfilesize)
return (EFBIG);
#endif
- ext2fs_balloc_range(ovp, length - 1, 1, cred,
- flags & IO_SYNC ? B_SYNC : 0);
+ offset = blkoff(fs, length - 1);
+ lbn = lblkno(fs, length - 1);
+ aflags = B_CLRBUF;
+ if (flags & IO_SYNC)
+ aflags |= B_SYNC;
+ error = ext2fs_buf_alloc(oip, lbn, offset + 1, cred, &bp,
+ aflags);
+ if (error)
+ return (error);
+ oip->i_e2fs_size = length;
+ uvm_vnp_setsize(ovp, length);
+ uvm_vnp_uncache(ovp);
+ if (aflags & B_SYNC)
+ bwrite(bp);
+ else
+ bawrite(bp);
oip->i_flag |= IN_CHANGE | IN_UPDATE;
return (ext2fs_update(oip, NULL, NULL, 1));
}
@@ -231,15 +246,28 @@ ext2fs_truncate(struct inode *oip, off_t length, int flags, struct ucred *cred)
* of subsequent file growth.
*/
offset = blkoff(fs, length);
- if (offset != 0) {
+ if (offset == 0) {
+ oip->i_e2fs_size = length;
+ } else {
+ lbn = lblkno(fs, length);
+ aflags = B_CLRBUF;
+ if (flags & IO_SYNC)
+ aflags |= B_SYNC;
+ error = ext2fs_buf_alloc(oip, lbn, offset, cred, &bp,
+ aflags);
+ if (error)
+ return (error);
+ oip->i_e2fs_size = length;
size = fs->e2fs_bsize;
-
- /* XXXUBC we should handle more than just VREG */
- uvm_vnp_zerorange(ovp, length, size - offset);
+ uvm_vnp_setsize(ovp, length);
+ uvm_vnp_uncache(ovp);
+ bzero((char *)bp->b_data + offset, (u_int)(size - offset));
+ allocbuf(bp, size);
+ if (aflags & B_SYNC)
+ bwrite(bp);
+ else
+ bawrite(bp);
}
- oip->i_e2fs_size = length;
- uvm_vnp_setsize(ovp, length);
-
/*
* Calculate index into inode's block list of
* last direct and indirect blocks (if any)
diff --git a/sys/ufs/ext2fs/ext2fs_readwrite.c b/sys/ufs/ext2fs/ext2fs_readwrite.c
index 03768d06b42..9ae4322756f 100644
--- a/sys/ufs/ext2fs/ext2fs_readwrite.c
+++ b/sys/ufs/ext2fs/ext2fs_readwrite.c
@@ -79,8 +79,6 @@ ext2fs_read(v)
struct uio *uio;
struct m_ext2fs *fs;
struct buf *bp;
- void *win;
- vsize_t bytelen;
ufs_daddr_t lbn, nextlbn;
off_t bytesinfile;
long size, xfersize, blkoffset;
@@ -109,27 +107,6 @@ ext2fs_read(v)
if (uio->uio_resid == 0)
return (0);
- if (vp->v_type == VREG) {
- error = 0;
- while (uio->uio_resid > 0) {
-
- bytelen = MIN(ip->i_e2fs_size - uio->uio_offset,
- uio->uio_resid);
-
- if (bytelen == 0) {
- break;
- }
- win = ubc_alloc(&vp->v_uobj, uio->uio_offset,
- &bytelen, UBC_READ);
- error = uiomove(win, bytelen, uio);
- ubc_release(win, 0);
- if (error) {
- break;
- }
- }
- goto out;
- }
-
for (error = 0, bp = NULL; uio->uio_resid > 0; bp = NULL) {
if ((bytesinfile = ip->i_e2fs_size - uio->uio_offset) <= 0)
break;
@@ -179,11 +156,8 @@ ext2fs_read(v)
if (bp != NULL)
brelse(bp);
-out:
if (!(vp->v_mount->mnt_flag & MNT_NOATIME)) {
ip->i_flag |= IN_ACCESS;
- if ((ap->a_ioflag & IO_SYNC) == IO_SYNC)
- error = ext2fs_update(ip, NULL, NULL, 1);
}
return (error);
}
@@ -209,17 +183,12 @@ ext2fs_write(v)
struct proc *p;
ufs_daddr_t lbn;
off_t osize;
- int blkoffset, error, flags, ioflag, resid, xfersize;
- vsize_t bytelen;
- void *win;
- off_t oldoff;
- boolean_t rv;
+ int blkoffset, error, flags, ioflag, resid, size, xfersize;
ioflag = ap->a_ioflag;
uio = ap->a_uio;
vp = ap->a_vp;
ip = VTOI(vp);
- error = 0;
#ifdef DIAGNOSTIC
if (uio->uio_rw != UIO_WRITE)
@@ -263,65 +232,35 @@ ext2fs_write(v)
resid = uio->uio_resid;
osize = ip->i_e2fs_size;
-
- if (vp->v_type == VREG) {
- while (uio->uio_resid > 0) {
- oldoff = uio->uio_offset;
- blkoffset = blkoff(fs, uio->uio_offset);
- bytelen = MIN(fs->e2fs_bsize - blkoffset,
- uio->uio_resid);
-
- /*
- * XXXUBC if file is mapped and this is the last block,
- * process one page at a time.
- */
-
- error = ext2fs_balloc_range(vp, uio->uio_offset,
- bytelen, ap->a_cred, 0);
- if (error) {
- break;
- }
- win = ubc_alloc(&vp->v_uobj, uio->uio_offset,
- &bytelen, UBC_WRITE);
- error = uiomove(win, bytelen, uio);
- ubc_release(win, 0);
- if (error) {
- break;
- }
-
- /*
- * flush what we just wrote if necessary.
- * XXXUBC simplistic async flushing.
- */
-
- if (oldoff >> 16 != uio->uio_offset >> 16) {
- simple_lock(&vp->v_uobj.vmobjlock);
- rv = vp->v_uobj.pgops->pgo_flush(
- &vp->v_uobj, (oldoff >> 16) << 16,
- (uio->uio_offset >> 16) << 16, PGO_CLEANIT);
- simple_unlock(&vp->v_uobj.vmobjlock);
- }
- }
- goto out;
- }
-
flags = ioflag & IO_SYNC ? B_SYNC : 0;
+
for (error = 0; uio->uio_resid > 0;) {
lbn = lblkno(fs, uio->uio_offset);
blkoffset = blkoff(fs, uio->uio_offset);
- xfersize = MIN(fs->e2fs_bsize - blkoffset, uio->uio_resid);
- if (xfersize < fs->e2fs_bsize)
+ xfersize = fs->e2fs_bsize - blkoffset;
+ if (uio->uio_resid < xfersize)
+ xfersize = uio->uio_resid;
+ if (fs->e2fs_bsize > xfersize)
flags |= B_CLRBUF;
else
flags &= ~B_CLRBUF;
+
error = ext2fs_buf_alloc(ip,
- lbn, blkoffset + xfersize, ap->a_cred, &bp, flags);
+ lbn, blkoffset + xfersize, ap->a_cred, &bp, flags);
if (error)
break;
- if (ip->i_e2fs_size < uio->uio_offset + xfersize) {
+ if (uio->uio_offset + xfersize > ip->i_e2fs_size) {
ip->i_e2fs_size = uio->uio_offset + xfersize;
+ uvm_vnp_setsize(vp, ip->i_e2fs_size);
}
- error = uiomove((char *)bp->b_data + blkoffset, xfersize, uio);
+ uvm_vnp_uncache(vp);
+
+ size = fs->e2fs_bsize - bp->b_resid;
+ if (size < xfersize)
+ xfersize = size;
+
+ error =
+ uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio);
if (ioflag & IO_SYNC)
(void)bwrite(bp);
else if (xfersize + blkoffset == fs->e2fs_bsize) {
@@ -333,14 +272,13 @@ ext2fs_write(v)
bdwrite(bp);
if (error || xfersize == 0)
break;
+ ip->i_flag |= IN_CHANGE | IN_UPDATE;
}
/*
* If we successfully wrote any data, and we are not the superuser
* we clear the setuid and setgid bits as a precaution against
* tampering.
*/
-out:
- ip->i_flag |= IN_CHANGE | IN_UPDATE;
if (resid > uio->uio_resid && ap->a_cred && ap->a_cred->cr_uid != 0)
ip->i_e2fs_mode &= ~(ISUID | ISGID);
if (error) {
@@ -350,7 +288,8 @@ out:
uio->uio_offset -= resid - uio->uio_resid;
uio->uio_resid = resid;
}
- } else if (resid > uio->uio_resid && (ioflag & IO_SYNC) == IO_SYNC)
+ } else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) {
error = ext2fs_update(ip, NULL, NULL, 1);
+ }
return (error);
}
diff --git a/sys/ufs/ext2fs/ext2fs_subr.c b/sys/ufs/ext2fs/ext2fs_subr.c
index 3263f7e5391..02d84be4302 100644
--- a/sys/ufs/ext2fs/ext2fs_subr.c
+++ b/sys/ufs/ext2fs/ext2fs_subr.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ext2fs_subr.c,v 1.4 2000/03/30 12:41:11 augustss Exp $ */
+/* $OpenBSD: ext2fs_subr.c,v 1.8 2001/12/19 08:58:07 art Exp $ */
+/* $NetBSD: ext2fs_subr.c,v 1.1 1997/06/11 09:34:03 bouyer Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer.
@@ -95,7 +96,7 @@ ext2fs_checkoverlap(bp, ip)
if (ep == bp || (ep->b_flags & B_INVAL) ||
ep->b_vp == NULLVP)
continue;
- if (VOP_BMAP(ep->b_vp, (ufs_daddr_t)0, &vp, (ufs_daddr_t)0, NULL))
+ if (VOP_BMAP(ep->b_vp, (daddr_t)0, &vp, (daddr_t)0, NULL))
continue;
if (vp != ip->i_devvp)
continue;
diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c
index b77f4edec62..6f404d98157 100644
--- a/sys/ufs/ext2fs/ext2fs_vfsops.c
+++ b/sys/ufs/ext2fs/ext2fs_vfsops.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ext2fs_vfsops.c,v 1.19 2001/12/10 04:45:31 art Exp $ */
-/* $NetBSD: ext2fs_vfsops.c,v 1.40 2000/11/27 08:39:53 chs Exp $ */
+/* $OpenBSD: ext2fs_vfsops.c,v 1.20 2001/12/19 08:58:07 art Exp $ */
+/* $NetBSD: ext2fs_vfsops.c,v 1.1 1997/06/11 09:34:07 bouyer Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer.
@@ -100,11 +100,6 @@ struct vfsops ext2fs_vfsops = {
ufs_check_export
};
-struct genfs_ops ext2fs_genfsops = {
- genfs_size,
- ext2fs_gop_alloc,
-};
-
struct pool ext2fs_inode_pool;
extern u_long ext2gennumber;
@@ -407,11 +402,9 @@ ext2fs_reload(mountp, cred, p)
* Step 1: invalidate all cached meta-data.
*/
devvp = VFSTOUFS(mountp)->um_devvp;
- vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p);
- error = vinvalbuf(devvp, 0, cred, p, 0, 0);
- VOP_UNLOCK(devvp, 0, p);
- if (error)
+ if (vinvalbuf(devvp, 0, cred, p, 0, 0))
panic("ext2fs_reload: dirty1");
+
/*
* Step 2: re-read superblock from disk.
*/
@@ -590,18 +583,14 @@ ext2fs_mountfs(devvp, mp, p)
mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
mp->mnt_maxsymlinklen = EXT2_MAXSYMLINKLEN;
mp->mnt_flag |= MNT_LOCAL;
- mp->mnt_dev_bshift = DEV_BSHIFT; /* XXX */
- mp->mnt_fs_bshift = m_fs->e2fs_bshift;
ump->um_mountp = mp;
ump->um_dev = dev;
ump->um_devvp = devvp;
ump->um_nindir = NINDIR(m_fs);
- ump->um_lognindir = ffs(NINDIR(m_fs)) - 1;
ump->um_bptrtodb = m_fs->e2fs_fsbtodb;
ump->um_seqinc = 1; /* no frags */
devvp->v_specmountpoint = mp;
return (0);
-
out:
if (bp)
brelse(bp);
@@ -921,7 +910,6 @@ ext2fs_vget(mp, ino, vpp)
/*
* Finish inode initialization now that aliasing has been resolved.
*/
- genfs_node_init(vp, &ext2fs_genfsops);
ip->i_devvp = ump->um_devvp;
VREF(ip->i_devvp);
/*
@@ -936,7 +924,6 @@ ext2fs_vget(mp, ino, vpp)
ip->i_flag |= IN_MODIFIED;
}
- vp->v_size = ip->i_e2fs_size;
*vpp = vp;
return (0);
}
diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c
index 6e82f66279a..d85d4eba5d9 100644
--- a/sys/ufs/ext2fs/ext2fs_vnops.c
+++ b/sys/ufs/ext2fs/ext2fs_vnops.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ext2fs_vnops.c,v 1.20 2001/12/10 04:45:31 art Exp $ */
-/* $NetBSD: ext2fs_vnops.c,v 1.30 2000/11/27 08:39:53 chs Exp $ */
+/* $OpenBSD: ext2fs_vnops.c,v 1.21 2001/12/19 08:58:07 art Exp $ */
+/* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer.
@@ -402,6 +402,8 @@ ext2fs_chmod(vp, mode, cred, p)
ip->i_e2fs_mode &= ~ALLPERMS;
ip->i_e2fs_mode |= (mode & ALLPERMS);
ip->i_flag |= IN_CHANGE;
+ if ((vp->v_flag & VTEXT) && (ip->i_e2fs_mode & S_ISTXT) == 0)
+ (void) uvm_vnp_uncache(vp);
return (0);
}
@@ -1467,10 +1469,7 @@ struct vnodeopv_entry_desc ext2fs_vnodeop_entries[] = {
{ &vop_pathconf_desc, ufs_pathconf }, /* pathconf */
{ &vop_advlock_desc, ext2fs_advlock }, /* advlock */
{ &vop_bwrite_desc, vop_generic_bwrite }, /* bwrite */
- { &vop_getpages_desc, genfs_getpages },
- { &vop_putpages_desc, genfs_putpages },
- { &vop_mmap_desc, ufs_mmap },
- { NULL, NULL }
+ { (struct vnodeop_desc*)NULL, (int(*) __P((void*)))NULL }
};
struct vnodeopv_desc ext2fs_vnodeop_opv_desc =
{ &ext2fs_vnodeop_p, ext2fs_vnodeop_entries };
@@ -1513,8 +1512,7 @@ struct vnodeopv_entry_desc ext2fs_specop_entries[] = {
{ &vop_pathconf_desc, spec_pathconf }, /* pathconf */
{ &vop_advlock_desc, spec_advlock }, /* advlock */
{ &vop_bwrite_desc, vop_generic_bwrite }, /* bwrite */
- { &vop_mmap_desc, spec_mmap },
- { NULL, NULL }
+ { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
};
struct vnodeopv_desc ext2fs_specop_opv_desc =
{ &ext2fs_specop_p, ext2fs_specop_entries };
@@ -1558,8 +1556,7 @@ struct vnodeopv_entry_desc ext2fs_fifoop_entries[] = {
{ &vop_pathconf_desc, fifo_pathconf }, /* pathconf */
{ &vop_advlock_desc, fifo_advlock }, /* advlock */
{ &vop_bwrite_desc, vop_generic_bwrite }, /* bwrite */
- { &vop_mmap_desc, fifo_mmap },
- { NULL, NULL }
+ { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
};
struct vnodeopv_desc ext2fs_fifoop_opv_desc =
{ &ext2fs_fifoop_p, ext2fs_fifoop_entries };