Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!pcrat!rick From: rick@pcrat.uucp (Rick Richardson) Newsgroups: comp.sources.d Subject: Re: v08i093: System V disk compactor Summary: Patches to Rick Richardson's version Keywords: packdisk, pcc patches, 80286 patches, performance improvment Message-ID: <1989Oct17.073932.640@pcrat.uucp> Date: 17 Oct 89 07:39:32 GMT References: <69626@uunet.UU.NET> <1383@rebel.UUCP> <1989Oct14.130123.1067@pcrat.uucp> <1989Oct15.073237.2472@pcrat.uucp> Reply-To: rick@pcrat.UUCP (Rick Richardson) Organization: PC Research, Inc., Tinton Falls, NJ Lines: 203 In article <1989Oct15.073237.2472@pcrat.uucp> rick@pcrat.UUCP (Rick Richardson) writes: > >I fixed the stuff for 16 bit machines, Venix/286 filesystems, and >made a performance enhancement.... It turned out that the free list tweak I made for Venix/286 wasn't portable. So I've made it a compile time option. It wouldn't cause any damage, since fsck is perfectly capable of building a clean free list. It also turned out that I missed defining "MB" when SMALL is not defined. The definition was obvious: "#define MB(BLN) BLN". Here is a context diff for "patch" to fix these minor glitches. Apply it to _my_ version posted to comp.sources.d, not to the original source. Also, a couple of people have complained that I didn't post my version to comp.sources.misc. Hey, that's not my job! Its up to the original author to post the changed ("final") version for posterity. My version is mearly a "suggestion". If the author fails to complete his duties within several months, *then and only then* I'd consider posting my changed version to comp.sources.misc for archiving. -Rick *** old/Makefile Tue Oct 17 03:10:29 1989 --- Makefile Tue Oct 17 03:20:42 1989 *************** *** 1,3 #CC = gcc -Wall CC = cc CFLAGS = -O # System V on 32 bit machine with function prototypes compiler --- 1,13 ----- + # + # Makefile for packdisk + # Options: + # -DOLDC Compiler doesn't have function prototypes + # -DSMALL Machine is 16 bit (80286) + # -DSHORTFREE UNIX (e.g. Venix.286) stores the number + # of free block numbers in free disk blocks + # as a short instead of a long (despite what + # the fs(4) manual says). + # #CC = gcc -Wall CC = cc CFLAGS = -O # System V on 32 bit machine with function prototypes compiler *************** *** 1,6 #CC = gcc -Wall CC = cc CFLAGS = -O # System V on 32 bit machine with function prototypes compiler CFLAGS = -O -DOLDC # System V on 32 bit machine without function prototypes CFLAGS = -Ml -DSMALL -DOLDC -O # Venix/286 LINTFLAGS = -DSMALL -DOLDC # Venix/286 --- 11,17 ----- #CC = gcc -Wall CC = cc CFLAGS = -O # System V on 32 bit machine with function prototypes compiler + CFLAGS = -Ml -DSMALL -DOLDC -DSHORTFREE -O # Venix/286 CFLAGS = -O -DOLDC # System V on 32 bit machine without function prototypes LINTFLAGS = -DSMALL -DOLDC # Venix/286 *************** *** 2,8 CC = cc CFLAGS = -O # System V on 32 bit machine with function prototypes compiler CFLAGS = -O -DOLDC # System V on 32 bit machine without function prototypes ! CFLAGS = -Ml -DSMALL -DOLDC -O # Venix/286 LINTFLAGS = -DSMALL -DOLDC # Venix/286 LDFLAGS = # -shlib --- 13,19 ----- CFLAGS = -O # System V on 32 bit machine with function prototypes compiler CFLAGS = -Ml -DSMALL -DOLDC -DSHORTFREE -O # Venix/286 CFLAGS = -O -DOLDC # System V on 32 bit machine without function prototypes ! LINTFLAGS = -DSMALL -DOLDC # Venix/286 LDFLAGS = # -shlib *** old/packdisk.c Tue Oct 17 03:10:33 1989 --- packdisk.c Tue Oct 17 03:25:30 1989 *************** *** 17,23 * the speedup, I estimated that the program would take 60 hours * to run in my environment. It now takes 3 hours, and could be * improved even more. Look for "RERSPEEDUP" below. The speedup ! * invloves using a reference count to decide whether the block * map needs to be scanned for indirect block references. When * -DSMALL is defined, the filesystem size is limited to 128K * 1024 byte blocks. These changes worked for me, and should --- 17,23 ----- * the speedup, I estimated that the program would take 60 hours * to run in my environment. It now takes 3 hours, and could be * improved even more. Look for "RERSPEEDUP" below. The speedup ! * involves using a reference count to decide whether the block * map needs to be scanned for indirect block references. When * -DSMALL is defined, the filesystem size is limited to 128K * 1024 byte blocks. These changes worked for me, and should *************** *** 27,32 * Rick Richardson * 14 October 1989 * uunet!pcrat!rick */ #ifndef OLDC --- 27,42 ----- * Rick Richardson * 14 October 1989 * uunet!pcrat!rick + * + * It turned out that the change I made to handle Venix's weirdness + * with the s_nfree field (in free disk blocks only) wasn't portable. + * I added a compile time option to handle it, -DSHORTFREE. Most + * UNIXes won't need it. I also added the missing "MB" macro for + * when -DSMALL isn't supplied. + * Rick Richardson + * 17 October 1989 + * uunet!pcrat!rick + * */ #ifndef OLDC *************** *** 80,85 /* reference count for block number (RERSPEEDUP) */ #else #define MAXINT 2147483647 /* Size of an integer */ long *map; /* a map from block numbers to referencing inode/indir block */ int *ref; /* a map from block numbers to referencing inode/indir block */ #endif --- 90,96 ----- /* reference count for block number (RERSPEEDUP) */ #else #define MAXINT 2147483647 /* Size of an integer */ + #define MB(BLN) BLN long *map; /* a map from block numbers to referencing inode/indir block */ int *ref; /* a map from block numbers to referencing inode/indir block */ #endif *************** *** 651,657 for (block = filsys.s_fsize - 1; block >= next_fill; --block) { if (nfree == NICFREE) { ! if (sizeof(filsys.s_nfree) == sizeof(short)) { /* Venix/286 has a short s_nfree member */ ((short *)buf)[0] = nfree; (void) memcpy((char *) (&((short *)buf)[1]), --- 662,668 ----- for (block = filsys.s_fsize - 1; block >= next_fill; --block) { if (nfree == NICFREE) { ! # ifdef SHORTFREE { /* Venix/286 has a short s_nfree member */ ((short *)buf)[0] = nfree; (void) memcpy((char *) (&((short *)buf)[1]), *************** *** 657,663 (void) memcpy((char *) (&((short *)buf)[1]), (char *) free, sizeof(free)); } ! else { /* The usual case for System V */ ((daddr_t *)buf)[0] = nfree; (void) memcpy((char *) (&((daddr_t *)buf)[1]), --- 668,674 ----- (void) memcpy((char *) (&((short *)buf)[1]), (char *) free, sizeof(free)); } ! # else { /* The usual case for System V */ ((daddr_t *)buf)[0] = nfree; (void) memcpy((char *) (&((daddr_t *)buf)[1]), *************** *** 663,668 (void) memcpy((char *) (&((daddr_t *)buf)[1]), (char *) free, sizeof(free)); } write_block(block, buf); nfree = 0; (void) memset((char *) free, 0, sizeof(free)); --- 674,680 ----- (void) memcpy((char *) (&((daddr_t *)buf)[1]), (char *) free, sizeof(free)); } + # endif write_block(block, buf); nfree = 0; (void) memset((char *) free, 0, sizeof(free)); -- Rick Richardson | Looking for FAX software for UNIX/386 ?????? mention PC Research,Inc.| WE'RE SHIPPING your uunet!pcrat!rick| Ask about FaxiX - UNIX Facsimile System (tm) FAX # (201) 389-8963 | Or JetRoff - troff postprocessor for the HP {Laser,Desk}Jet