All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Reiser <reiser@namesys.com>
To: David Dabbs <david@dabbs.net>
Cc: 'ReiserFS List' <reiserfs-list@namesys.com>,
	'Nikita Danilov' <Nikita@namesys.com>,
	'Alexander Zarochentcev' <zam@namesys.com>,
	"'E. Gryaznova'" <grev@namesys.com>
Subject: Re: Was able to reproduce "cp: cannot stat file.x: Input/output error"
Date: Sun, 08 Aug 2004 17:01:49 -0700	[thread overview]
Message-ID: <4116BEED.8050804@namesys.com> (raw)
In-Reply-To: <20040808214432.E3E5715C90@mail03.powweb.com>

David Dabbs wrote:

>  
>
>>-----Original Message-----
>>From: Hans Reiser [mailto:reiser@namesys.com]
>>Sent: Monday, August 09, 2004 1:18 AM
>>To: David Dabbs
>>Cc: 'ReiserFS List'; 'Nikita Danilov'; 'Alexander Zarochentcev'; 'E.
>>Gryaznova'
>>Subject: Re: Was able to reproduce "cp: cannot stat file.x: Input/output
>>error"
>>
>>
>>    
>>
>
>...snip...
>
>  
>
>>Hans:
>>yes, it [hashing] is only a good idea for filenames larger than 15 
>>characters.
>>
>>    
>>
>
>Actually, larger than 7 + 8 + 8 characters, if LARGE_KEY is used.
>
Oh.  Ok.  LARGE_KEY is the only thing that should be used.

> This means
>that no keys were hashed in my tests, or the original mongo for that matter,
>since no file name would have been considered 'large' in kassign.c. I should
>up the file name limit slightly to exercise it with at least some hashed
>keys.
>
>  
>
>>it is extremely unrealistic to create the files in one phase and write
>>to them in the next phase.  the filesystem will behave completely
>>differently.
>>
>>    
>>
>
>Of course. The extra files I added are created once, and should never be
>touched again since mongo only operates on the objects it creates. I am
>simply loading the test filesystem with a reasonable facsimile of a 'normal'
>Linux file set (with the exception that the files are all zero length).
>
a huge exception.  I don't grok what you are trying to do here.

> To
>make these 'static' dirs/files really useful, mongo would need to be written
>to use these directories for its randomly created files. As for my files all
>being zero length, it would be easy to give them all some small file
>content. If these additional dirs/files as currently created add no value to
>the test, then do not enable these phases.
>
>On top of this Mongo randomly creates (in PHASE CREATE) its directories and
>files, with each file filled at creation with a random number of 'a'
>characters. Each subsequent phase, if specified, does one of the following
>operations in the order you see below. Since you said you hadn't looked at
>mongo for some time, I have included the commands mongo executes. These
>examples are from a run with three processes and three iterations, so each
>command below was run three times in succession. Note that mongo drives each
>phase from a file list, so the files are always manipulated in the same
>order - the order in which they were created.
>
>a) COPY command: Copy all files from some base iteration directory.
>(update-flist.pl /mnt/testfs/testdir0-0-0 /mnt/testfs/testdir1-0-0
>/var/tmp/mongo.flist0-0-0 /var/tmp/mongo.flist1-0-0  || touch ERR.file ) &
>(update-flist.pl /mnt/testfs/testdir0-0-1 /mnt/testfs/testdir1-0-1
>/var/tmp/mongo.flist0-0-1 /var/tmp/mongo.flist1-0-1  || touch ERR.file ) &
>(update-flist.pl /mnt/testfs/testdir0-0-2 /mnt/testfs/testdir1-0-2
>/var/tmp/mongo.flist0-0-2 /var/tmp/mongo.flist1-0-2  || touch ERR.file ) &
>wait; sync
>
>
>/*******************************************************************/
>update-flist.pl
>
>($DIR0, $DIR1, $FLIST0, $FLIST1) = @ARGV;
>
>system("cp -r $DIR0 $DIR1");
>
>open(FL0, $FLIST0) || DIE("Cannot open $FLIST0");
>open(FL1, ">$FLIST1") || DIE("Cannot open $FLIST1");
>while (<FL0>) {
>    s|^$DIR0|$DIR1|;
>    print FL1 $_;
>}
>close(FL1);
>close(FL0);
>
>/*******************************************************************/
>
>b) APPEND command: 
>(cat /var/tmp/mongo.flist[01]-0-0 | grep -v -e /\$ | mongo_append 0.5 4096
>off  || touch ERR.file ) & 
>(cat /var/tmp/mongo.flist[01]-0-1 | grep -v -e /\$ | mongo_append 0.5 4096
>off  || touch ERR.file ) & 
>(cat /var/tmp/mongo.flist[01]-0-2 | grep -v -e /\$ | mongo_append 0.5 4096
>off  || touch ERR.file ) &  
>wait; sync
>
>/*******************************************************************/
>mongo_append.c
>
>    while (getline(&line_buffer, &line_buffer_size, stdin) != -1) {
>	int fd, written = 0;
>	char * lf_pos;
>
>        if ((lf_pos = index(line_buffer, '\n')) != NULL) *lf_pos = '\0'; 
>
>	if ( (fd = open(line_buffer,O_RDWR)) == -1) {
>		fprintf(stderr, "%s :", line_buffer);
>		perror("cannot open file");
>		continue;
>	}
>
>	append_size = append_factor * lseek(fd, 0, SEEK_END);
>
>	while (written < append_size) {
>	    int error;
>	    written += (error = write(fd, buffer,
>		( append_size - written < writesize ) ? append_size -
>written:writesize));
>	    if (error == -1) {
>		close(fd);
>		break;
>	    }
>	}
>	if (use_fsync) {
>		if (fsync(fd) < 0) {
>			fprintf(stderr, "%s : failed to fsync file\n",
>line_buffer);
>			exit(1);
>		}
>	}
>	close(fd);
>    }
>    free (buffer);
>    free (line_buffer);
>    return 0;  
>
>/*******************************************************************/
>
>
>c) MODIFY command: 
>(cat /var/tmp/mongo.flist[01]-0-0 | grep -v -e /\$ | mongo_modify 0.02 4096
>off || touch ERR.file ) & 
>(cat /var/tmp/mongo.flist[01]-0-1 | grep -v -e /\$ | mongo_modify 0.02 4096
>off || touch ERR.file ) & 
>(cat /var/tmp/mongo.flist[01]-0-2 | grep -v -e /\$ | mongo_modify 0.02 4096
>off || touch ERR.file ) &  
>wait; sync
>
>/*******************************************************************/
>mongo_modify.c
>
>    while (getline(&line_buffer, &line_buffer_size, stdin) != -1) {
>	int fd;
>	off_t fileend;
>        char * lf_pos;
>       
>        if ((lf_pos = index(line_buffer, '\n')) != NULL) *lf_pos = '\0';
>
>	if ( (fd = open(line_buffer,O_RDWR)) == -1) {
>	    perror("cannot open file");
>	    continue;
>	}
>	fileend = lseek(fd,0,SEEK_END);
>	
>	if (fileend == (off_t) - 1) {
>            perror("lseek failed");
>            close (fd);
>	    continue;
>	} 	
>	if (!fileend) {
>		/* nothing to modify */
>	    close (fd);
>	    continue;
>	} 
>	
>	{
>		off_t region_size = (double)fileend * modify_factor;
>		off_t write_pos = (double)(fileend - region_size) * rand() /
>(RAND_MAX + 1.0);
>		size_t bytes = 0;
>
>		if (lseek(fd, write_pos, SEEK_SET) == (off_t) - 1) {
>				perror("lseek failed");
>				close (fd);
>				continue; 
>		}
>
>		while (bytes < region_size) {
>			size_t write_count = region_size - bytes;
>
>			if (write_count > write_buffer_size) 
>				write_count = write_buffer_size;
>
>			write_count = write(fd, buffer, write_count);
>
>			if (write_count == 0) break;
>
>			if (write_count == -1) {
>				perror("write failed");
>				break;
>			}
>			
>			bytes += write_count;
>		}
>		
>	}
>	if (use_fsync) {
>		if (fsync(fd) < 0) {
>			fprintf(stderr, "%s : failed to fsync file\n",
>line_buffer);
>			exit(1);
>		}
>	}
>	close(fd);
>    }
>    free (buffer);
>    free (line_buffer);
>    return 0;  
>
>/*******************************************************************/
>
>
>d) OVERWRITE command: 
>( cat /var/tmp/mongo.flist[01]-0-0 | grep -v -e /\$ | mongo_modify 1 4096
>off || touch ERR.file ) & 
>( cat /var/tmp/mongo.flist[01]-0-1 | grep -v -e /\$ | mongo_modify 1 4096
>off || touch ERR.file ) & 
>( cat /var/tmp/mongo.flist[01]-0-2 | grep -v -e /\$ | mongo_modify 1 4096
>off || touch ERR.file ) &  
>wait; sync
>
>
>See mongo_modify.c above.
>
>/*******************************************************************/
>
>e) READ command: 
>(find /mnt/testfs/testdir[01]-1-0 -type f | mongo_read || touch ERR.file ) &
>(find /mnt/testfs/testdir[01]-1-1 -type f | mongo_read || touch ERR.file ) &
>(find /mnt/testfs/testdir[01]-1-2 -type f | mongo_read || touch ERR.file ) &
>wait; sync
>
>/*******************************************************************/
>mongo_read.c
>
>	/* Read all file names from the standard input */ 
>	while ((rd = getline(&file_name_buf, &file_name_buf_size, stdin)) !=
>-1) {   
>
>		/* remove the new line character. */
>		if (rd > 0 && file_name_buf[rd - 1] == '\n')
>			file_name_buf[rd - 1] = 0;
>
>		/* open the file */ 
>		fd = open (file_name_buf, O_RDONLY);
>		if (fd == -1) {
>			fprintf (stderr, "Open failed (%s)\n", strerror
>(errno));
>			return errno;
>		}
>
>		/* read the file */
>		while (1) {
>			rd = read (fd, read_buf, bufsize);
>			if (rd == -1) {
>				fprintf (stderr, "Read failed (%s)\n",
>strerror (errno));
>				return errno;
>			}
>			if (rd == 0)
>				break; /* EOF */
>
>			/* file consists of 'a'. Check that */
>			if (char_to_check) {
>				int j;
>				for (j = 0; j < rd; j ++)
>					if (read_buf[j] != char_to_check) {
>						fprintf (stderr, "Incorrect
>data were read\n");
>						return EIO;
>				}
>			}
>		}
>		close (fd);
>	}
>
>	if (file_name_buf)
>		free(file_name_buf);
>	free (read_buf);
>	snapstats();
>	return 0;
>
>/*******************************************************************/
>
>f) STATS command: 
>((cat /var/tmp/mongo.flist[01]-0-0 | xargs ls -d) > /dev/null || touch
>ERR.file ) &
>((cat /var/tmp/mongo.flist[01]-0-1 | xargs ls -d) > /dev/null || touch
>ERR.file ) &
>((cat /var/tmp/mongo.flist[01]-0-2 | xargs ls -d) > /dev/null || touch
>ERR.file ) &
>wait; sync
>
>
>g) DELETE command:
>( rm -r /mnt/testfs/testdir[01]-0-0 || touch ERR.file ) &
>( rm -r /mnt/testfs/testdir[01]-0-1 || touch ERR.file ) &
>( rm -r /mnt/testfs/testdir[01]-0-2 || touch ERR.file ) &
>wait; sync
>
>
>Finally, if specified, it executes the large file phases
>
>h) dd_writing_largefile command: 
>( dd if=/dev/zero of=/mnt/testfs/largefile  bs=1M count=768 ) &
>( dd if=/dev/zero of=/mnt/testfs/largefile  bs=1M count=768 ) &
>( dd if=/dev/zero of=/mnt/testfs/largefile  bs=1M count=768 ) &  
>wait; sync
>
>i) dd_reading_largefile command: 
>( dd of=/dev/null if=/mnt/testfs/largefile  bs=1M count=768 ) &
>( dd of=/dev/null if=/mnt/testfs/largefile  bs=1M count=768 ) &
>( dd of=/dev/null if=/mnt/testfs/largefile  bs=1M count=768 ) &
>wait; sync
>
>
>
>
>
>  
>


  reply	other threads:[~2004-08-09  0:01 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4115A979.5090002@namesys.com>
2004-08-08  7:07 ` Was able to reproduce "cp: cannot stat file.x: Input/output error" David Dabbs
2004-08-08 18:08   ` Hans Reiser
2004-08-08 19:09     ` David Dabbs
2004-08-09  6:17       ` Hans Reiser
2004-08-08 21:40         ` David Dabbs
2004-08-09  0:01           ` Hans Reiser [this message]
2004-08-09  1:55             ` David Dabbs
2004-08-09 17:43               ` Hans Reiser
2004-08-09 18:32                 ` David Dabbs
2004-08-09  2:38             ` David Dabbs
2004-08-09 17:59               ` Alex Zarochentsev
2004-08-09 18:22                 ` David Dabbs
2004-08-09 18:42                   ` Alex Zarochentsev
2004-08-09 15:13     ` Nikita Danilov
2004-08-09 17:48       ` Hans Reiser
     [not found] <411944EF.7000504@namesys.com>
2004-08-10 22:05 ` David Dabbs
     [not found] <20040810205450.GU9811@backtop.namesys.com>
2004-08-10 21:06 ` David Dabbs
2004-08-10 21:06   ` Alex Zarochentsev
2004-08-10 21:19     ` David Dabbs
2004-08-11 10:03       ` Vladimir V. Saveliev
2004-08-10 21:26     ` David Dabbs
2004-08-06  6:53 David Dabbs
2004-08-06 15:51 ` Vladimir V. Saveliev
2004-08-06 17:10   ` Philippe Gramoullé
2004-08-06 17:39     ` Vladimir V. Saveliev
2004-08-06 19:06       ` Philippe Gramoullé
2004-08-07  4:14       ` Hans Reiser
2004-08-06 17:46     ` David Dabbs
2004-08-06 19:11       ` Philippe Gramoullé
2004-08-07  4:15       ` Hans Reiser
2004-08-07  6:46         ` David Dabbs
2004-08-07  7:49           ` Hans Reiser
2004-08-08  2:54             ` David Dabbs
2004-08-10  3:21             ` Valdis.Kletnieks
2004-08-10  8:31               ` Hans Reiser
2004-08-10 15:41                 ` Valdis.Kletnieks
2004-08-10  9:20               ` Alex Zarochentsev
2004-08-10 17:35                 ` Hans Reiser
2004-08-10 17:42                   ` David Dabbs
2004-08-10 17:46                     ` Hans Reiser
2004-08-10 18:05                   ` Alex Zarochentsev
2004-08-10 19:55                     ` Hans Reiser
2004-08-10 20:41                       ` Alex Zarochentsev
2004-08-06 17:51     ` Alex Zarochentsev
2004-08-06 19:10       ` Philippe Gramoullé
  -- strict thread matches above, loose matches on Subject: below --
2004-08-06  4:54 David Dabbs
2004-08-06  7:31 ` mjt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4116BEED.8050804@namesys.com \
    --to=reiser@namesys.com \
    --cc=Nikita@namesys.com \
    --cc=david@dabbs.net \
    --cc=grev@namesys.com \
    --cc=reiserfs-list@namesys.com \
    --cc=zam@namesys.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.