From 71f91cd93cb6e8c7430ddab7e5b9e0220070730e Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sun, 2 May 2010 15:26:39 -0400 Subject: [PATCH] Windows: Permit BPlus tree lookups within cm_ApplyDir BPlus tree lookups are much faster than searching through the native directory format on Windows because the case sensitive hash tables cannot be used successfully. Permit BPlus trees to be used except when called with cm_BPlusDirFoo as the action function because cm_BPlusDirFoo is used to build the BPlus trees from the native directory format. LICENSE MIT Change-Id: I3f6f5ba7113e206c76fafd1ec83822adc7f42f9e Reviewed-on: http://gerrit.openafs.org/1893 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/cm_vnodeops.c | 65 +++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/src/WINNT/afsd/cm_vnodeops.c b/src/WINNT/afsd/cm_vnodeops.c index ab23c53444..39988eb5eb 100644 --- a/src/WINNT/afsd/cm_vnodeops.c +++ b/src/WINNT/afsd/cm_vnodeops.c @@ -483,53 +483,56 @@ long cm_ApplyDir(cm_scache_t *scp, cm_DirFuncp_t funcp, void *parmp, return 0; } sp->caseFold = casefold; + } - /* see if we can find it using the directory hash tables. - we can only do exact matches, since the hash is case - sensitive. */ - { - cm_dirOp_t dirop; + /* + * see if we can find it using the directory hash tables. + * we can only do exact matches, since the hash is case + * sensitive. + */ + if (funcp != (cm_DirFuncp_t)cm_BPlusDirFoo) + { + cm_dirOp_t dirop; #ifdef USE_BPLUS - int usedBplus = 0; + int usedBplus = 0; #endif - code = ENOENT; + code = ENOENT; - code = cm_BeginDirOp(scp, userp, reqp, CM_DIRLOCK_READ, &dirop); - if (code == 0) { + code = cm_BeginDirOp(scp, userp, reqp, CM_DIRLOCK_READ, &dirop); + if (code == 0) { #ifdef USE_BPLUS - code = cm_BPlusDirLookup(&dirop, sp->nsearchNamep, &sp->fid); - if (code != EINVAL) - usedBplus = 1; - else + code = cm_BPlusDirLookup(&dirop, sp->nsearchNamep, &sp->fid); + if (code != EINVAL) + usedBplus = 1; + else #endif - code = cm_DirLookup(&dirop, sp->searchNamep, &sp->fid); + code = cm_DirLookup(&dirop, sp->searchNamep, &sp->fid); - cm_EndDirOp(&dirop); - } + cm_EndDirOp(&dirop); + } - if (code == 0) { + if (code == 0) { + /* found it */ + sp->found = TRUE; + sp->ExactFound = TRUE; + *retscp = NULL; /* force caller to call cm_GetSCache() */ + return 0; + } +#ifdef USE_BPLUS + if (usedBplus) { + if (sp->caseFold && code == CM_ERROR_INEXACT_MATCH) { /* found it */ sp->found = TRUE; - sp->ExactFound = TRUE; + sp->ExactFound = FALSE; *retscp = NULL; /* force caller to call cm_GetSCache() */ return 0; } -#ifdef USE_BPLUS - if (usedBplus) { - if (sp->caseFold && code == CM_ERROR_INEXACT_MATCH) { - /* found it */ - sp->found = TRUE; - sp->ExactFound = FALSE; - *retscp = NULL; /* force caller to call cm_GetSCache() */ - return 0; - } - - return CM_ERROR_BPLUS_NOMATCH; - } -#endif + + return CM_ERROR_BPLUS_NOMATCH; } +#endif } }