On Tue, 20 Jun 2000, Jan Harkes wrote:

> On Tue, Jun 20, 2000 at 11:19:12AM +0200, ulrich.hahn wrote:
> > 
> > While testing metadata performance of coda I encountered a file system
> > full situation. The error occured after creating approx. 7000 files and 
> > directories. First I thought this might be a client problem (RVM of venus
> > assuming 16k av. file size) but this did not change with venus cache size.
> > 
> > So is there a hard coded limit for directories per volume, or what else
> > did I miss?
> 
> What is the size of the directory according to `ls'?
> 
> Greg Troxel noted at one point that we don't have indirect directory
> blocks. The directories can thus only become at most 256KB. With 7000
> entries this results in ~37 bytes per entry. 12 bytes are used by flags,
> length and fid, so the average filename size to fill a directory with
> 7000 objects would be about 25 bytes.
> 
> I don't know if that includes the \0 character at the end.
> 
> Jan
> 

The directories itself are small, 2k at most, since they are created 
recursive. As the program itself is very small I attached it.

> tb_treetest /coda/tbtree 10
creates 1023 (1013) dirs and 1013 files without problems.

> tb_treetest /coda/tbtree 11
hangs after 2045 dirs and 2035 files

Creating files is still possible, but no more directories.

I then modified the source to create 50 dirs per dir and the coda
hangs at exactly 2045 dirs again, so it doesn´t seem related to 
directory depth but simply the number of dirs.

Any clue?

Uli

: Ulrich Hahn                 email: [EMAIL PROTECTED] :
: Zentrum für Datenverarbeitung            Tel: + (49) 07071 29 70315 :
: Universität Tübingen                     FAX: + (49) 07071 29  5912 : 
-----------------------------------------------------------------------
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>

static int stepdown(char *root,int tiefe);
static int ndir,nfile;

int main(int argc,char **argv)
{
   int tiefe;
   int i;
   char root[4096];

   if ( argc < 3 )
   {
      fprintf(stderr,"tb_treetest root tiefe\n");
      exit(1);
   }
/*
   create a directory tree starting with <root>. each dir is named by a 
   number giving the amount of dirs/files contained in that dir. each
   file name ends with _f.
*/
   if ( !(tiefe = atoi(argv[2])) )
   {
      exit(0);
   }
   ndir  = 0;
   nfile = 0;
   sprintf(root,"%s",argv[1]);
   if ( mkdir(root,(mode_t)0755) )
   {
      fprintf(stderr,"can't mkdir %s. %d %s\n",root,errno,strerror(errno));
      exit(1);
   }
   for ( i=0; i<tiefe; i++ )
   {
      sprintf(root,"%s/%d",argv[1],i);
      if ( mkdir(root,(mode_t)0755) )
      {
         fprintf(stderr,"can't mkdir %s. %d %s\n",root,errno,strerror(errno));
         exit(1);
      }
      if ( chdir(root) )
      {
         fprintf(stderr,"can't chdir %s. %d %s\n",root,errno,strerror(errno));
         exit(1);
      }
      if ( stepdown(root,i) )
      {
         fprintf(stderr,"can't stepdown\n");
         exit(1);
      }
   }
   fprintf(stdout,"created %d files and %d directories\n",nfile,ndir);
   exit(0);
}

static int stepdown(char *root,int tiefe)
{
   int  i,fd;
   char dir[4096],file[4096];

   if ( !tiefe )
   {
      return(0);
   }
   for ( i=0; i<tiefe; i++ )
   {
      sprintf(dir,"%d",i);
      sprintf(file,"%d_f",i); 
      if ( (fd = creat(file,(mode_t)0755)) < 0 )
      {
         fprintf(stderr,"can't create file %s. %d %s\n",file,errno,
                 strerror(errno));
         return(1);
      }
      close(fd);
      nfile++;
      if ( mkdir(dir,(mode_t)0755) )
      {
         fprintf(stderr,"can't mkdir %s. %d %s\n",dir,errno,strerror(errno));
         return(1);
      }
      ndir++;
      if ( chdir(dir) )
      {
         fprintf(stderr,"can't chdir %s. %d %s\n",root,errno,strerror(errno));
         return(1);
      }
      if ( stepdown(dir,i) )
      {
         fprintf(stderr,"stepdown failed\n");
         return(1);
      }
      if ( chdir("..") )
      {
         fprintf(stderr,"can't step up. %d %s\n",errno,strerror(errno));
         return(1);
      }
   }
   return(0);
}

Reply via email to