[BACK]Return to bufcache.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sbin / fsck_lfs

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sbin/fsck_lfs/bufcache.c between version 1.15 and 1.16

version 1.15, 2015/03/29 19:35:58 version 1.16, 2016/07/31 18:27:26
Line 101  bufinit(int max)
Line 101  bufinit(int max)
 /* Widen the hash table. */  /* Widen the hash table. */
 void bufrehash(int max)  void bufrehash(int max)
 {  {
         int i, newhashmax, newhashmask;          int i, newhashmax;
         struct ubuf *bp, *nbp;          struct ubuf *bp, *nbp;
         struct bufhash_struct *np;          struct bufhash_struct *np;
   
         if (max < 0 || max < hashmax)          if (max < 0 || max <= hashmax)
                 return;                  return;
   
         /* Round up to a power of two */          /* Round up to a power of two */
         for (newhashmax = 1; newhashmax < max; newhashmax <<= 1)          for (newhashmax = 1; newhashmax < max; newhashmax <<= 1)
                 ;                  ;
         newhashmask = newhashmax - 1;  
           /* update the mask right away so vl_hash() uses it */
           hashmask = newhashmax - 1;
   
         /* Allocate new empty hash table, if we can */          /* Allocate new empty hash table, if we can */
         np = emalloc(newhashmax * sizeof(*bufhash));          np = emalloc(newhashmax * sizeof(*bufhash));
Line 134  void bufrehash(int max)
Line 136  void bufrehash(int max)
         free(bufhash);          free(bufhash);
         bufhash = np;          bufhash = np;
         hashmax = newhashmax;          hashmax = newhashmax;
         hashmask = newhashmask;  
 }  }
   
 /* Print statistics of buffer cache usage */  /* Print statistics of buffer cache usage */

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

CVSweb <webmaster@jp.NetBSD.org>