Check-in [fac74d236f]
Overview
Comment:Updated inode generation to be FNV-1a
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fac74d236fff99c5de7240e21ce821f4076da1cc
User & Date: rkeene on 2014-11-15 19:34:02
Other Links: manifest | tags
Context
2014-11-17
16:51
Added timeout (30s) for DB operations to avoid locking failures being immediately returned check-in: dd0cc55f82 user: rkeene tags: trunk
2014-11-15
19:34
Updated inode generation to be FNV-1a check-in: fac74d236f user: rkeene tags: trunk
19:17
Added missing Tcl_Preserve() call check-in: 71bdb44ec6 user: rkeene tags: trunk
Changes

Modified appfsd.c from [430dbcdf6b] to [cbe8db4a9d].

596
597
598
599
600
601
602


603
604
605
606
607
608
609
610
611
612
613
614
615

616




617
618
619
620
621
622
623
624
625
626
627
628
	return(retval);
}

/*
 * Generate an inode for a given path.  The inode should be computed in such
 * a way that it is unlikely to be duplicated and remains the same for a given
 * file


 */
#if UINT_MAX < 4294967295
#error Integer size is too small 
#endif
static unsigned long long appfs_get_path_inode(const char *path) {
	int retval;
	const char *p;

	retval = 10;

	for (p = path; *p; p++) {
		retval %= 4290960290ULL;
		retval += *p;

		retval <<= 6;




	}

	retval += 10;
	retval %= 4294967286ULL;
	retval += 10;

	return(retval);
}

/*
 * Cache Get Path Info lookups for speed
 */







>
>





|
|

|

|
<
|
>
|
>
>
>
>

<
<
<
<







596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615

616
617
618
619
620
621
622
623




624
625
626
627
628
629
630
	return(retval);
}

/*
 * Generate an inode for a given path.  The inode should be computed in such
 * a way that it is unlikely to be duplicated and remains the same for a given
 * file
 *
 * Current implementation is an FNV-1a 32-bit
 */
#if UINT_MAX < 4294967295
#error Integer size is too small 
#endif
static unsigned long long appfs_get_path_inode(const char *path) {
	unsigned int retval;
	const unsigned char *p;

	retval = 2166136261; /* FNV-1a 32-bit offset_basis */

	for (p = (unsigned char *) path; *p; p++) {

		retval ^= (int) *p;
#if 0
		retval *= 16777619; /* FNV-1a 32-bit prime */
#else
		/* GCC Optimized replacement */
		retval += (retval << 1) + (retval << 4) + (retval << 7) + (retval << 8) + (retval << 24);
#endif
	}





	return(retval);
}

/*
 * Cache Get Path Info lookups for speed
 */