diff options
author | Pedro Martelletto <pedro@cvs.openbsd.org> | 2006-03-31 08:13:08 +0000 |
---|---|---|
committer | Pedro Martelletto <pedro@cvs.openbsd.org> | 2006-03-31 08:13:08 +0000 |
commit | 8dce21ac373963d2038877c62e93403db0e1adff (patch) | |
tree | 669cca5abb2815714608d58ec918265ee6ccd8b9 /sys/ufs/ffs/ffs_vfsops.c | |
parent | ffc47002c5a263357f88148528c3aa69712f5d32 (diff) |
Super block changes for FFS2, thanks to all who tested.
Silent okay after almost 3 weeks, hackers@.
Diffstat (limited to 'sys/ufs/ffs/ffs_vfsops.c')
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index b6fa8941464..af74eb3cfe1 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.82 2006/03/09 13:25:02 pedro Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.83 2006/03/31 08:13:07 pedro Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -68,6 +68,9 @@ int ffs_sbupdate(struct ufsmount *, int); int ffs_reload_vnode(struct vnode *, void *); int ffs_sync_vnode(struct vnode *, void *); +void ffs1_compat_read(struct fs *, struct ufsmount *, ufs2_daddr_t); +void ffs1_compat_write(struct fs *, struct ufsmount *); + const struct vfsops ffs_vfsops = { ffs_mount, ufs_start, @@ -754,6 +757,9 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) brelse(bp); bp = NULL; fs = ump->um_fs; + + ffs1_compat_read(fs, ump, sbloc); + fs->fs_ronly = ronly; size = fs->fs_cssize; blks = howmany(size, fs->fs_fsize); @@ -901,6 +907,48 @@ ffs_oldfscompat(struct fs *fs) } /* + * Auxiliary function for reading FFS1 super blocks. + */ +void +ffs1_compat_read(struct fs *fs, struct ufsmount *ump, ufs2_daddr_t sbloc) +{ + if (fs->fs_magic == FS_UFS2_MAGIC) + return; /* UFS2 */ + + if (fs->fs_ffs1_flags & FS_FLAGS_UPDATED) + return; /* Already updated */ + + fs->fs_flags = fs->fs_ffs1_flags; + fs->fs_sblockloc = sbloc; + fs->fs_maxbsize = fs->fs_bsize; + fs->fs_time = fs->fs_ffs1_time; + fs->fs_size = fs->fs_ffs1_size; + fs->fs_dsize = fs->fs_ffs1_dsize; + fs->fs_csaddr = fs->fs_ffs1_csaddr; + fs->fs_cstotal.cs_ndir = fs->fs_ffs1_cstotal.cs_ndir; + fs->fs_cstotal.cs_nbfree = fs->fs_ffs1_cstotal.cs_nbfree; + fs->fs_cstotal.cs_nifree = fs->fs_ffs1_cstotal.cs_nifree; + fs->fs_cstotal.cs_nffree = fs->fs_ffs1_cstotal.cs_nffree; + fs->fs_ffs1_flags |= FS_FLAGS_UPDATED; +} + +/* + * Auxiliary function for writing FFS1 super blocks. + */ +void +ffs1_compat_write(struct fs *fs, struct ufsmount *ump) +{ + if (fs->fs_magic != FS_UFS1_MAGIC) + return; /* UFS2 */ + + fs->fs_ffs1_time = fs->fs_time; + fs->fs_ffs1_cstotal.cs_ndir = fs->fs_cstotal.cs_ndir; + fs->fs_ffs1_cstotal.cs_nbfree = fs->fs_cstotal.cs_nbfree; + fs->fs_ffs1_cstotal.cs_nifree = fs->fs_cstotal.cs_nifree; + fs->fs_ffs1_cstotal.cs_nffree = fs->fs_cstotal.cs_nffree; +} + +/* * unmount system call */ int @@ -1350,6 +1398,9 @@ ffs_sbupdate(struct ufsmount *mp, int waitfor) lp[0] = tmp; /* XXX */ } /* XXX */ dfs->fs_maxfilesize = mp->um_savedmaxfilesize; /* XXX */ + + ffs1_compat_write(dfs, mp); + if (waitfor != MNT_WAIT) bawrite(bp); else if ((error = bwrite(bp))) |