From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@9fans.net From: erik quanstrom Date: Fri, 12 Sep 2008 07:47:16 -0400 In-Reply-To: <10b109140809120134v68ff8c5bo43202c0299b247dc@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-alscwfrzyrwqqxqazljdeyiuvt" Subject: Re: [9fans] patch/create problem (error?) Topicbox-Message-UUID: 101ad15e-ead4-11e9-9d60-3106f5b1d025 This is a multi-part message in MIME format. --upas-alscwfrzyrwqqxqazljdeyiuvt Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit >>> I had problem to create a patch - the command didn't finish for long long time. >> >> I created a patch yesterday and it worked fine. It is fairly slow as it >> diff's all the files you have changed with those on sources. >> >> Sadly the 9p protocol is quite badly effected by high (intercontinential) RTTs. >> >> -Steve > > There were only 2 files in the patch. I wait for about 10 minutes and nothing. > But then I tried to copy a file from command line. > If I copied an ordinary file (to /n/sources) it was done immediately. > But If I copied a file from bind-ed(!) directory it was endless... > There was no diff, only copy file. i would guess the problem is a bit different. i'm assuming that reads from sources work fine. it's not until you try to write there that there's a problem. this sounds like a mtu problem. i have a similar problem. i am not able to submit patches over one particular network interface. however, if i use a lower mtu, things work fine. i believe this is because the dumpy dsl modem we have blocks icmp messages. you could lower the mtu on the interface, but rather than punishing all traffic, i wrote a program called cpmtu. cpmtu is attached. if you define this function fn cp {cpmtu -m 700 $*} before you run patch/create, i believe patch should work properly for you. as an aside: i don't think 9p itself limits plan 9 performance over high-latency links. the limitations have more to do with the number of outstanding messages, which is 1 in the mnt driver. - erik --upas-alscwfrzyrwqqxqazljdeyiuvt Content-Disposition: attachment; filename=cpmtu.c Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit #include #include int mtu = 8*1024; int failed; int gflag; int uflag; int xflag; void copy(char *from, char *to, int todir); int copy1(int fdf, int fdt, char *from, char *to); void usage(void) { fprint(2, "usage:\tcp [-gux] [-m mtu] fromfile tofile\n"); fprint(2, "\tcp [-x] [-m mtu] fromfile ... todir\n"); exits("usage"); } void main(int argc, char *argv[]) { Dir *dirb; int todir, i; ARGBEGIN { case 'g': gflag++; break; case 'u': uflag++; gflag++; break; case 'x': xflag++; break; case 'm': mtu = atoi(EARGF(usage())); if(mtu > 0) break; default: usage(); } ARGEND todir=0; if(argc < 2) usage(); dirb = dirstat(argv[argc-1]); if(dirb!=nil && (dirb->mode&DMDIR)) todir=1; if(argc>2 && !todir){ fprint(2, "cp: %s not a directory\n", argv[argc-1]); exits("bad usage"); } for(i=0; iqid.type==a->qid.type) if(b->qid.path==a->qid.path) if(b->qid.vers==a->qid.vers) if(b->dev==a->dev) if(b->type==a->type){ fprint(2, "cp: %s and %s are the same file\n", an, bn); ret = 1; } free(b); return ret; } void copy(char *from, char *to, int todir) { Dir *dirb, dirt; char name[256]; int fdf, fdt, mode; if(todir){ char *s, *elem; elem=s=from; while(*s++) if(s[-1]=='/') elem=s; sprint(name, "%s/%s", to, elem); to=name; } if((dirb=dirstat(from))==nil){ fprint(2,"cp: can't stat %s: %r\n", from); failed = 1; return; } mode = dirb->mode; if(mode&DMDIR){ fprint(2, "cp: %s is a directory\n", from); free(dirb); failed = 1; return; } if(samefile(dirb, from, to)){ free(dirb); failed = 1; return; } mode &= 0777; fdf=open(from, OREAD); if(fdf<0){ fprint(2, "cp: can't open %s: %r\n", from); free(dirb); failed = 1; return; } fdt=create(to, OWRITE, mode); if(fdt<0){ fprint(2, "cp: can't create %s: %r\n", to); close(fdf); free(dirb); failed = 1; return; } if(copy1(fdf, fdt, from, to)==0 && (xflag || gflag || uflag)){ nulldir(&dirt); if(xflag){ dirt.mtime = dirb->mtime; dirt.mode = dirb->mode; } if(uflag) dirt.uid = dirb->uid; if(gflag) dirt.gid = dirb->gid; if(dirfwstat(fdt, &dirt) < 0) fprint(2, "cp: warning: can't wstat %s: %r\n", to); } free(dirb); close(fdf); close(fdt); } int copy1(int fdf, int fdt, char *from, char *to) { char *buf; long n, n1, rcount; int rv; char err[ERRMAX]; buf = malloc(mtu); /* clear any residual error */ err[0] = '\0'; errstr(err, ERRMAX); rv = 0; for(rcount=0;; rcount++) { n = read(fdf, buf, mtu); if(n <= 0) break; n1 = write(fdt, buf, n); if(n1 != n) { fprint(2, "cp: error writing %s: %r\n", to); failed = 1; rv = -1; break; } } if(n < 0) { fprint(2, "cp: error reading %s: %r\n", from); failed = 1; rv = -1; } free(buf); return rv; } --upas-alscwfrzyrwqqxqazljdeyiuvt--