Write update some old fields when writing the superblock, similar to
ffs_oldfscompat_write() in the kernel. Use the old totals when time < old_time (i.e. an old kernel or fsck wrote the filesystem last). When setting the date back on a new kernel, that works out ok, since new kernels always update both fields.
This commit is contained in:
parent
508f668a25
commit
750ed85d47
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: extern.h,v 1.16 2003/04/02 10:39:25 fvdl Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.17 2003/04/06 17:23:25 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 James A. Jegers
|
||||
|
@ -82,3 +82,4 @@ void voidquit __P((int));
|
|||
|
||||
void swap_cg __P((struct cg *, struct cg *));
|
||||
void copyback_cg __P((struct bufarea *));
|
||||
void sb_oldfscompat_write(struct fs *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fsck.h,v 1.32 2003/04/02 10:39:25 fvdl Exp $ */
|
||||
/* $NetBSD: fsck.h,v 1.33 2003/04/06 17:23:25 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -144,8 +144,9 @@ struct cg *cgrp;
|
|||
#define sbdirty() \
|
||||
do { \
|
||||
memmove(sblk.b_un.b_fs, sblock, SBLOCKSIZE); \
|
||||
sb_oldfscompat_write(sblk.b_un.b_fs); \
|
||||
if (needswap) \
|
||||
ffs_sb_swap(sblock, sblk.b_un.b_fs); \
|
||||
ffs_sb_swap(sblk.b_un.b_fs, sblk.b_un.b_fs); \
|
||||
sblk.b_dirty = 1; \
|
||||
} while (0)
|
||||
#define cgdirty() do {copyback_cg(&cgblk); cgblk.b_dirty = 1;} while (0)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: setup.c,v 1.59 2003/04/05 13:45:21 fvdl Exp $ */
|
||||
/* $NetBSD: setup.c,v 1.60 2003/04/06 17:23:26 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -38,7 +38,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: setup.c,v 1.59 2003/04/05 13:45:21 fvdl Exp $");
|
||||
__RCSID("$NetBSD: setup.c,v 1.60 2003/04/06 17:23:26 fvdl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -696,17 +696,25 @@ out:
|
|||
/*
|
||||
* If not yet done, update UFS1 superblock with new wider fields.
|
||||
*/
|
||||
if (sblock->fs_magic == FS_UFS1_MAGIC &&
|
||||
sblock->fs_maxbsize != sblock->fs_bsize) {
|
||||
if (sblock->fs_magic == FS_UFS1_MAGIC) {
|
||||
if (sblock->fs_maxbsize != sblock->fs_bsize ||
|
||||
sblock->fs_time < sblock->fs_old_time) {
|
||||
sblock->fs_cstotal.cs_ndir =
|
||||
sblock->fs_old_cstotal.cs_ndir;
|
||||
sblock->fs_cstotal.cs_nbfree =
|
||||
sblock->fs_old_cstotal.cs_nbfree;
|
||||
sblock->fs_cstotal.cs_nifree =
|
||||
sblock->fs_old_cstotal.cs_nifree;
|
||||
sblock->fs_cstotal.cs_nffree =
|
||||
sblock->fs_old_cstotal.cs_nffree;
|
||||
}
|
||||
if (sblock->fs_maxbsize != sblock->fs_bsize) {
|
||||
sblock->fs_maxbsize = sblock->fs_bsize;
|
||||
sblock->fs_time = sblock->fs_old_time;
|
||||
sblock->fs_size = sblock->fs_old_size;
|
||||
sblock->fs_dsize = sblock->fs_old_dsize;
|
||||
sblock->fs_csaddr = sblock->fs_old_csaddr;
|
||||
sblock->fs_cstotal.cs_ndir = sblock->fs_old_cstotal.cs_ndir;
|
||||
sblock->fs_cstotal.cs_nbfree = sblock->fs_old_cstotal.cs_nbfree;
|
||||
sblock->fs_cstotal.cs_nifree = sblock->fs_old_cstotal.cs_nifree;
|
||||
sblock->fs_cstotal.cs_nffree = sblock->fs_old_cstotal.cs_nffree;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now we know the SB is valid, we can write it back if needed */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: utilities.c,v 1.36 2003/04/02 10:39:27 fvdl Exp $ */
|
||||
/* $NetBSD: utilities.c,v 1.37 2003/04/06 17:23:26 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -38,7 +38,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: utilities.c,v 1.36 2003/04/02 10:39:27 fvdl Exp $");
|
||||
__RCSID("$NetBSD: utilities.c,v 1.37 2003/04/06 17:23:26 fvdl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -643,3 +643,16 @@ inoinfo(ino_t inum)
|
|||
return (&unallocated);
|
||||
return (&ilp->il_stat[iloff]);
|
||||
}
|
||||
|
||||
void
|
||||
sb_oldfscompat_write(struct fs *fs)
|
||||
{
|
||||
if (fs->fs_magic != FS_UFS1_MAGIC)
|
||||
return;
|
||||
|
||||
fs->fs_old_time = fs->fs_time;
|
||||
fs->fs_old_cstotal.cs_ndir = fs->fs_cstotal.cs_ndir;
|
||||
fs->fs_old_cstotal.cs_nbfree = fs->fs_cstotal.cs_nbfree;
|
||||
fs->fs_old_cstotal.cs_nifree = fs->fs_cstotal.cs_nifree;
|
||||
fs->fs_old_cstotal.cs_nffree = fs->fs_cstotal.cs_nffree;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue