* fixed(?) ftpfs cache patch
@ 2018-02-13 23:31 mycroftiv
0 siblings, 0 replies; only message in thread
From: mycroftiv @ 2018-02-13 23:31 UTC (permalink / raw)
To: 9front
[-- Attachment #1: Type: text/plain, Size: 263 bytes --]
Last patch was junk. Changes:
* Only exempt directories from caching, static file transfers require it
* Change -h flag to -c
* Don't interfere with caching of top VM and VMS directories
* Remove redundancy
Thanks cinap for pointing out the problems.
-mycroftiv
[-- Attachment #2: Type: text/plain, Size: 1033 bytes --]
--- /sys/src/cmd/ip/ftpfs/ftpfs.c Sat Dec 31 17:31:22 2016
+++ ftpfs.c Tue Feb 13 16:02:46 2018
@@ -85,6 +85,7 @@
char *nosuchfile = "file does not exist";
char *keyspec = "";
+int docache = 0;
void
usage(void)
@@ -149,6 +150,9 @@
case 'q':
quiet = 1;
break;
+ case 'c':
+ docache = 1;
+ break;
} ARGEND
if(argc != 1)
usage();
@@ -464,7 +468,8 @@
if(readfile(f->node) < 0)
return errstring;
}
- CACHED(f->node);
+ if(docache || ((f->node->d->qid.type & QTDIR) == 0))
+ CACHED(f->node);
}
}
@@ -537,7 +542,8 @@
if(!ISCACHED(f->node))
if(readfile(f->node) < 0)
return errstring;
- CACHED(f->node);
+ if(docache || ((f->node->d->qid.type & QTDIR) == 0))
+ CACHED(f->node);
rv = fileread(f->node, (char*)mbuf, off, cnt);
if(rv < 0)
return errstring;
@@ -617,7 +623,8 @@
if(!ISCACHED(p)){
invalidate(p);
readdir(p);
- CACHED(p);
+ if(docache || ((f->node->d->qid.type & QTDIR) == 0))
+ CACHED(p);
}
if(!ISVALID(f->node))
return nosuchfile;
[-- Attachment #3: Type: text/plain, Size: 1127 bytes --]
--- /sys/man/4/ftpfs Tue Jan 17 18:13:59 2012
+++ ftpfs.man Tue Feb 13 16:36:05 2018
@@ -4,7 +4,7 @@
.SH SYNOPSIS
.B ftpfs
[
-.B -/dqnt
+.B -/dqntc
]
[
.B -m
@@ -90,6 +90,10 @@
To see all messages from the server use option
.BR -d .
.PP
+By default ftpfs does not cache directories from the remote server. The
+.BR -c
+flag enables directory caching, but this may result in an outdated view of remote files available.
+.PP
Some systems will hangup an ftp connection that has no activity
for a given period. The
.BR -K
@@ -183,13 +187,9 @@
However, walking to any valid directory on that machine will succeed
and cause that directory entry to appear under the mount point.
.PP
-.I Ftpfs
-caches files and directories. A directory will fall from the cache
-after 5 quiescent minutes or if the local user changes the
-directory by writing or removing a file.
-Otherwise, remote
+If caching is active, remote
changes to the directory that occur after the directory has
-been cached might not be immediately visible.
+been cached will not be visible.
Attempting to walk to
.IB directory /.flush.ftpfs
will flush
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-02-13 23:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-13 23:31 fixed(?) ftpfs cache patch mycroftiv
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).