🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #16703

Re: makehistory -buv never finishes on an Alpha?

#16703
From: Frank Durda IV
Date: Fri, 04 Apr 1997 00:00
117 lines
4647 bytes
Brian O'Neill wrote:
> Hmm...my dbz file doesn't appear to be sparse:
> 
> 187328 -rw-rw-r--   1 news     news     191715937 Apr  4 12:59 history
>      1 -rw-rw-r--   1 news     news           151 Apr  4 12:59 history.dir
>  47200 -rw-rw-r--   1 news     news      48299144 Apr  4 12:59 history.pag

Um, the .pag file *is* a sparse file.  It is a DBZ file.  There should be
some places in it where data has never been written, usually entire
blocks.  Unless completely populated, history.pag should be using less
actual disk space than the 48,299,144 bytes claimed.


FYI, if you don't want to try it by reconstructing your history.dir and .pag
files (we know these are the culprits because we commented out the code
that writes these two files and the problem goes away),  you can try this
test program we gave to DEC.  It demonstrates the bug on four different
Alphas we have around here, including a little tiny Alpha 800 and a big 
3CPU275MHz 2100 with 512M.   UFS file systems are the key.

This program will run you out of disk space if you let it run long enough,
but you should see the bug within two or three minutes if  it is going
to fail for you.


/*      C970207-XXXX Sample Program #2                  27-Feb-97
	(Complete DEC open ticket number omitted)

        killit.c

        To run and fail , find some free space and type ./killit

        To see it not fail, use the command ./killit good

        This program does a general mimic of the types of disk
        writes that expire and writehistory do to the history.pag file.
	You MUST be on a UFS filesystem to see the problem.

        With the occasional fsync on the file, the system lockup is
        averted.
*/

#include <sys/types.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/ioctl.h>

#define BLOCKS  (1024*1024*1024)
#define nwrites 10000

#define GOOD 0
#define EVIL 1

main(c, a )
int c;
char *a[];
{
        int x, y, cnt=0;
        int itr=0;
        int fd, state=EVIL;

        time_t now, then;
        char buf[8];

        if (c>1)
                if (!strcmp(a[1], "good"))
                        state = GOOD;


        printf("Mode: %s\n", state ? "EVIL" : "GOOD") ;

        if ((fd=open("testdb", O_CREAT | O_TRUNC | O_RDWR, 0666)) < 0) {
                perror("testdb");
                exit(-1);
        }
        time(&now);
        then=now;
        for (x=0;x<BLOCKS/2;x+= 512)
                for(y=BLOCKS;y>BLOCKS/2;y -= 512, cnt++) {
                        if (cnt % nwrites == 0) {
                                time(&now);
                                printf("%d writes took %d seconds, itr #%d\n", n
writes, now-then, itr++);
                                then=now;
                                if (state == GOOD);
                                        fsync(fd);

                        }
                        if (lseek(fd, 0, 0) == -1) {
                                perror("lseek0");
                                exit(1);
                        }

                        if (write(fd, buf, sizeof(buf)) != sizeof(buf)) {
                                perror("write0");
                        }
                        lseek(fd, x, 0);
                        if (write(fd, buf, sizeof(buf)) != sizeof(buf)) {
                                perror("write1");
                        }
                        lseek(fd, y, 0);
                        if (write(fd, buf, sizeof(buf)) != sizeof(buf)) {
                                perror("write2");
                        }
                }

}


Frank Durda IV <uhclem@nemesis.lonestar.org>|"I'm sorry Dave, but I have
or uhclem%nemesis@rwsystr.nkn.net | deleted Windows '95 from the entire system."
                                  | - What A. C. Clarke claims he would have
or ...letni!rwsys!nemesis!uhclem  | HAL say if he was writing 2001 today.
(c) 1997, ask before reprinting.

Technical Details
Message-ID: <33456B0B.4487EB71@nemesis.lonestar.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <3342AAF9.41C6@staff.uml.edu> <3342CC9A.FF6D5DF@nemesis.lonestar.org> <334542F3.41C6@staff.uml.edu>

Show Full Headers
Complete Article Headers
Message-ID: <33456B0B.4487EB71@nemesis.lonestar.org>
Subject: Re: makehistory -buv never finishes on an Alpha?
Date: Fri, 04 Apr 1997 00:00:00 +0000
From: Frank Durda IV <uhclem@nemesis.lonestar.org>
References: <3342AAF9.41C6@staff.uml.edu> <3342CC9A.FF6D5DF@nemesis.lonestar.org> <334542F3.41C6@staff.uml.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 230741630
Organization: The Big Blue Box B
Newsgroups: news.software.nntp