your mail
assar@stacken.kth.se
assar at stacken.kth.se
Sun May 16 01:28:33 CEST 1999
Niklas wrote:
> These patches fixes bug when having a lot of cached nodes. One thing
> is the 4-character limit of the filenames that reconnect.c assumes,
> whcih breaks at 64K nodes.
Thanks for your patch. I took the occasion of doing some clean-up in
reconnect.c as well. My version of your patch is appended.
> The other thing is that the extra file used for directories, has a
> naming that clashed with standard cached files when more than 40K
> nodes exist. "1000" maps to "A000", which is also the name of the
> 40960th cached file.
We might as well do an encoding that doesn't clash and preserves the
number of the cache node, so I did this instead:
Index: arlad/fcache.c
===================================================================
RCS file: /usr/local/cvsroot/arla/arlad/fcache.c,v
retrieving revision 1.190
diff -u -w -u -w -r1.190 fcache.c
--- fcache.c 1999/05/04 09:29:18 1.190
+++ fcache.c 1999/05/15 23:16:22
@@ -214,9 +214,9 @@
entry->flags.extradirp &&
entry->status.FileType == TYPE_DIR);
- ret = fcache_file_name (entry, s, len);
- *s += 0x10;
- return ret;
+ *s = '@';
+ ret = fcache_file_name (entry, s + 1, len - 1);
+ return ret + 1;
}
static int fhopen_working;
> I have a cache with 100K nodes which is why I notice.
:-)
> PS, are you looking into the cvs/ mirror in your AFS space?
I think we're going to move the CVS repository into AFS, but it hasn't
happened yet.
/assar
Index: reconnect.c
===================================================================
RCS file: /usr/local/cvsroot/arla/arlad/reconnect.c,v
retrieving revision 1.11
diff -u -w -u -w -r1.11 reconnect.c
--- reconnect.c 1999/02/15 04:49:43 1.11
+++ reconnect.c 1999/05/15 23:26:28
@@ -793,7 +793,7 @@
fs_server_context context;
AFSFetchStatus status;
AFSVolSync volsync;
- char tmp[5];
+ char tmp[2 * sizeof(int) + 2];
xfs_cache_handle cache_handle;
fid = &(vcp->fid); /* points to the VenusFid structure */
@@ -903,7 +903,7 @@
int error;
VenusFid *fid, tempfid; /* Ba san: to check the deletion of file*/
Result res;
- char tmp[5];
+ char tmp[2 * sizeof(int) + 2];
int ret = 0;
Result tempres;
xfs_cache_handle cache_handle;
@@ -1033,16 +1033,13 @@
void
copy_cached_file(int from, int to)
{
- char tmpname[5],name_from[21],name_to[27];
+ char name_from[2 * sizeof(int) + 1], name_to[2 * sizeof(int) + 1];
int fd_from, n, fd_to;
char buf[BUFSIZE];
- strcpy(name_from,ARLACACHEDIR);
- strcpy(name_to,ARLACACHEDIR);
- sprintf(tmpname,"%04X",from);
- strcat(name_from, tmpname);
- sprintf(tmpname,"%04X",to);
- strcat(name_to, tmpname);
+ snprintf (name_from, sizeof(name_from), "%04X", from);
+ snprintf (name_to, sizeof(name_to), "%04X", to);
+
fd_from = open(name_from,O_RDONLY | O_BINARY);
fd_to = open(name_to, O_WRONLY | O_CREAT | O_BINARY);
@@ -1069,7 +1066,7 @@
FCacheEntry *parent_fce;
u_long host;
- char name[9],tmp[5];
+ char name[2 * sizeof(int) + 3 + 1], tmp[2 * sizeof(int) + 2];
AFSStoreStatus store_attr;
AFSFetchStatus fetch_attr;
CredCacheEntry *ce;
@@ -1438,7 +1435,7 @@
int ret = 0;
Result res;
- char tmp[5];
+ char tmp[2 * sizeof(int) + 2];
int isnewpar = 0;
ConnCacheEntry *conn;
fs_server_context context;
@@ -1673,7 +1670,7 @@
AFSCallBack callback;
AFSVolSync volsync;
int ret;
- char tmp[5];
+ char tmp[2 * sizeof(int) + 2];
xfs_cache_handle cache_handle;
int32_t type;
@@ -1875,7 +1872,7 @@
int ret = 0;
int tempret = 0;
struct timeval tv;
- char tmp[5];
+ char tmp[2 * sizeof(int) + 2];
AFSFid Outfid; /* Ba Wu: These are used to get the info from FS*/
AFSFetchStatus fetch_attr;
@@ -2011,7 +2008,7 @@
CredCacheEntry *ce;
VenusFid *parent_fid;
VenusFid *existing_fid;
- char tmp[5];
+ char tmp[2 * sizeof(int) + 2];
int ret = 0;
FCacheEntry *dir_entry,*existing_entry;
Result res;
@@ -2084,7 +2081,7 @@
fs_server_context context;
CredCacheEntry *ce;
VenusFid *parent_fid, *child_fid, fakeFid;
- char tmp[5];
+ char tmp[2 * sizeof(int) + 2];
int ret = 0;
FCacheEntry *dir_entry, *childEntry;
Result res;
More information about the Arla-drinkers
mailing list