Diff

Differences From Artifact [430dbcdf6b]:

To Artifact [cbe8db4a9d]:


   596    596   	return(retval);
   597    597   }
   598    598   
   599    599   /*
   600    600    * Generate an inode for a given path.  The inode should be computed in such
   601    601    * a way that it is unlikely to be duplicated and remains the same for a given
   602    602    * file
          603  + *
          604  + * Current implementation is an FNV-1a 32-bit
   603    605    */
   604    606   #if UINT_MAX < 4294967295
   605    607   #error Integer size is too small 
   606    608   #endif
   607    609   static unsigned long long appfs_get_path_inode(const char *path) {
   608         -	int retval;
   609         -	const char *p;
          610  +	unsigned int retval;
          611  +	const unsigned char *p;
   610    612   
   611         -	retval = 10;
          613  +	retval = 2166136261; /* FNV-1a 32-bit offset_basis */
   612    614   
   613         -	for (p = path; *p; p++) {
   614         -		retval %= 4290960290ULL;
   615         -		retval += *p;
   616         -		retval <<= 6;
          615  +	for (p = (unsigned char *) path; *p; p++) {
          616  +		retval ^= (int) *p;
          617  +#if 0
          618  +		retval *= 16777619; /* FNV-1a 32-bit prime */
          619  +#else
          620  +		/* GCC Optimized replacement */
          621  +		retval += (retval << 1) + (retval << 4) + (retval << 7) + (retval << 8) + (retval << 24);
          622  +#endif
   617    623   	}
   618    624   
   619         -	retval += 10;
   620         -	retval %= 4294967286ULL;
   621         -	retval += 10;
   622         -
   623    625   	return(retval);
   624    626   }
   625    627   
   626    628   /*
   627    629    * Cache Get Path Info lookups for speed
   628    630    */
   629    631   static int appfs_get_path_info_cache_get(const char *path, uid_t uid, struct appfs_pathinfo *pathinfo) {