From owner-freebsd-current@FreeBSD.ORG Mon Apr 21 03:23:50 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 49A8737B404; Mon, 21 Apr 2003 03:23:50 -0700 (PDT) Received: from HAL9000.homeunix.com (12-233-57-131.client.attbi.com [12.233.57.131]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4322E43FB1; Mon, 21 Apr 2003 03:23:45 -0700 (PDT) (envelope-from das@FreeBSD.org) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.9/8.12.5) with ESMTP id h3LANgjC003558; Mon, 21 Apr 2003 03:23:42 -0700 (PDT) (envelope-from das@FreeBSD.org) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.9/8.12.5/Submit) id h3LANfad003557; Mon, 21 Apr 2003 03:23:41 -0700 (PDT) (envelope-from das@FreeBSD.org) Date: Mon, 21 Apr 2003 03:23:41 -0700 From: David Schultz To: Robert Watson Message-ID: <20030421102341.GA3482@HAL9000.homeunix.com> Mail-Followup-To: Robert Watson , David O'Brien , Manfred Antar , current@FreeBSD.org References: <20030420192319.GB4963@HAL9000.homeunix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: cc: current@FreeBSD.org cc: David O'Brien Subject: Re: HEADS UP: UFS2 now the default creation type on 5.0-CURRENT X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Apr 2003 10:23:50 -0000 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 @@ -32,8 +32,20 @@ /* 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 /* @@ -47,11 +59,11 @@ #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. */