when enabling ffs compatibility in ffs_reload, use

sblockloc that superblock was read from
also note XXX that ffs_reload doesn't handle superblock moving
This commit is contained in:
dbj 2004-04-18 03:30:23 +00:00
parent 019cfb87ee
commit d7c33aeb1e
2 changed files with 21 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_alloc.c,v 1.74 2004/01/13 13:38:18 soren Exp $ */
/* $NetBSD: ffs_alloc.c,v 1.75 2004/04/18 03:30:23 dbj Exp $ */
/*
* Copyright (c) 2002 Networks Associates Technology, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.74 2004/01/13 13:38:18 soren Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.75 2004/04/18 03:30:23 dbj Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -1266,6 +1266,10 @@ gotit:
((fs->fs_old_flags & FS_FLAGS_UPDATED) == 0)) {
int cylno;
cylno = old_cbtocylno(fs, bno);
KASSERT(cylno >= 0);
KASSERT(cylno < fs->fs_old_ncyl);
KASSERT(old_cbtorpos(fs, bno) >= 0);
KASSERT(fs->fs_old_nrpos == 0 || old_cbtorpos(fs, bno) < fs->fs_old_nrpos);
ufs_add16(old_cg_blks(fs, cgp, cylno, needswap)[old_cbtorpos(fs, bno)], -1,
needswap);
ufs_add32(old_cg_blktot(cgp, needswap)[cylno], -1, needswap);
@ -1582,6 +1586,10 @@ ffs_blkfree(ip, bno, size)
if ((fs->fs_magic == FS_UFS1_MAGIC) &&
((fs->fs_old_flags & FS_FLAGS_UPDATED) == 0)) {
i = old_cbtocylno(fs, cgbno);
KASSERT(i >= 0);
KASSERT(i < fs->fs_old_ncyl);
KASSERT(old_cbtorpos(fs, cgbno) >= 0);
KASSERT(fs->fs_old_nrpos == 0 || old_cbtorpos(fs, cgbno) < fs->fs_old_nrpos);
ufs_add16(old_cg_blks(fs, cgp, i, needswap)[old_cbtorpos(fs, cgbno)], 1,
needswap);
ufs_add32(old_cg_blktot(cgp, needswap)[i], 1, needswap);
@ -1629,6 +1637,10 @@ ffs_blkfree(ip, bno, size)
if ((fs->fs_magic == FS_UFS1_MAGIC) &&
((fs->fs_old_flags & FS_FLAGS_UPDATED) == 0)) {
i = old_cbtocylno(fs, bbase);
KASSERT(i >= 0);
KASSERT(i < fs->fs_old_ncyl);
KASSERT(old_cbtorpos(fs, bbase) >= 0);
KASSERT(fs->fs_old_nrpos == 0 || old_cbtorpos(fs, bbase) < fs->fs_old_nrpos);
ufs_add16(old_cg_blks(fs, cgp, i, needswap)[old_cbtorpos(fs,
bbase)], 1, needswap);
ufs_add32(old_cg_blktot(cgp, needswap)[i], 1, needswap);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_vfsops.c,v 1.140 2004/03/27 12:40:46 dsl Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.141 2004/04/18 03:30:23 dbj Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.140 2004/03/27 12:40:46 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.141 2004/04/18 03:30:23 dbj Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -461,6 +461,7 @@ ffs_reload(mountp, cred, p)
int i, blks, size, error;
int32_t *lp;
struct ufsmount *ump;
daddr_t sblockloc;
if ((mountp->mnt_flag & MNT_RDONLY) == 0)
return (EINVAL);
@ -483,6 +484,7 @@ ffs_reload(mountp, cred, p)
size = DEV_BSIZE;
else
size = dpart.disklab->d_secsize;
/* XXX we don't handle possibility that superblock moved. */
error = bread(devvp, fs->fs_sblockloc / size, fs->fs_sbsize,
NOCRED, &bp);
if (error) {
@ -506,6 +508,8 @@ ffs_reload(mountp, cred, p)
free(newfs, M_UFSMNT);
return (EIO); /* XXX needs translation */
}
/* Store off old fs_sblockloc for fs_oldfscompat_read. */
sblockloc = fs->fs_sblockloc;
/*
* Copy pointer fields back into superblock before copying in XXX
* new superblock. These should really be in the ufsmount. XXX
@ -558,7 +562,7 @@ ffs_reload(mountp, cred, p)
/* see comment about NeXT below */
mountp->mnt_maxsymlinklen = APPLEUFS_MAXSYMLINKLEN;
}
ffs_oldfscompat_read(fs, VFSTOUFS(mountp), fs->fs_sblockloc);
ffs_oldfscompat_read(fs, VFSTOUFS(mountp), sblockloc);
if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) {
fs->fs_pendingblocks = 0;
fs->fs_pendinginodes = 0;