9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: [9fans] odd constants in mkfs
Date: Thu, 19 Jun 2014 08:42:38 -0400	[thread overview]
Message-ID: <fed77a300f3ab155112d06b1eaa50f4f@brasstown.quanstro.net> (raw)

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	other threads:[~2014-06-19 12:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=fed77a300f3ab155112d06b1eaa50f4f@brasstown.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /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 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).