summaryrefslogtreecommitdiff
path: root/sys/gnu/ext2fs
diff options
context:
space:
mode:
Diffstat (limited to 'sys/gnu/ext2fs')
-rw-r--r--sys/gnu/ext2fs/ext2_alloc.c7
-rw-r--r--sys/gnu/ext2fs/ext2_extern.h2
-rw-r--r--sys/gnu/ext2fs/ext2_inode.c27
-rw-r--r--sys/gnu/ext2fs/ext2_readwrite.c7
-rw-r--r--sys/gnu/ext2fs/ext2_subr.c9
-rw-r--r--sys/gnu/ext2fs/ext2_vfsops.c9
-rw-r--r--sys/gnu/ext2fs/ext2_vnops.c32
7 files changed, 55 insertions, 38 deletions
diff --git a/sys/gnu/ext2fs/ext2_alloc.c b/sys/gnu/ext2fs/ext2_alloc.c
index 0d4dfe3621fcd..21b9165542b6c 100644
--- a/sys/gnu/ext2fs/ext2_alloc.c
+++ b/sys/gnu/ext2fs/ext2_alloc.c
@@ -232,6 +232,7 @@ return ENOSPC;
daddr_t start_lbn, end_lbn, soff, eoff, newblk, blkno;
struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp;
int i, len, start_lvl, end_lvl, pref, ssize;
+ struct timeval tv;
vp = ap->a_vp;
ip = VTOI(vp);
@@ -338,8 +339,10 @@ return ENOSPC;
bwrite(sbp);
} else {
ip->i_flag |= IN_CHANGE | IN_UPDATE;
- if (!doasyncfree)
- UFS_UPDATE(vp, 1);
+ if (!doasyncfree) {
+ gettime(&tv);
+ UFS_UPDATE(vp, &tv, &tv, MNT_WAIT);
+ }
}
if (ssize < len)
if (doasyncfree)
diff --git a/sys/gnu/ext2fs/ext2_extern.h b/sys/gnu/ext2fs/ext2_extern.h
index 317f540af1e1b..0afd890403a16 100644
--- a/sys/gnu/ext2fs/ext2_extern.h
+++ b/sys/gnu/ext2fs/ext2_extern.h
@@ -62,7 +62,7 @@ int ext2_reallocblks __P((struct vop_reallocblks_args *));
int ext2_reclaim __P((struct vop_reclaim_args *));
void ext2_setblock __P((struct ext2_sb_info *, u_char *, daddr_t));
int ext2_truncate __P((struct vnode *, off_t, int, struct ucred *, struct proc *));
-int ext2_update __P((struct vnode *, int));
+int ext2_update __P((struct vnode *, struct timeval *, struct timeval *, int));
int ext2_valloc __P((struct vnode *, int, struct ucred *, struct vnode **));
int ext2_vfree __P((struct vnode *, ino_t, int));
int ext2_lookup __P((struct vop_cachedlookup_args *));
diff --git a/sys/gnu/ext2fs/ext2_inode.c b/sys/gnu/ext2fs/ext2_inode.c
index b287c16488575..4699d4d51dc00 100644
--- a/sys/gnu/ext2fs/ext2_inode.c
+++ b/sys/gnu/ext2fs/ext2_inode.c
@@ -80,8 +80,10 @@ ext2_init(struct vfsconf *vfsp)
* set, then wait for the write to complete.
*/
int
-ext2_update(vp, waitfor)
+ext2_update(vp, access, modify, waitfor)
struct vnode *vp;
+ struct timeval *access;
+ struct timeval *modify;
int waitfor;
{
register struct ext2_sb_info *fs;
@@ -140,7 +142,8 @@ ext2_truncate(vp, length, flags, cred, p)
register struct ext2_sb_info *fs;
struct buf *bp;
int offset, size, level;
- long count, nblocks, blocksreleased = 0;
+ long count, nblocks, vflags, blocksreleased = 0;
+ struct timeval tv;
register int i;
int aflags, error, allerror;
off_t osize;
@@ -154,6 +157,7 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, length);
return EFBIG;
oip = VTOI(ovp);
+ getmicrotime(&tv);
if (ovp->v_type == VLNK &&
oip->i_size < ovp->v_mount->mnt_maxsymlinklen) {
#if DIAGNOSTIC
@@ -163,11 +167,11 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, length);
bzero((char *)&oip->i_shortlink, (u_int)oip->i_size);
oip->i_size = 0;
oip->i_flag |= IN_CHANGE | IN_UPDATE;
- return (UFS_UPDATE(ovp, 1));
+ return (UFS_UPDATE(ovp, &tv, &tv, 1));
}
if (oip->i_size == length) {
oip->i_flag |= IN_CHANGE | IN_UPDATE;
- return (UFS_UPDATE(ovp, 0));
+ return (UFS_UPDATE(ovp, &tv, &tv, 0));
}
#if QUOTA
if (error = getinoquota(oip))
@@ -197,7 +201,7 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, length);
else
bawrite(bp);
oip->i_flag |= IN_CHANGE | IN_UPDATE;
- return (UFS_UPDATE(ovp, 1));
+ return (UFS_UPDATE(ovp, &tv, &tv, 1));
}
/*
* Shorten the size of the file. If the file is not being
@@ -253,8 +257,8 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, length);
for (i = NDADDR - 1; i > lastblock; i--)
oip->i_db[i] = 0;
oip->i_flag |= IN_CHANGE | IN_UPDATE;
- allerror = UFS_UPDATE(ovp, 1);
-
+ if (error = UFS_UPDATE(ovp, &tv, &tv, MNT_WAIT))
+ allerror = error;
/*
* Having written the new inode to disk, save its new configuration
* and put back the old block pointers long enough to process them.
@@ -264,9 +268,8 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, length);
bcopy((caddr_t)&oip->i_db[0], (caddr_t)newblks, sizeof newblks);
bcopy((caddr_t)oldblks, (caddr_t)&oip->i_db[0], sizeof oldblks);
oip->i_size = osize;
- error = vtruncbuf(ovp, cred, p, length, (int)fs->s_blocksize);
- if (error && (allerror == 0))
- allerror = error;
+ vflags = ((length > 0) ? V_SAVE : 0) | V_SAVEMETA;
+ allerror = vinvalbuf(ovp, vflags, cred, p, 0, 0);
/*
* Indirect blocks first.
@@ -345,8 +348,8 @@ done:
for (i = 0; i < NDADDR; i++)
if (newblks[i] != oip->i_db[i])
panic("itrunc2");
- if (length == 0 && (!TAILQ_EMPTY(&ovp->v_dirtyblkhd) ||
- !TAILQ_EMPTY(&ovp->v_cleanblkhd)))
+ if (length == 0 &&
+ (ovp->v_dirtyblkhd.lh_first || ovp->v_cleanblkhd.lh_first))
panic("itrunc3");
#endif /* DIAGNOSTIC */
/*
diff --git a/sys/gnu/ext2fs/ext2_readwrite.c b/sys/gnu/ext2fs/ext2_readwrite.c
index d5881e2e6f49d..7efe39afe4a01 100644
--- a/sys/gnu/ext2fs/ext2_readwrite.c
+++ b/sys/gnu/ext2fs/ext2_readwrite.c
@@ -173,6 +173,7 @@ WRITE(ap)
daddr_t lbn;
off_t osize;
int blkoffset, error, flags, ioflag, resid, size, xfersize;
+ struct timeval tv;
ioflag = ap->a_ioflag;
uio = ap->a_uio;
@@ -288,7 +289,9 @@ WRITE(ap)
uio->uio_offset -= resid - uio->uio_resid;
uio->uio_resid = resid;
}
- } else if (resid > uio->uio_resid && (ioflag & IO_SYNC))
- error = UFS_UPDATE(vp, 1);
+ } else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) {
+ getmicrotime(&tv);
+ error = UFS_UPDATE(vp, &tv, &tv, 1);
+ }
return (error);
}
diff --git a/sys/gnu/ext2fs/ext2_subr.c b/sys/gnu/ext2fs/ext2_subr.c
index ed48acf46734e..30da6a7300cbd 100644
--- a/sys/gnu/ext2fs/ext2_subr.c
+++ b/sys/gnu/ext2fs/ext2_subr.c
@@ -52,11 +52,7 @@
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
-#include "opt_ddb.h"
-
-#ifdef DDB
-void ext2_checkoverlap __P((struct buf *, struct inode *));
-#endif
+static void ext2_checkoverlap __P((struct buf *, struct inode *));
/*
* Return buffer with the contents of block "offset" from the beginning of
@@ -92,8 +88,9 @@ ext2_blkatoff(vp, offset, res, bpp)
return (0);
}
+#include "opt_ddb.h"
#ifdef DDB
-void
+static void
ext2_checkoverlap(bp, ip)
struct buf *bp;
struct inode *ip;
diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c
index ea756b5a6ddd6..11045341bdf96 100644
--- a/sys/gnu/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/ext2fs/ext2_vfsops.c
@@ -276,8 +276,7 @@ ext2_mount(mp, path, data, ndp, p)
vrele(devvp);
return (ENOTBLK);
}
- if (major(devvp->v_rdev) >= nblkdev ||
- bdevsw[major(devvp->v_rdev)] == NULL) {
+ if (major(devvp->v_rdev) >= nblkdev) {
vrele(devvp);
return (ENXIO);
}
@@ -893,6 +892,7 @@ ext2_sync(mp, waitfor, cred, p)
struct inode *ip;
struct ufsmount *ump = VFSTOUFS(mp);
struct ext2_sb_info *fs;
+ struct timeval tv;
int error, allerror = 0;
fs = ump->um_e2fs;
@@ -918,7 +918,8 @@ loop:
if (vp->v_type == VNON ||
(ip->i_flag &
(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 &&
- (TAILQ_EMPTY(&vp->v_dirtyblkhd) || waitfor == MNT_LAZY)) {
+ (vp->v_dirtyblkhd.lh_first == NULL ||
+ waitfor == MNT_LAZY)) {
simple_unlock(&vp->v_interlock);
continue;
}
@@ -1170,7 +1171,7 @@ ext2_sbupdate(mp, waitfor)
register struct ext2_sb_info *fs = mp->um_e2fs;
register struct ext2_super_block *es = fs->s_es;
register struct buf *bp;
- int error = 0;
+ int i, error = 0;
/*
printf("\nupdating superblock, waitfor=%s\n", waitfor == MNT_WAIT ? "yes":"no");
*/
diff --git a/sys/gnu/ext2fs/ext2_vnops.c b/sys/gnu/ext2fs/ext2_vnops.c
index f3b9bcc171096..07e94b84ef9f6 100644
--- a/sys/gnu/ext2fs/ext2_vnops.c
+++ b/sys/gnu/ext2fs/ext2_vnops.c
@@ -182,6 +182,7 @@ ext2_fsync(ap)
{
register struct vnode *vp = ap->a_vp;
register struct buf *bp;
+ struct timeval tv;
struct buf *nbp;
int s;
@@ -196,8 +197,8 @@ ext2_fsync(ap)
loop:
s = splbio();
- for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) {
- nbp = TAILQ_NEXT(bp, b_vnbufs);
+ for (bp = vp->v_dirtyblkhd.lh_first; bp; bp = nbp) {
+ nbp = bp->b_vnbufs.le_next;
if ((bp->b_flags & B_BUSY))
continue;
if ((bp->b_flags & B_DELWRI) == 0)
@@ -221,14 +222,15 @@ loop:
tsleep(&vp->v_numoutput, PRIBIO + 1, "e2fsyn", 0);
}
#if DIAGNOSTIC
- if (!TAILQ_EMPTY(&vp->v_dirtyblkhd)) {
+ if (vp->v_dirtyblkhd.lh_first) {
vprint("ext2_fsync: dirty", vp);
goto loop;
}
#endif
}
splx(s);
- return (UFS_UPDATE(ap->a_vp, ap->a_waitfor == MNT_WAIT));
+ getmicrotime(&tv);
+ return (UFS_UPDATE(ap->a_vp, &tv, &tv, ap->a_waitfor == MNT_WAIT));
}
/*
@@ -318,6 +320,7 @@ ext2_link(ap)
struct componentname *cnp = ap->a_cnp;
struct proc *p = cnp->cn_proc;
struct inode *ip;
+ struct timeval tv;
int error;
#ifdef DIAGNOSTIC
@@ -346,7 +349,8 @@ ext2_link(ap)
}
ip->i_nlink++;
ip->i_flag |= IN_CHANGE;
- error = UFS_UPDATE(vp, 1);
+ getmicrotime(&tv);
+ error = UFS_UPDATE(vp, &tv, &tv, 1);
if (!error)
error = ext2_direnter(ip, tdvp, cnp);
if (error) {
@@ -385,6 +389,7 @@ ext2_rename(ap)
struct proc *p = fcnp->cn_proc;
struct inode *ip, *xp, *dp;
struct dirtemplate dirbuf;
+ struct timeval tv;
int doingdirectory = 0, oldparent = 0, newparent = 0;
int error = 0;
u_char namlen;
@@ -522,7 +527,8 @@ abortit:
*/
ip->i_nlink++;
ip->i_flag |= IN_CHANGE;
- if (error = UFS_UPDATE(fvp, 1)) {
+ getmicrotime(&tv);
+ if (error = UFS_UPDATE(fvp, &tv, &tv, 1)) {
VOP_UNLOCK(fvp, 0, p);
goto bad;
}
@@ -583,7 +589,7 @@ abortit:
}
dp->i_nlink++;
dp->i_flag |= IN_CHANGE;
- error = UFS_UPDATE(tdvp, 1);
+ error = UFS_UPDATE(tdvp, &tv, &tv, 1);
if (error)
goto bad;
}
@@ -592,7 +598,7 @@ abortit:
if (doingdirectory && newparent) {
dp->i_nlink--;
dp->i_flag |= IN_CHANGE;
- (void)UFS_UPDATE(tdvp, 1);
+ (void)UFS_UPDATE(tdvp, &tv, &tv, 1);
}
goto bad;
}
@@ -801,6 +807,7 @@ ext2_mkdir(ap)
register struct inode *ip, *dp;
struct vnode *tvp;
struct dirtemplate dirtemplate, *dtp;
+ struct timeval tv;
int error, dmode;
#ifdef DIAGNOSTIC
@@ -889,7 +896,8 @@ ext2_mkdir(ap)
ip->i_nlink = 2;
if (cnp->cn_flags & ISWHITEOUT)
ip->i_flags |= UF_OPAQUE;
- error = UFS_UPDATE(tvp, 1);
+ getmicrotime(&tv);
+ error = UFS_UPDATE(tvp, &tv, &tv, 1);
/*
* Bump link count in parent directory
@@ -899,7 +907,7 @@ ext2_mkdir(ap)
*/
dp->i_nlink++;
dp->i_flag |= IN_CHANGE;
- error = UFS_UPDATE(dvp, 1);
+ error = UFS_UPDATE(dvp, &tv, &tv, 1);
if (error)
goto bad;
@@ -1069,6 +1077,7 @@ ext2_makeinode(mode, dvp, vpp, cnp)
struct componentname *cnp;
{
register struct inode *ip, *pdir;
+ struct timeval tv;
struct vnode *tvp;
int error;
@@ -1161,7 +1170,8 @@ ext2_makeinode(mode, dvp, vpp, cnp)
/*
* Make sure inode goes to disk before directory entry.
*/
- error = UFS_UPDATE(tvp, 1);
+ getmicrotime(&tv);
+ error = UFS_UPDATE(tvp, &tv, &tv, 1);
if (error)
goto bad;
error = ext2_direnter(ip, dvp, cnp);