Ignore:
Timestamp:
Sep 18, 2016, 5:57:25 PM (9 years ago)
Author:
bird
Message:

kFsCache: Implemented lazy child hashing and increased the KFSCACHE_CFG_PATH_HASH_TAB_SIZE value from 16384 to 99991 to better deal with large kBuild trees (e.g. VBox).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/nt/kFsCache.h

    r2912 r2930  
    4848/** @def KFSCACHE_CFG_PATH_HASH_TAB_SIZE
    4949 * Size of the path hash table. */
    50 #define KFSCACHE_CFG_PATH_HASH_TAB_SIZE     16381
     50#define KFSCACHE_CFG_PATH_HASH_TAB_SIZE     99991
    5151/** The max length paths we consider. */
    5252#define KFSCACHE_CFG_MAX_PATH               1024
     
    112112
    113113
    114 /**
    115  * Directory hash table entry.
    116  *
    117  * There can be two of these per directory entry when the short name differs
    118  * from the long name.
    119  */
    120 typedef struct KFSOBJHASH
    121 {
    122     /** Pointer to the next entry with the same hash. */
    123     PKFSOBJHASH         pNext;
    124     /** Pointer to the object. */
    125     PKFSOBJ             pObj;
    126 } KFSOBJHASH;
    127 
    128114
    129115/** Pointer to a user data item. */
     
    163149    KU32                fFlags;
    164150
     151    /** Hash value of the name inserted into the parent hash table.
     152     * This is 0 if not inserted.  Names are only hashed and inserted as they are
     153     * first found thru linear searching of its siblings, and which name it is
     154     * dependens on the lookup function (W or A) and whether the normal name or
     155     * short name seems to have matched.
     156     *
     157     * @note It was ruled out as too much work to hash and track all four names,
     158     *       so instead this minimalist approach was choosen in stead. */
     159    KU32                uNameHash;
     160    /** Pointer to the next child with the same name hash value. */
     161    PKFSOBJ             pNextNameHash;
    165162    /** Pointer to the parent (directory).
    166163     * This is only NULL for a root. */
     
    231228    KU32                cChildrenAllocated;
    232229
    233     /** Pointer to the hash table.
    234      * @todo this isn't quite there yet, structure wise. sigh.  */
    235     PKFSOBJHASH         paHashTab;
    236     /** The size of the hash table.
    237      * @remarks The hash table is optional and only used when there are a lot of
    238      *          entries in the directory. */
    239     KU32                cHashTab;
     230    /** Pointer to the child hash table. */
     231    PKFSOBJ            *papHashTab;
     232    /** The mask shift of the hash table.
     233     * Hash table size is a power of two, this is the size minus one.
     234     *
     235     * @remarks The hash table is optional and populated by lookup hits.  The
     236     *          assumption being that a lookup is repeated and will choose a good
     237     *          name to hash on.  We've got up to 4 different hashes, so this
     238     *          was the easy way out. */
     239    KU32                fHashTabMask;
    240240
    241241    /** Handle to the directory (we generally keep it open). */
     
    401401    /** Number of hits walking the file system hierarchy. */
    402402    KSIZE               cWalkHits;
     403    /** Number of child searches. */
     404    KSIZE               cChildSearches;
     405    /** Number of cChildLookups resolved thru hash table hits. */
     406    KSIZE               cChildHashHits;
     407    /** The number of child hash tables. */
     408    KSIZE               cChildHashTabs;
     409    /** The sum of all child hash table sizes. */
     410    KSIZE               cChildHashEntriesTotal;
     411    /** Number of children inserted into the hash tables. */
     412    KSIZE               cChildHashed;
     413    /** Number of collisions in the child hash tables */
     414    KSIZE               cChildHashCollisions;
    403415
    404416    /** The root directory. */
Note: See TracChangeset for help on using the changeset viewer.