MFC r266930,r289225:
r266930 (by jmg): convert to using the _daddr_t types like newfs was... Put the superblock in the correct possition for UFS2... There is a bug in FFS that if we don't put it here (for UFS2), it will forcefully relocate the superblock, and I believe cause data loss.. I have a fix for that, but w/ how many releases are broken, we won't be able to switch to the better _FLOPPY (block 0) for this for a while.. r289225 (by sbruno): makefs(8) leaves sblock.fs_providersize uninitialized (zero) that can be easily checked with dumpfs(8). This may lead to other problems, f.e. geom_label kernel module sanity checks do not like zero fs_old_size value and skips such UFS1 file system while tasting (fs_old_size derives from sblock.fs_providersize). PR: 203704 Submitted by: eugen@grosbein.net Reviewed by: marcel
This commit is contained in:
parent
5af653d140
commit
f1478935ff
@ -248,15 +248,16 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts)
|
||||
exit(21);
|
||||
}
|
||||
sblock.fs_fsbtodb = ilog2(sblock.fs_fsize / sectorsize);
|
||||
sblock.fs_size = fssize = dbtofsb(&sblock, fssize);
|
||||
sblock.fs_size = sblock.fs_providersize = fssize =
|
||||
dbtofsb(&sblock, fssize);
|
||||
|
||||
if (Oflag <= 1) {
|
||||
sblock.fs_magic = FS_UFS1_MAGIC;
|
||||
sblock.fs_sblockloc = SBLOCK_UFS1;
|
||||
sblock.fs_nindir = sblock.fs_bsize / sizeof(int32_t);
|
||||
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) *
|
||||
sizeof (int32_t));
|
||||
sizeof (ufs1_daddr_t));
|
||||
sblock.fs_old_inodefmt = FS_44INODEFMT;
|
||||
sblock.fs_old_cgoffset = 0;
|
||||
sblock.fs_old_cgmask = 0xffffffff;
|
||||
@ -272,15 +273,11 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts)
|
||||
sblock.fs_old_nrpos = 1;
|
||||
} else {
|
||||
sblock.fs_magic = FS_UFS2_MAGIC;
|
||||
#if 0 /* XXX makefs is used for small filesystems. */
|
||||
sblock.fs_sblockloc = SBLOCK_UFS2;
|
||||
#else
|
||||
sblock.fs_sblockloc = SBLOCK_UFS1;
|
||||
#endif
|
||||
sblock.fs_nindir = sblock.fs_bsize / sizeof(int64_t);
|
||||
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 (int64_t));
|
||||
sizeof (ufs2_daddr_t));
|
||||
}
|
||||
|
||||
sblock.fs_sblkno =
|
||||
|
Loading…
x
Reference in New Issue
Block a user