i was moving ~400gb to a new other file system, and noticed that
mkfs was extremely slow.  it turns out that mkfs by default moves
1024-8 bytes at a time.

i'm pretty sure this magical number turns out to be the default
kfs block size minus the size of the tag (careful with that ax, eugene).
ok, but this makes no sense when not extracting to a local kfs.

and why do we need to write exactly 1 block at a time?  what bug
are we covering for?

- erik

----
; adiff mkfs.c
/n/atom/plan9/sys/src/cmd/disk/mkfs.c:5,12 - mkfs.c:5,13
  
  enum{
        LEN     = 8*1024,
-       HUNKS   = 128,
  
+       Tagsize = 8,
+ 
        /*
         * types of destination file sytems
         */
/n/atom/plan9/sys/src/cmd/disk/mkfs.c:65,71 - mkfs.c:66,72
  int   lineno;
  char  *buf;
  char  *zbuf;
- int   buflen = 1024-8;
+ int   buflen;
  int   indent;
  int   verb;
  int   modes;
/n/atom/plan9/sys/src/cmd/disk/mkfs.c:148,154 - mkfs.c:149,155
                xflag = 1;
                break;
        case 'z':
-               buflen = atoi(EARGF(usage()))-8;
+               buflen = atoi(EARGF(usage()));
                break;
        default:
                usage();
/n/atom/plan9/sys/src/cmd/disk/mkfs.c:156,161 - mkfs.c:157,178
  
        if(!argc)       
                usage();
+ 
+       switch(fskind){
+       case Kfs:
+               /*
+                * preserve ancient hack for dflt block size; make room for tag
+                * why does this need to fit into 1 block?
+                */
+               if(buflen == 0)
+                       buflen = 1024;
+               buflen -= Tagsize;
+               break;
+       default:
+               if(buflen == 0)
+                       buflen = 8192;
+               break;
+       }
  
        buf = emalloc(buflen);
        zbuf = emalloc(buflen);

Reply via email to