summaryrefslogtreecommitdiff
path: root/sys/ufs/ffs/ffs_vfsops.c
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2007-05-29 18:40:54 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2007-05-29 18:40:54 +0000
commitcef6fd5583264e50748b85df457b51cb317ac915 (patch)
tree6db84bc1a29e77fe21c947a13a1ca8b73f85b7c4 /sys/ufs/ffs/ffs_vfsops.c
parent401228583f4aadccb1d35d8685a9187a0364c7ed (diff)
FFS2-aware code for ffs_sbupdate() and ffs_reload().
Okay otto@ millert@ krw@ beck@ thib@
Diffstat (limited to 'sys/ufs/ffs/ffs_vfsops.c')
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index c39df355cab..906532b4b8c 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_vfsops.c,v 1.104 2007/04/24 12:10:28 millert Exp $ */
+/* $OpenBSD: ffs_vfsops.c,v 1.105 2007/05/29 18:40:53 pedro Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */
/*
@@ -553,7 +553,10 @@ ffs_reload(struct mount *mountp, struct ucred *cred, struct proc *p)
else
size = dpart.disklab->d_secsize;
- error = bread(devvp, (daddr_t)(SBOFF / size), SBSIZE, NOCRED, &bp);
+ fs = VFSTOUFS(mountp)->um_fs;
+
+ error = bread(devvp, (daddr_t)(fs->fs_sblockloc / size), SBSIZE,
+ NOCRED, &bp);
if (error) {
brelse(bp);
return (error);
@@ -564,7 +567,7 @@ ffs_reload(struct mount *mountp, struct ucred *cred, struct proc *p)
brelse(bp);
return (EINVAL);
}
- fs = VFSTOUFS(mountp)->um_fs;
+
/*
* Copy pointer fields back into superblock before copying in XXX
* new superblock. These should really be in the ufsmount. XXX
@@ -578,7 +581,7 @@ ffs_reload(struct mount *mountp, struct ucred *cred, struct proc *p)
bp->b_flags |= B_INVAL;
brelse(bp);
mountp->mnt_maxsymlinklen = fs->fs_maxsymlinklen;
- ffs1_compat_read(fs, VFSTOUFS(mountp), SBOFF);
+ ffs1_compat_read(fs, VFSTOUFS(mountp), fs->fs_sblockloc);
ffs_oldfscompat(fs);
(void)ffs_statfs(mountp, &mountp->mnt_stat, p);
/*
@@ -1436,16 +1439,20 @@ ffs_sbupdate(struct ufsmount *mp, int waitfor)
else if ((error = bwrite(bp)))
allerror = error;
}
+
/*
* Now write back the superblock itself. If any errors occurred
* up to this point, then fail so that the superblock avoids
* being written out as clean.
*/
- if (allerror)
+ if (allerror) {
+ brelse(bp);
return (allerror);
+ }
- bp = getblk(mp->um_devvp, SBOFF >> (fs->fs_fshift - fs->fs_fsbtodb),
- (int)fs->fs_sbsize, 0, 0);
+ bp = getblk(mp->um_devvp,
+ fs->fs_sblockloc >> (fs->fs_fshift - fs->fs_fsbtodb),
+ (int)fs->fs_sbsize, 0, 0);
fs->fs_fmod = 0;
fs->fs_time = time_second;
bcopy((caddr_t)fs, bp->b_data, (u_int)fs->fs_sbsize);
@@ -1470,6 +1477,7 @@ ffs_sbupdate(struct ufsmount *mp, int waitfor)
bawrite(bp);
else if ((error = bwrite(bp)))
allerror = error;
+
return (allerror);
}