From owner-freebsd-current Sun Jul 7 4:27:40 2002 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 EFBBB37B400; Sun, 7 Jul 2002 04:27:35 -0700 (PDT) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by mx1.FreeBSD.org (Postfix) with SMTP id 6AA8E43E31; Sun, 7 Jul 2002 04:27:34 -0700 (PDT) (envelope-from iedowse@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 7 Jul 2002 12:27:33 +0100 (BST) To: Don Lewis Cc: Georg.Koltermann@mscsoftware.com, obrien@FreeBSD.ORG, current@FreeBSD.ORG, mckusick@mckusick.com Subject: Re: dump(8) is hosed In-Reply-To: Your message of "Sat, 06 Jul 2002 21:57:24 PDT." <200207070458.g674wI0M021931@gw.catspoiler.org> Date: Sun, 07 Jul 2002 12:27:31 +0100 From: Ian Dowse Message-ID: <200207071227.aa27815@salmon.maths.tcd.ie> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <200207070458.g674wI0M021931@gw.catspoiler.org>, Don Lewis writes: > >I was finally finally able to reproduce this by creating a large file >before doing the dump. Dump(8) is *very* hosed. The UFS2 import broke >it's ability to follow multiple levels of indirect blocks. Thanks for tracking this down! One thing is that the code was using the static pointers to avoid having to malloc and free blocks every time. Keeping an array of NIADDR pointers and using `ind_level' as the index is an alternative (patch below) - I doubt the performance difference is noticable but it avoids having to remember the free() before each return. I'll commit your printf format changes first anyway - thanks! Ian Index: traverse.c =================================================================== RCS file: /dump/FreeBSD-CVS/src/sbin/dump/traverse.c,v retrieving revision 1.19 diff -u -r1.19 traverse.c --- traverse.c 21 Jun 2002 06:17:57 -0000 1.19 +++ traverse.c 7 Jul 2002 10:44:55 -0000 @@ -275,10 +275,13 @@ { int ret = 0; int i; - static caddr_t idblk; + static caddr_t idblks[NIADDR]; + caddr_t idblk; - if (idblk == NULL && (idblk = malloc(sblock->fs_bsize)) == NULL) + if (idblks[ind_level] == NULL && + (idblks[ind_level] = malloc(sblock->fs_bsize)) == NULL) quit("dirindir: cannot allocate indirect memory.\n"); + idblk = idblks[ind_level]; bread(fsbtodb(sblock, blkno), idblk, (int)sblock->fs_bsize); if (ind_level <= 0) { for (i = 0; *filesize > 0 && i < NINDIR(sblock); i++) { @@ -501,10 +505,13 @@ dmpindir(ino_t ino, ufs2_daddr_t blk, int ind_level, off_t *size) { int i, cnt; - static caddr_t idblk; + static caddr_t idblks[NIADDR]; + caddr_t idblk; - if (idblk == NULL && (idblk = malloc(sblock->fs_bsize)) == NULL) + if (idblks[ind_level] == NULL && + (idblks[ind_level] = malloc(sblock->fs_bsize)) == NULL) quit("dmpindir: cannot allocate indirect memory.\n"); + idblk = idblks[ind_level]; if (blk != 0) bread(fsbtodb(sblock, blk), idblk, (int) sblock->fs_bsize); else To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message