Re: HEADS UP: UFS2 now the default creation type on 5.0-CURRENT

From: David Schultz <das_at_FreeBSD.org>
Date: Mon, 21 Apr 2003 03:23:41 -0700
On Sun, Apr 20, 2003, Robert Watson wrote:
> 
> On Sun, 20 Apr 2003, David Schultz wrote:
> 
> > On Sun, Apr 20, 2003, David O'Brien wrote:
> > > On Sun, Apr 20, 2003 at 11:31:21AM -0400, Robert Watson wrote:
> > > > There were initially some size glitches because UFS2 required additional
> > > > 64-bit operations in the boot record, and that exceeded the space at the
> > > > front of the file system, but I believe that has now been resolved.
> > > 
> > > s/resolved/hacked around/
> > [...]
> > > revision 1.10
> > > date: 2003-02-24 04:57:01;  author: mckusick;  state: Exp;  lines: +2 -0
> > > Revert to old (broken for over 1.5Tb filesystems) version of cgbase
> > > so that boot loader once again will fit.
> > 
> > It might be worth noting the size limit on the root filesystem somewhere
> > for the unfortunate person who decides not to partition. 
> 
> Clarification question: is it only the size of the root file system that
> is limited, or is it also the location of the root file system on the
> disk?

The cgbase hack should only limit the size of the filesystem, not
the disk location.  It occurs to me that with a little more
hackery, we can avoid the limitation entirely.  If we revert to
the 64-bit cgbase() and un-inline it, boot2 goes from 19 bytes
available to -9 bytes.  Add a kludge to factor out a few 64-bit
multiply-adds and we're back to 3 bytes available.  (I'm sure
there are cleaner ways to save 9 bytes.)  An untested unpolished
diff follows.

Index: ufsread.c
===================================================================
RCS file: /cvs/src/sys/boot/common/ufsread.c,v
retrieving revision 1.11
diff -u -r1.11 ufsread.c
--- ufsread.c	25 Feb 2003 00:10:20 -0000	1.11
+++ ufsread.c	21 Apr 2003 10:10:01 -0000
_at__at_ -32,8 +32,20 _at__at_
 /* XXX: Revert to old (broken for over 1.5Tb filesystems) version of cgbase
    (see sys/ufs/ffs/fs.h rev 1.39) so that i386 boot loader (boot2) can
    support both UFS1 and UFS2 again. */
+ufs2_daddr_t
+__cgbase(struct fs *fs, int32_t c)
+{
+	return cgbase(fs, c);
+}
 #undef cgbase
-#define cgbase(fs, c)   ((ufs2_daddr_t)((fs)->fs_fpg * (c)))
+#define	cgbase	__cgbase
+
+ufs2_daddr_t
+ma(uint32_t a, uint32_t b, ufs2_daddr_t c)
+{
+	return ((ufs2_daddr_t)a * b) + c;
+}
+
 #endif
 
 /*
_at__at_ -47,11 +59,11 _at__at_
 #define INDIRPERVBLK(fs) (NINDIR(fs) / ((fs)->fs_bsize >> VBLKSHIFT))
 #define IPERVBLK(fs)	(INOPB(fs) / ((fs)->fs_bsize >> VBLKSHIFT))
 #define INO_TO_VBA(fs, ipervblk, x) \
-    (fsbtodb(fs, cgimin(fs, ino_to_cg(fs, x))) + \
-    (((x) % (fs)->fs_ipg) / (ipervblk) * DBPERVBLK))
+	ma(((x) % (fs)->fs_ipg) / (ipervblk),  DBPERVBLK, \
+	fsbtodb(fs, cgimin(fs, ino_to_cg(fs, x))))
 #define INO_TO_VBO(ipervblk, x) ((x) % ipervblk)
-#define FS_TO_VBA(fs, fsb, off) (fsbtodb(fs, fsb) + \
-    ((off) / VBLKSIZE) * DBPERVBLK)
+#define FS_TO_VBA(fs, fsb, off)	ma((off) / VBLKSIZE, DBPERVBLK, \
+	fsbtodb((fs), (fsb)))
 #define FS_TO_VBO(fs, fsb, off) ((off) & VBLKMASK)
 
 /* Buffers that must not span a 64k boundary. */
Received on Mon Apr 21 2003 - 01:23:50 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:04 UTC