home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / protocol / appletal / 4330 < prev    next >
Encoding:
Text File  |  1993-01-06  |  18.5 KB  |  809 lines

  1. Path: sparky!uunet!gatech!usenet.ins.cwru.edu!agate!ucbvax!RUDY.FAC.CS.CMU.EDU!Rudy_Nedved
  2. From: Rudy_Nedved@RUDY.FAC.CS.CMU.EDU
  3. Newsgroups: comp.protocols.appletalk
  4. Subject: Re: recent CAP STAT_CACHE patches
  5. Message-ID: <1552.726260326@RUDY.FAC.CS.CMU.EDU>
  6. Date: 5 Jan 93 18:58:46 GMT
  7. References: <1i9o60INNjq1@phantom.gatech.edu>
  8. Sender: daemon@ucbvax.BERKELEY.EDU
  9. Distribution: world
  10. Organization: The Internet
  11. Lines: 796
  12.  
  13.  
  14. I have submitted the patches to the cap@mun... folks. No response from them.
  15.  
  16. So what the heck...here they are:
  17.  
  18. Patch #:    rudy2
  19. Type:        performance improvement
  20. Priority:    none
  21. Modification:    expand a cache and reduce byte compares
  22. Submitted:    Rudy Nedved (ern) <ern+@h.gp.cs.cmu.edu>
  23. Summary:    ENUM cache has been expanded from 30 to 100.
  24. Summary:    a hash value added to IDirP to speed up child lookup
  25. Summary:    ipathstr re-done to minimize strlen byte operations
  26. File:        cap60/applications/aufs/afps.h
  27. File:        cap60/applications/aufs/afpdid.c
  28.  
  29. *** applications/aufs/afps.h.orig    Fri Dec  4 11:42:57 1992
  30. --- applications/aufs/afps.h        Fri Dec  4 12:01:06 1992
  31. ***************
  32. *** 1,7 ****
  33.   /*
  34. !  * $Author: djh $ $Date: 1992/06/23 23:28:08 $
  35. !  * $Header: /mac/src/cap60/applications/aufs/RCS/afps.h,v 2.3 1992/06/23 23:28:08 djh Rel djh $
  36. !  * $Revision: 2.3 $
  37.   */
  38.   
  39.   /*
  40. --- 1,7 ----
  41.   /*
  42. !  * $oAuthor: djh $ $oDate: 1992/06/23 23:28:08 $
  43. !  * $oHeader: /mac/src/cap60/applications/aufs/RCS/afps.h,v 2.3 1992/06/23 23:28:08 djh Rel djh $
  44. !  * $oRevision: 2.3 $
  45.   */
  46.   
  47.   /*
  48. ***************
  49. *** 85,90 ****
  50. --- 85,91 ----
  51.   
  52.   typedef struct idir {        /* local directory info (internal) */
  53.     char *name;            /* the directory name */
  54. +   long hash;            /* hash of the directory name */
  55.     struct idir *next;        /* ptr to next at same level */
  56.     struct idir *subs;        /* ptr to children */
  57.     struct idir *pdir;        /* ptr to parent */
  58. ***************
  59. *** 178,184 ****
  60.   
  61.   #define NOECIDX (-1)
  62.   
  63. ! #define NECSIZE 30        /* size of the enum cache */
  64.   
  65.   void ECacheInit();
  66.   char *OSEnumGet();
  67. --- 179,185 ----
  68.   
  69.   #define NOECIDX (-1)
  70.   
  71. ! #define NECSIZE 100        /* size of the enum cache */
  72.   
  73.   void ECacheInit();
  74.   char *OSEnumGet();
  75.  
  76. *** applications/aufs/afpdid.c.orig    Fri Dec  4 11:43:29 1992
  77. --- applications/aufs/afpdid.c        Fri Dec  4 12:03:23 1992
  78. ***************
  79. *** 1,7 ****
  80.   /*
  81. !  * $Author: djh $ $Date: 1992/07/27 15:29:09 $
  82. !  * $Header: /mac/src/cap60/applications/aufs/RCS/afpdid.c,v 2.3 1992/07/27 15:29:09 djh Rel djh $
  83. !  * $Revision: 2.3 $
  84.   */
  85.   
  86.   /*
  87. --- 1,7 ----
  88.   /*
  89. !  * $oAuthor: djh $ $oDate: 1992/07/27 15:29:09 $
  90. !  * $oHeader: /mac/src/cap60/applications/aufs/RCS/afpdid.c,v 2.3 1992/07/27 15:29:09 djh Rel djh $
  91. !  * $oRevision: 2.3 $
  92.   */
  93.   
  94.   /*
  95. ***************
  96. *** 107,114 ****
  97.   IDirP dir;
  98.   char *nam;
  99.   {
  100. !   for (; dir != (IDirP) 0 && strcmp(dir->name,nam) != 0; dir = dir->next)
  101. !     /* NULL */;
  102.     return(dir);
  103.   }
  104.    
  105. --- 107,127 ----
  106.   IDirP dir;
  107.   char *nam;
  108.   {
  109. !   register long hash;
  110. !   register char *p;
  111. !   p = nam;
  112. !   hash = 0;
  113. !   while (*p) {
  114. !     hash <<= 2;
  115. !     hash += *p++;
  116. !   }
  117. !   for(;dir != (IDirP) 0; dir = dir->next) {
  118. !     if (dir->hash != hash)
  119. !     continue;
  120. !     if (strcmp(dir->name,nam) == 0)
  121. !     break;
  122. !   }
  123.     return(dir);
  124.   }
  125.    
  126. ***************
  127. *** 124,132 ****
  128. --- 137,154 ----
  129.   char *name;
  130.   {
  131.     IDirP dir;
  132. +   register long hash;
  133. +   register char *p;
  134.   
  135.     dir = (IDirP) malloc(sizeof(IDir));
  136.     dir->name = (char *) malloc((unsigned) strlen(name)+1);
  137. +   hash = 0;
  138. +   p = name;
  139. +   while (*p) {
  140. +     hash <<= 2;
  141. +     hash += *p++;
  142. +   }
  143. +   dir->hash = hash;
  144.     strcpy(dir->name,name);
  145.     dir->pdir = parent;            /* set pointer to parent in node */
  146.     dir->subs = NILDIR;            /* no children */
  147. ***************
  148. *** 145,150 ****
  149. --- 167,173 ----
  150.     OSValidateDIDDirInfo(dir);        /* validate directory info */
  151.     if (parent && (dir->flags & DID_DATA) == 0) {
  152.       parent->subs = dir->next;    /* unlink it */
  153. +     dir->hash = 0;
  154.       free(dir->name);        /* nada */
  155.       free(dir);            /* nada */
  156.       return(NILDIR);
  157. ***************
  158. *** 177,203 ****
  159.     if (lastcd == cd)            /* same as last request? */
  160.       return(paths);            /* yes.. just return old paths */
  161.     lastcd = cd;                /* else set new dir */
  162. !   return(ipathstr(cd,paths));        /* and do the work... */
  163.   }
  164.   
  165.   private char *
  166.   ipathstr(cd,p)
  167.   IDirP cd;
  168. ! char *p;
  169.   {
  170. !   int len;
  171.   
  172. !   if (cd == rootd)             /* check for root directory  */
  173. !     strcpy(p,"/");            /* at top of tree, init path */
  174. !   else {
  175. !     (void)ipathstr(cd->pdir,p);        /* recurse on parent until root */
  176. !     len = strlen(p);
  177.       if (cd->pdir != rootd) 
  178. !       p[len++] = '/';            /* add path component */
  179. !     strcpy(p+len, cd->name);        /* concatenate current dir to path */
  180.     }
  181. -   return(p);                /* and return a pointer... */
  182. - }
  183.   
  184.   /*
  185.    * return a path relative to vroot
  186. --- 200,238 ----
  187.     if (lastcd == cd)            /* same as last request? */
  188.       return(paths);            /* yes.. just return old paths */
  189.     lastcd = cd;                /* else set new dir */
  190. !   ipathstr(cd,paths);            /* and do the work... */
  191. !   return(paths);            /* return new path */
  192.   }
  193.   
  194.   private char *
  195.   ipathstr(cd,p)
  196.   IDirP cd;
  197. ! register char *p;
  198.   {
  199. !   register char *t;
  200.   
  201. !   /* check for root directory  */
  202. !   if (cd == rootd) {
  203. !     /* at top of tree, init path */
  204. !     *p++ = '/';
  205. !     *p = '\0';
  206. !     return (p);
  207. !   }
  208. !   /* recurse on parent until root, get new insertion pointer */
  209. !   p = ipathstr(cd->pdir,p);
  210. !   /* insert new path component */
  211.     if (cd->pdir != rootd)
  212. !     *p++ = '/';
  213. !   t = cd->name;
  214. !   while (*t)
  215. !     *p++ = *t++;
  216. !   *p = '\0';
  217. !   /* return new insertion pointer */
  218. !   return(p);
  219.   }
  220.   
  221.   /*
  222.    * return a path relative to vroot
  223. ***************
  224. *** 529,535 ****
  225.   }
  226.   
  227.   /*
  228. !  * OSErr EtoIFile(char *file, IDirP *idir, IDirP *ipdir, int *ivol
  229.    *          sdword edir, word evol, byte eptype, byte *epath);
  230.    *
  231.    * Convert external arguments which specify a file/dir into internal
  232. --- 564,570 ----
  233.   }
  234.   
  235.   /*
  236. !  * OSErr EtoIfile(char *file, IDirP *idir, IDirP *ipdir, int *ivol
  237.    *          sdword edir, word evol, byte eptype, byte *epath);
  238.    *
  239.    * Convert external arguments which specify a file/dir into internal
  240. ***************
  241. *** 816,821 ****
  242. --- 851,865 ----
  243.     }
  244.   
  245.     if (strcmp(from,to) != 0) {        /* if different names then... */
  246. +     register long hash;
  247. +     register char *p;
  248. +     hash = 0;
  249. +     p = to;
  250. +     while (*p) {
  251. +       hash <<= 2;
  252. +       hash += *p++;
  253. +     }
  254. +     fdir->hash = hash;
  255.       free(fdir->name);            /* release the old name */
  256.       fdir->name = (char *) malloc((unsigned) strlen(to)+1);
  257.       strcpy(fdir->name,to);        /* copy new name */
  258.  
  259. Patch #:    rudy3
  260. Type:        performance improvement to STAT_CACHE code
  261. Priority:    none
  262. Modification:    add module init call, use internal buffer
  263. Submitted:    Rudy Nedved (ern) <ern+@h.gp.cs.cmu.edu>
  264. Summary:    initialize things by adding an init call
  265. Summary:    eliminate malloc/free calls
  266. Summary:    allow stat of parent and root without loss of info
  267. File:        cap60/applications/aufs/afpserver.c
  268. File:        cap60/applications/aufs/afpspd.c
  269.  
  270. *** applications/aufs/afpserver.c.orig    Wed Mar 13 05:29:40 1991
  271. --- applications/aufs/afpserver.c    Fri Dec  4 12:36:30 1992
  272. ***************
  273. *** 1,7 ****
  274.   /*
  275. !  * $Author: djh $ $Date: 91/03/13 20:29:21 $
  276. !  * $Header: afpserver.c,v 2.2 91/03/13 20:29:21 djh Exp $
  277. !  * $Revision: 2.2 $
  278.   */
  279.   
  280.   /*
  281. --- 1,7 ----
  282.   /*
  283. !  * $oAuthor: djh $ $oDate: 91/03/13 20:29:21 $
  284. !  * $oHeader: afpserver.c,v 2.2 91/03/13 20:29:21 djh Exp $
  285. !  * $oRevision: 2.2 $
  286.   */
  287.   
  288.   /*
  289. ***************
  290. *** 222,227 ****
  291. --- 222,230 ----
  292.     ECacheInit();            /* init afposenum cache */
  293.     InitIconCache();        /* init afpdt cache */
  294.     InitDID();            /* init directory stuff  */
  295. + #ifdef STAT_CACHE
  296. +   OSstat_Init();        /* init stat cache */
  297. + #endif STAT_CACHE
  298.   }
  299.   
  300.   private int loggedin = FALSE;
  301.  
  302. *** applications/aufs/afpspd.c.orig    Fri Dec  4 11:43:29 1992
  303. --- applications/aufs/afpspd.c        Fri Dec  4 12:34:50 1992
  304. ***************
  305. *** 18,24 ****
  306.   
  307.   #ifdef STAT_CACHE
  308.   
  309. ! struct statobj {
  310.       char * NAME;
  311.       struct stat STAT;
  312.       int FN,RS;
  313. --- 18,24 ----
  314.   
  315.   #ifdef STAT_CACHE
  316.   
  317. ! private struct statobj {
  318.       char * NAME;
  319.       struct stat STAT;
  320.       int FN,RS;
  321. ***************
  322. *** 41,47 ****
  323. --- 41,65 ----
  324.   private char CUR_DIR_STR[1024];
  325.   private char * CUR_DIR = NULL;
  326.   private int CUR_DIR_LEN;
  327. + private char CUR_STAT_STR[1024];
  328. + private int CUR_STAT_LEVEL=0;
  329.   
  330. + OSstat_Init()
  331. + {
  332. +     register int P;
  333. +     for(P = 0;P <= MAX_LEVEL;P++) {
  334. +         STATS[P].NAME = NULL;
  335. +         STATS[P].STAT.st_nlink = -1;
  336. +         STATS[P].FN = VAL_INVALID;
  337. +         STATS[P].RS = VAL_INVALID;
  338. +     }
  339. +     STATS[0].NAME = "<root>";
  340. +     time(&CUR_TIME);
  341. + }
  342.   OScd(path)
  343.       char * path;
  344.   {
  345. ***************
  346. *** 96,108 ****
  347.   private release_stats(K)
  348.       int K;
  349.   {
  350. !     int P;
  351.   
  352.       if (DBOSI)
  353.           printf("release_stats=%d\n",K);
  354.   
  355. !     for (P = K; STATS[P].NAME != NULL; P++) {
  356. !         free(STATS[P].NAME);
  357.           STATS[P].STAT.st_nlink = -1;
  358.           STATS[P].FN = VAL_INVALID;
  359.           STATS[P].RS = VAL_INVALID;
  360. --- 114,125 ----
  361.   private release_stats(K)
  362.       int K;
  363.   {
  364. !     register int P;
  365.   
  366.       if (DBOSI)
  367.           printf("release_stats=%d\n",K);
  368.   
  369. !     for (P = K; P <= CUR_STAT_LEVEL; P++) {
  370.           STATS[P].STAT.st_nlink = -1;
  371.           STATS[P].FN = VAL_INVALID;
  372.           STATS[P].RS = VAL_INVALID;
  373. ***************
  374. *** 113,191 ****
  375.   private int EXPIRE_REQ;
  376.   
  377.   private expire_stats(K)
  378. !     int K;
  379.   {
  380.       if (!EXPIRE_REQ)
  381.           return;
  382.       EXPIRE_REQ = 0;
  383. !     for (K = 0; STATS[K].NAME != NULL; K++) {
  384. !         if (STATS[K].VAL_TIME > CUR_TIME) {
  385.               STATS[K].STAT.st_nlink = -1;
  386.               STATS[K].FN = VAL_INVALID;
  387.               STATS[K].RS = VAL_INVALID;
  388.               if (DBOSI)
  389. !                 printf("expired=%d(%s)\n",K,STATS[K].NAME);
  390.           }
  391.       }
  392.   }
  393.   
  394. ! private char * newstr(STR)
  395. !     char * STR;
  396.   {
  397. !     char * P;
  398.   
  399. !     P = (char *) malloc(strlen(STR)+1);
  400. !     if (P != NULL) {
  401. !         strcpy(P,STR);
  402. !         return P;
  403.       }
  404.       return NULL;
  405.   }
  406.   
  407. ! private struct statobj * locate_statobj(path)
  408. !     char * path;
  409. ! {
  410. !     char STR[1024];
  411. !     char * PART[20];
  412. !     int K,P,LC;
  413. !     char * S;
  414.   
  415. !     if (*path != '/' || strcmp(path,"/") == 0)
  416.           return NULL;
  417. -     strcpy(STR,path);
  418. -     S = STR+1;
  419. -     K = 0;
  420. -     PART[K] = S;
  421. -     while ((S = (char*)index(S,'/')) != NULL) {
  422. -         *S++ = 0;
  423. -         PART[++K] = S;
  424. -         if (K >= MAX_LEVEL)
  425. -             return NULL;
  426.       }
  427. -     LC = K+1;
  428. -     expire_stats();
  429.       
  430. !     for (K = 0; K < LC && STATS[K].NAME != NULL && strcmp(STATS[K].NAME,PART[K]) == 0; K++);
  431. !     if (K == LC) {
  432. !         K--;
  433.           return &STATS[K];
  434. -     } else {
  435. -         release_stats(K);
  436. -         for (P = K; P < LC; P++) {
  437. -             STATS[P].NAME = newstr(PART[P]);
  438. -             STATS[P].STAT.st_nlink = -1;
  439. -             STATS[P].FN = VAL_INVALID;
  440. -             STATS[P].RS = VAL_INVALID;
  441.           }
  442. !         return &STATS[LC-1];
  443.       }
  444.   }
  445.       
  446.   OSstat(path,buf)
  447.       char * path;
  448.       struct stat *buf;
  449.   {
  450. -     struct stat B;
  451.       struct statobj * CE;
  452.   
  453.       if (DBOSI)
  454. --- 130,298 ----
  455.   private int EXPIRE_REQ;
  456.   
  457.   private expire_stats(K)
  458. !     register int K;
  459.   {
  460.       if (!EXPIRE_REQ)
  461.           return;
  462.       EXPIRE_REQ = 0;
  463. !     for (K = 0; K <= CUR_STAT_LEVEL; K++) {
  464. !         if (STATS[K].STAT.st_nlink < 0)
  465. !             continue;
  466. !         if (STATS[K].VAL_TIME <= CUR_TIME) {
  467. !             if (DBOSI)
  468. !                 printf("time delta %d vs %d (%d)\n",
  469. !                     CUR_TIME,STATS[K].VAL_TIME,
  470. !                     CUR_TIME - STATS[K].VAL_TIME);
  471.               STATS[K].STAT.st_nlink = -1;
  472.               STATS[K].FN = VAL_INVALID;
  473.               STATS[K].RS = VAL_INVALID;
  474.               if (DBOSI)
  475. !                 printf("expired=%d(%s) t=%d\n",K,STATS[K].NAME,
  476. !                        STATS[K].VAL_TIME - CUR_TIME);
  477.           }
  478.       }
  479.   }
  480.   
  481. ! private struct statobj * locate_statobj(path)
  482. !     char * path;
  483.   {
  484. !     register char *NEW,*OLD;
  485. !     register char *TMP;
  486. !     char *REPLACE;
  487. !     register int K;
  488.   
  489. !     if (DBOSI)
  490. !         printf("locate_statobj: path '%s'\n", path);
  491. !     /* get the path and make sure it is an absolute one */
  492. !     NEW = path;
  493. !     if (*NEW++ != '/')
  494. !         return NULL;
  495. !     /* get rid of old information */
  496. !     expire_stats();
  497. !     /* record what we are replacing */
  498. !     REPLACE = CUR_STAT_STR;
  499. !     /* loop thru each path component and check against current */
  500. !     for(K=0;;) {
  501. !         /* strip leading slashes */
  502. !         while (*NEW == '/') NEW++;
  503. !         /* handle root */
  504. !         if (K == 0) {
  505. !             if (*NEW == '\0') {
  506. !                 if (DBOSI)
  507. !                     printf("locate_statobj: root\n");
  508. !                 return &STATS[0];
  509.               }
  510. +             /* something more */
  511. +             K++;
  512. +         }
  513. +         /* do we have info for this level? */
  514. +         if (K > CUR_STAT_LEVEL)
  515. +             break;    /* nope */
  516. +         /* do we have a name for this level */
  517. +         if ((OLD = STATS[K].NAME) == NULL)
  518. +             break;    /* nope */
  519. +         /* record buffer name */
  520. +         REPLACE = OLD;
  521. +         /* compare name */
  522. +         TMP = NEW;
  523. +         while (*OLD && *OLD == *TMP) {
  524. +             OLD++;
  525. +             TMP++;
  526. +         }
  527. +         /* did we end cleanly? */
  528. +         if (*OLD != '\0')
  529. +             break;    /* nope */
  530. +         /* did NEW path end? */
  531. +         if (*TMP == '\0') {
  532. +             /* yes */
  533. +             if (DBOSI)
  534. +                 printf("locate_statobj: found %d: '%s'\n",
  535. +                        K,STATS[K].NAME);
  536. +             return &STATS[K];
  537. +         }
  538. +         /* did NEW path end on slash? */
  539. +         if (*TMP != '/')
  540. +             break;    /* nope */
  541. +         /* about to loop, see if too many levels */
  542. +         if (++K >= MAX_LEVEL) {
  543. +             if (DBOSI)
  544. +                 printf("locate_statobj: too many '%s'\n",
  545. +                        path);
  546.               return NULL;
  547.           }
  548.   
  549. !         /* loop again */
  550. !         REPLACE = ++OLD;
  551. !         NEW = TMP;
  552. !     }
  553.   
  554. !     /* add components */
  555. !     release_stats(K);
  556. !     OLD = REPLACE;
  557. !     for(;;) {
  558. !         /* strip leading slashes */
  559. !         while (*NEW == '/') NEW++;
  560. !         /* make sure we have something */
  561. !         if (*NEW == '\0') {
  562. !             /* must be trailing slash */
  563. !             if (DBOSI)
  564. !                 printf("locate_statobj: trailing / in '%s'\n",
  565. !                        path);
  566.               return NULL;
  567.           }
  568.   
  569. !         /* record and copy component */
  570. !         STATS[K].NAME = OLD;
  571. !         while (*NEW && *NEW != '/')
  572. !             *OLD++ = *NEW++;
  573. !         *OLD++ = '\0';
  574. !         /* record new stat level */
  575. !         CUR_STAT_LEVEL = K;
  576. !         /* are we done? */
  577. !         if (*NEW == '\0') {
  578. !             /* yep */
  579. !             if (DBOSI)
  580. !                 printf("locate_statobj: return %d: '%s'\n",
  581. !                        K,STATS[K].NAME);
  582.               return &STATS[K];
  583.           }
  584. !         /* about to loop, see if too many levels */
  585. !         if (++K >= MAX_LEVEL) {
  586. !             if (DBOSI)
  587. !                 printf("locate_statobj: too many (add) '%s'\n",
  588. !                        path);
  589. !             return NULL;
  590.           }
  591. +         /* loop again */
  592.       }
  593.   
  594. +     /* NEVER REACHED */
  595. + }
  596. +     
  597.   OSstat(path,buf)
  598.       char * path;
  599.       struct stat *buf;
  600.   {
  601.       struct statobj * CE;
  602.   
  603.       if (DBOSI)
  604. ***************
  605. *** 193,210 ****
  606.   
  607.       CE = locate_statobj(path);
  608.       if (CE != NULL) {
  609. !         if (CE->STAT.st_nlink != -1) {
  610.               if (DBOSI)
  611.                   printf("OSstat=cache path\n");
  612.               bcopy(&CE->STAT,buf,sizeof(struct stat));
  613.               return 0;
  614.           }
  615. !         if (cwd_stat(path,&B) == 0) {
  616.               if (DBOSI)
  617.                   printf("OSstat=caching path\n");
  618. !             bcopy(&B,&CE->STAT,sizeof(struct stat));
  619.               CE->VAL_TIME = CUR_TIME+EXP_TIME;
  620. -             bcopy(&B,buf,sizeof(struct stat));
  621.               return 0;
  622.           }
  623.           return -1;
  624. --- 300,316 ----
  625.   
  626.       CE = locate_statobj(path);
  627.       if (CE != NULL) {
  628. !         if (CE->STAT.st_nlink >= 0) {
  629.               if (DBOSI)
  630.                   printf("OSstat=cache path\n");
  631.               bcopy(&CE->STAT,buf,sizeof(struct stat));
  632.               return 0;
  633.           }
  634. !         if (cwd_stat(path,buf) == 0) {
  635.               if (DBOSI)
  636.                   printf("OSstat=caching path\n");
  637. !             bcopy(buf,&CE->STAT,sizeof(struct stat));
  638.               CE->VAL_TIME = CUR_TIME+EXP_TIME;
  639.               return 0;
  640.           }
  641.           return -1;
  642.  
  643. Patch #:    rudy4
  644. Type:        performance improvement to file cache
  645. Priority:    none
  646. Modification:    add hash value for lookups
  647. Submitted:    Rudy Nedved (ern) <ern+@h.gp.cs.cmu.edu>
  648. Summary:    minimize byte comparisons on frequent name lookups in cache
  649. File:        cap60/applications/aufs/afpposfi.c
  650.  
  651. *** applications/aufs/afposfi.c.orig    Fri Dec  4 11:42:58 1992
  652. --- applications/aufs/afposfi.c        Fri Dec  4 12:43:37 1992
  653. ***************
  654. *** 1,7 ****
  655.   /*
  656. !  * $Author: djh $ $Date: 1992/06/23 23:29:41 $
  657. !  * $Header: /mac/src/cap60/applications/aufs/RCS/afposfi.c,v 2.3 1992/06/23 23:29:41 djh Rel djh $
  658. !  * $Revision: 2.3 $
  659.   */
  660.   
  661.   /*
  662. --- 1,7 ----
  663.   /*
  664. !  * $oAuthor: djh $ $oDate: 1992/06/23 23:29:41 $
  665. !  * $oHeader: /mac/src/cap60/applications/aufs/RCS/afposfi.c,v 2.3 1992/06/23 23:29:41 djh Rel djh $
  666. !  * $oRevision: 2.3 $
  667.   */
  668.   
  669.   /*
  670. ***************
  671. *** 50,55 ****
  672. --- 50,56 ----
  673.     IDirP fe_pdir;        /* directory */
  674.     int fe_okay;            /* last internal modify count */
  675.     char  *fe_fnam;        /* file */
  676. +   long   fe_hash;        /* hash value of file name */
  677.     /* should we use ctime instead perhaps? */
  678.     time_t fe_mtime;        /* last modify time: file system */
  679.     time_t fe_vtime;        /* last time validated */
  680. ***************
  681. *** 219,224 ****
  682. --- 220,226 ----
  683.     
  684.     free(fe->fe_fnam);            /* always free the name */
  685.     fe->fe_fnam = (char *) 0;        /*  and zero... */
  686. +   fe->fe_hash = 0;            /* (and clear the hash value)
  687.     fe->next = NULL;            /* trash it here since want in both */
  688.     if (fce == (FCacheEnt *) 0)        /* check for recycled entry */
  689.       lfce = fce = fe;            /* if none then save */
  690. ***************
  691. *** 235,240 ****
  692. --- 237,244 ----
  693.   fc_compare(fe,key)
  694.   FCacheEnt *fe,*key;
  695.   {
  696. +   if (fe->fe_hash != key->fe_hash)
  697. +     return(FALSE);
  698.     if (fe->fe_pdir != key->fe_pdir)
  699.       return(FALSE);
  700.     return(strcmp(fe->fe_fnam,key->fe_fnam) == 0);
  701. ***************
  702. *** 257,262 ****
  703. --- 261,267 ----
  704.   
  705.     fe->fe_pdir = key->fe_pdir;
  706.     fe->fe_fnam = (char *) malloc(strlen(key->fe_fnam)+1);
  707. +   fe->fe_hash = key->fe_hash;
  708.     fe->fe_okay = TRUE;
  709.     fe->fe_mtime = 0;
  710.     time(&fe->fe_vtime);            /* validate time stamp */
  711. ***************
  712. *** 484,493 ****
  713. --- 489,507 ----
  714.   IDirP pdir;
  715.   char *fn;
  716.   {
  717. +   register long hash;
  718. +   register char *p;
  719.     FCacheEnt key;
  720.   
  721.     key.fe_pdir = pdir;
  722.     key.fe_fnam = fn;
  723. +   p = fn;
  724. +   hash = 0;
  725. +   while (*p) {
  726. +     hash <<= 2;
  727. +     hash += *p++;
  728. +   }
  729. +   key.fe_hash = hash;
  730.     
  731.     /* do the "quick" check first */
  732.     if (getfe == 0 || !fc_compare(getfe,&key)) {
  733. ***************
  734. *** 501,511 ****
  735. --- 515,534 ----
  736.   IDirP pdir;     
  737.   char *fn;
  738.   {
  739. +   register long hash;
  740. +   register char *p;
  741.     FCacheEnt key;
  742.     int idx;
  743.   
  744.     key.fe_pdir = pdir;
  745.     key.fe_fnam = fn;
  746. +   p = fn;
  747. +   hash = 0;
  748. +   while (*p) {
  749. +     hash <<= 2;
  750. +     hash += *p++;
  751. +   }
  752. +   key.fe_hash = hash;
  753.   
  754.     EModified(pdir);        /* make parent directory as modified */
  755.     if (getfe == 0 || !fc_compare(getfe,&key)) {
  756. Patch #:    rudy5
  757. Type:        documentation update
  758. Priority:    none
  759. Modification:    Add performance comment about -s switch to aufs
  760. Submitted:    Rudy Nedved (ern) <ern+@h.gp.cs.cmu.edu>
  761. File:        cap60/man/AUFS.8
  762.  
  763. *** man/AUFS.8.orig    Fri Dec  4 11:43:42 1992
  764. --- man/AUFS.8        Fri Dec  4 13:04:33 1992
  765. ***************
  766. *** 199,204 ****
  767. --- 199,205 ----
  768.   to report usage statistics such as system time use and
  769.   number of times encountered for the various AFP commands.
  770.   These statistics are recorded in the log file at the end of a run.
  771. + NOTE: Recording these statistics slows down the server operations.
  772.   .TP 10
  773.   .BI \-d " <flags>"
  774.   specifies debugging flags for the cap libraries.  See cap(3) for a
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.