Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 08 Jan 2002 15:52:48 +0000
From:      Ian Dowse <iedowse@maths.tcd.ie>
To:        Sheldon Hearn <sheldonh@starjuice.net>
Cc:        Ian Dowse <iedowse@maths.tcd.ie>, John Baldwin <jhb@FreeBSD.org>, Wilko Bulte <wkb@freebie.xs4all.nl>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/release/sysinstall install.c 
Message-ID:   <200201081552.aa79631@salmon.maths.tcd.ie>
In-Reply-To: Your message of "Tue, 08 Jan 2002 11:57:03 %2B0200." <47888.1010483823@axl.seasidesoftware.co.za> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <47888.1010483823@axl.seasidesoftware.co.za>, Sheldon Hearn writes:
>Okay, now you're scaring me.
>
>What should I do?  Should I leave the new newfs defaults intact for
>4.5-RC1 so we can get feedback, or should I just back out the newfs
>defaults changes and play it safe for 4.5-RELEASE?

I'm not sure, but something needs to be done before 4.5 anyway. The
following patch should address the i386 issue. It's not ideal, but
it removes the hard-coded block size, and should deal with the case
where you access different filesystems with different block sizes
from boot2.

I'll have a look at the alpha code shortly to see if something
similar can be done. Maybe there we can just increase the BUFSIZE
definition to 32k?

Ian

Index: i386/boot2/boot2.c
===================================================================
RCS file: /dump/FreeBSD-CVS/src/sys/boot/i386/boot2/boot2.c,v
retrieving revision 1.33
diff -u -r1.33 boot2.c
--- i386/boot2/boot2.c	23 Oct 2001 20:27:05 -0000	1.33
+++ i386/boot2/boot2.c	8 Jan 2002 15:42:32 -0000
@@ -57,7 +57,6 @@
 
 #define ARGS		0x900
 #define NOPT		11
-#define BSIZEMAX	8192
 #define NDEV		5
 #define MEM_BASE	0x12
 #define MEM_EXT 	0x15
@@ -102,6 +101,7 @@
     unsigned start;
     int init;
     int meta;
+    int maxfsblks;
 } dsk;
 static char cmd[512];
 static char kname[1024];
@@ -518,7 +518,7 @@
 {
     static struct fs fs;
     static struct dinode din;
-    static char *blkbuf;
+    static char *blkbuf, *sbbuf;
     static ufs_daddr_t *indbuf;
     static ino_t inomap;
     static ufs_daddr_t blkmap, indmap;
@@ -528,17 +528,22 @@
     size_t n, nb, off;
 
     if (!dsk.meta) {
-	if (!blkbuf)
-	    blkbuf = malloc(BSIZEMAX);
+	if (!sbbuf)
+	    sbbuf = malloc(SBSIZE);
 	inomap = 0;
-	if (dskread(blkbuf, SBOFF / DEV_BSIZE, SBSIZE / DEV_BSIZE))
+	if (dskread(sbbuf, SBOFF / DEV_BSIZE, SBSIZE / DEV_BSIZE))
 	    return -1;
-	memcpy(&fs, blkbuf, sizeof(fs));
+	memcpy(&fs, sbbuf, sizeof(fs));
 	if (fs.fs_magic != FS_MAGIC) {
 	    printf("Not ufs\n");
 	    return -1;
 	}
 	fsblks = fs.fs_bsize >> DEV_BSHIFT;
+	if (fsblks > dsk.maxfsblks) {
+	    blkbuf = malloc(fs.fs_bsize);
+	    indbuf = malloc(fs.fs_bsize);
+	    dsk.maxfsblks = fsblks;
+	}
 	dsk.meta++;
     }
     if (!inode)
@@ -562,8 +567,6 @@
 	    addr = din.di_db[lbn];
 	else {
 	    if (indmap != din.di_ib[0]) {
-		if (!indbuf)
-		    indbuf = malloc(BSIZEMAX);
 		if (dskread(indbuf, fsbtodb(&fs, din.di_ib[0]),
 			    fsblks))
 		    return -1;

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi? <200201081552.aa79631>