aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2002-11-27 02:18:58 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2002-11-27 02:18:58 +0000
commitada981b228eba1fdb31f9817c015e69a757e1cb3 (patch)
treed1928be6bf74e88babe007808d7eaa98444918f3 /sbin
parentbd32b70236011007576b1ce556b04eb22c759794 (diff)
downloadsrc-ada981b228eba1fdb31f9817c015e69a757e1cb3.tar.gz
src-ada981b228eba1fdb31f9817c015e69a757e1cb3.zip
Create a new 32-bit fs_flags word in the superblock. Add code to move
the old 8-bit fs_old_flags to the new location the first time that the filesystem is mounted by a new kernel. One of the unused flags in fs_old_flags is used to indicate that the flags have been moved. Leave the fs_old_flags word intact so that it will work properly if used on an old kernel. Change the fs_sblockloc superblock location field to be in units of bytes instead of in units of filesystem fragments. The old units did not work properly when the fragment size exceeeded the superblock size (8192). Update old fs_sblockloc values at the same time that the flags are moved. Suggested by: BOUWSMA Barry <freebsd-misuser@netscum.dyndns.dk> Sponsored by: DARPA & NAI Labs.
Notes
Notes: svn path=/head/; revision=107294
Diffstat (limited to 'sbin')
-rw-r--r--sbin/badsect/badsect.c2
-rw-r--r--sbin/clri/clri.c2
-rw-r--r--sbin/dump/main.c3
-rw-r--r--sbin/dumpfs/dumpfs.c2
-rw-r--r--sbin/fsck_ffs/fsutil.c4
-rw-r--r--sbin/fsck_ffs/setup.c3
-rw-r--r--sbin/fsirand/fsirand.c3
-rw-r--r--sbin/growfs/growfs.c3
-rw-r--r--sbin/newfs/mkfs.c12
-rw-r--r--sbin/quotacheck/quotacheck.c3
-rw-r--r--sbin/tunefs/tunefs.c2
11 files changed, 17 insertions, 22 deletions
diff --git a/sbin/badsect/badsect.c b/sbin/badsect/badsect.c
index 519f2b7fdd3c..417cb1e4692d 100644
--- a/sbin/badsect/badsect.c
+++ b/sbin/badsect/badsect.c
@@ -144,7 +144,7 @@ main(int argc, char *argv[])
rdfs(sblock_try[i] / dev_bsize, SBLOCKSIZE, (char *)fs);
if ((fs->fs_magic == FS_UFS1_MAGIC ||
(fs->fs_magic == FS_UFS2_MAGIC &&
- fs->fs_sblockloc == numfrags(fs, sblock_try[i]))) &&
+ fs->fs_sblockloc == sblock_try[i])) &&
fs->fs_bsize <= MAXBSIZE &&
fs->fs_bsize >= sizeof(struct fs))
break;
diff --git a/sbin/clri/clri.c b/sbin/clri/clri.c
index 143e3018535c..0aa9c33efb6c 100644
--- a/sbin/clri/clri.c
+++ b/sbin/clri/clri.c
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
sbp = (struct fs *)sblock;
if ((sbp->fs_magic == FS_UFS1_MAGIC ||
(sbp->fs_magic == FS_UFS2_MAGIC &&
- sbp->fs_sblockloc == numfrags(sbp, sblock_try[i]))) &&
+ sbp->fs_sblockloc == sblock_try[i])) &&
sbp->fs_bsize <= MAXBSIZE &&
sbp->fs_bsize >= (int)sizeof(struct fs))
break;
diff --git a/sbin/dump/main.c b/sbin/dump/main.c
index f4f108b76f53..bc45eaef58fb 100644
--- a/sbin/dump/main.c
+++ b/sbin/dump/main.c
@@ -350,8 +350,7 @@ main(int argc, char *argv[])
bread(sblock_try[i] >> dev_bshift, (char *) sblock, SBLOCKSIZE);
if ((sblock->fs_magic == FS_UFS1_MAGIC ||
(sblock->fs_magic == FS_UFS2_MAGIC &&
- sblock->fs_sblockloc ==
- numfrags(sblock, sblock_try[i]))) &&
+ sblock->fs_sblockloc == sblock_try[i])) &&
sblock->fs_bsize <= MAXBSIZE &&
sblock->fs_bsize >= sizeof(struct fs))
break;
diff --git a/sbin/dumpfs/dumpfs.c b/sbin/dumpfs/dumpfs.c
index f0c21d397183..9d5c209e1fe5 100644
--- a/sbin/dumpfs/dumpfs.c
+++ b/sbin/dumpfs/dumpfs.c
@@ -130,7 +130,7 @@ dumpfs(const char *name)
time = afs.fs_time;
printf("magic\t%x (UFS2)\ttime\t%s",
afs.fs_magic, ctime(&time));
- printf("offset\t%qd\tid\t[ %x %x ]\n",
+ printf("superblock location\t%qd\tid\t[ %x %x ]\n",
afs.fs_sblockloc, afs.fs_id[0], afs.fs_id[1]);
printf("ncg\t%d\tsize\t%qd\tblocks\t%d\n",
afs.fs_ncg, fssize, afs.fs_dsize);
diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c
index 60b455bca2da..0ce866306d1c 100644
--- a/sbin/fsck_ffs/fsutil.c
+++ b/sbin/fsck_ffs/fsutil.c
@@ -296,9 +296,9 @@ ckfini(int markclean)
}
flush(fswritefd, &sblk);
if (havesb && cursnapshot == 0 && sblock.fs_magic == FS_UFS2_MAGIC &&
- sblk.b_bno != fsbtodb(&sblock, sblock.fs_sblockloc) &&
+ sblk.b_bno != sblock.fs_sblockloc / dev_bsize &&
!preen && reply("UPDATE STANDARD SUPERBLOCK")) {
- sblk.b_bno = fsbtodb(&sblock, sblock.fs_sblockloc);
+ sblk.b_bno = sblock.fs_sblockloc / dev_bsize;
sbdirty();
flush(fswritefd, &sblk);
}
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c
index db9feb0874e5..87927dcaa950 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -313,8 +313,7 @@ readsb(int listerr)
return (0);
if ((sblock.fs_magic == FS_UFS1_MAGIC ||
(sblock.fs_magic == FS_UFS2_MAGIC &&
- sblock.fs_sblockloc ==
- numfrags(&sblock, sblock_try[i]))) &&
+ sblock.fs_sblockloc == sblock_try[i])) &&
sblock.fs_ncg >= 1 &&
sblock.fs_bsize >= MINBSIZE &&
sblock.fs_bsize >= sizeof(struct fs))
diff --git a/sbin/fsirand/fsirand.c b/sbin/fsirand/fsirand.c
index a4d922b84443..7b6274fb64e7 100644
--- a/sbin/fsirand/fsirand.c
+++ b/sbin/fsirand/fsirand.c
@@ -152,8 +152,7 @@ fsirand(char *device)
}
if ((sblock->fs_magic == FS_UFS1_MAGIC ||
(sblock->fs_magic == FS_UFS2_MAGIC &&
- sblock->fs_sblockloc ==
- numfrags(sblock, sblock_try[i]))) &&
+ sblock->fs_sblockloc == sblock_try[i])) &&
sblock->fs_bsize <= MAXBSIZE &&
sblock->fs_bsize >= sizeof(struct fs))
break;
diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c
index 368fa99b54ad..a9719ae3b977 100644
--- a/sbin/growfs/growfs.c
+++ b/sbin/growfs/growfs.c
@@ -2048,8 +2048,7 @@ main(int argc, char **argv)
rdfs(sblockloc, (size_t)SBLOCKSIZE, (void *)&(osblock), fsi);
if ((osblock.fs_magic == FS_UFS1_MAGIC ||
(osblock.fs_magic == FS_UFS2_MAGIC &&
- osblock.fs_sblockloc ==
- numfrags(&osblock, sblock_try[i]))) &&
+ osblock.fs_sblockloc == sblock_try[i])) &&
osblock.fs_bsize <= MAXBSIZE &&
osblock.fs_bsize >= sizeof(struct fs))
break;
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c
index 2de9b43ffe9a..837f608d2855 100644
--- a/sbin/newfs/mkfs.c
+++ b/sbin/newfs/mkfs.c
@@ -149,6 +149,7 @@ mkfs(struct partition *pp, char *fsys)
exit(38);
}
bzero(iobuf, iobufsize);
+ sblock.fs_old_flags = FS_FLAGS_UPDATED;
sblock.fs_flags = 0;
if (Uflag)
sblock.fs_flags |= FS_DOSOFTDEP;
@@ -243,7 +244,7 @@ mkfs(struct partition *pp, char *fsys)
sblock.fs_size = fssize = dbtofsb(&sblock, fssize);
if (Oflag == 1) {
sblock.fs_magic = FS_UFS1_MAGIC;
- sblock.fs_sblockloc = numfrags(&sblock, SBLOCK_UFS1);
+ sblock.fs_sblockloc = SBLOCK_UFS1;
sblock.fs_nindir = sblock.fs_bsize / sizeof(ufs1_daddr_t);
sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs1_dinode);
sblock.fs_maxsymlinklen = ((NDADDR + NIADDR) *
@@ -263,15 +264,15 @@ mkfs(struct partition *pp, char *fsys)
sblock.fs_old_nrpos = 1;
} else {
sblock.fs_magic = FS_UFS2_MAGIC;
- sblock.fs_sblockloc = numfrags(&sblock, SBLOCK_UFS2);
+ sblock.fs_sblockloc = SBLOCK_UFS2;
sblock.fs_nindir = sblock.fs_bsize / sizeof(ufs2_daddr_t);
sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs2_dinode);
sblock.fs_maxsymlinklen = ((NDADDR + NIADDR) *
sizeof(ufs2_daddr_t));
}
sblock.fs_sblkno =
- roundup(howmany(lfragtosize(&sblock, sblock.fs_sblockloc) +
- SBLOCKSIZE, sblock.fs_fsize), sblock.fs_frag);
+ roundup(howmany(sblock.fs_sblockloc + SBLOCKSIZE, sblock.fs_fsize),
+ sblock.fs_frag);
sblock.fs_cblkno = sblock.fs_sblkno +
roundup(howmany(SBLOCKSIZE, sblock.fs_fsize), sblock.fs_frag);
sblock.fs_iblkno = sblock.fs_cblkno + sblock.fs_frag;
@@ -476,8 +477,7 @@ mkfs(struct partition *pp, char *fsys)
sblock.fs_old_cstotal.cs_nifree = sblock.fs_cstotal.cs_nifree;
sblock.fs_old_cstotal.cs_nffree = sblock.fs_cstotal.cs_nffree;
}
- wtfs(lfragtosize(&sblock, sblock.fs_sblockloc) / sectorsize,
- SBLOCKSIZE, (char *)&sblock);
+ wtfs(sblock.fs_sblockloc / sectorsize, SBLOCKSIZE, (char *)&sblock);
for (i = 0; i < sblock.fs_cssize; i += sblock.fs_bsize)
wtfs(fsbtodb(&sblock, sblock.fs_csaddr + numfrags(&sblock, i)),
sblock.fs_cssize - i < sblock.fs_bsize ?
diff --git a/sbin/quotacheck/quotacheck.c b/sbin/quotacheck/quotacheck.c
index 4c2aa23fc538..88f042e02b09 100644
--- a/sbin/quotacheck/quotacheck.c
+++ b/sbin/quotacheck/quotacheck.c
@@ -291,8 +291,7 @@ chkquota(fsname, mntpt, qnp)
bread(sblock_try[i], (char *)&sblock, (long)SBLOCKSIZE);
if ((sblock.fs_magic == FS_UFS1_MAGIC ||
(sblock.fs_magic == FS_UFS2_MAGIC &&
- sblock.fs_sblockloc ==
- numfrags(&sblock, sblock_try[i]))) &&
+ sblock.fs_sblockloc == sblock_try[i])) &&
sblock.fs_bsize <= MAXBSIZE &&
sblock.fs_bsize >= sizeof(struct fs))
break;
diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c
index 8b7f5db6539a..5256474bcd5e 100644
--- a/sbin/tunefs/tunefs.c
+++ b/sbin/tunefs/tunefs.c
@@ -404,7 +404,7 @@ getsb(fs, file)
err(4, "%s: bad super block", file);
if ((fs->fs_magic == FS_UFS1_MAGIC ||
(fs->fs_magic == FS_UFS2_MAGIC &&
- fs->fs_sblockloc == numfrags(fs, sblock_try[i]))) &&
+ fs->fs_sblockloc == sblock_try[i])) &&
fs->fs_bsize <= MAXBSIZE &&
fs->fs_bsize >= sizeof(struct fs))
break;