9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] odd constants in mkfs
@ 2014-06-19 12:42 erik quanstrom
  0 siblings, 0 replies; only message in thread
From: erik quanstrom @ 2014-06-19 12:42 UTC (permalink / raw)
  To: 9fans

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);



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-06-19 12:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-19 12:42 [9fans] odd constants in mkfs erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).