From b518ffc0da37d38f05fa1d35852500784caefba6 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 26 Mar 2013 09:08:58 -0400 Subject: [PATCH] Windows: btree enumeration bulk stats Each of the btree enumeration bulk stat operations include the directory object in the bulk stat list. If the only object in the list is the directory object, do not perform the bulk stat rpc as it just wastes time. All of the required objects are already cached with current callbacks. Change-Id: Ic0fac50f36bdca1e79f48ca308c373a2b3152675 Reviewed-on: http://gerrit.openafs.org/9675 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/cm_btree.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/WINNT/afsd/cm_btree.c b/src/WINNT/afsd/cm_btree.c index b6a9f0e..48e1027 100644 --- a/src/WINNT/afsd/cm_btree.c +++ b/src/WINNT/afsd/cm_btree.c @@ -2357,6 +2357,7 @@ cm_BPlusDirEnumBulkStat(cm_direnum_t *enump) int i; cm_scache_t *tscp; afs_int32 nobulkstat = 0; + afs_int32 base = 1; cm_InitReq(&req); req.flags = enump->reqFlags; @@ -2443,6 +2444,7 @@ cm_BPlusDirEnumBulkStat(cm_direnum_t *enump) enump->entry[count].flags |= CM_DIRENUM_FLAG_GOT_STATUS; if (bsp->counter == AFSCBMAX) { + base = 0; code = cm_TryBulkStatRPC(dscp, bsp, userp, &req); if (code == CM_ERROR_BULKSTAT_FAILURE) { /* @@ -2487,7 +2489,12 @@ cm_BPlusDirEnumBulkStat(cm_direnum_t *enump) } } - if (bsp->counter > 0) { + /* + * if the counter is 1, only the directory entry is in the list, + * do not issue the RPC. + */ + + if (bsp->counter > base) { code = cm_TryBulkStatRPC(dscp, bsp, userp, &req); if (code == CM_ERROR_BULKSTAT_FAILURE) { /* @@ -2652,8 +2659,14 @@ cm_BPlusDirEnumBulkStatOne(cm_direnum_t *enump, cm_scache_t *scp) bsp->counter++; } - if (bsp->counter > 0) { + /* + * if the counter is 1, only the directory entry is in the list, + * do not issue the RPC. + */ + + if (bsp->counter > 1) { code = cm_TryBulkStatRPC(dscp, bsp, userp, &req); + /* Now process any errors that might have occurred */ if (code == CM_ERROR_BULKSTAT_FAILURE) { for (i=2; icounter; i++) { @@ -2786,8 +2799,14 @@ cm_BPlusDirEnumBulkStatNext(cm_direnum_t *enump) bsp->counter++; } - if (bsp->counter > 0) { + /* + * if the counter is 1, only the directory entry is in the list, + * do not issue the RPC. + */ + + if (bsp->counter > 1) { code = cm_TryBulkStatRPC(dscp, bsp, userp, &req); + /* Now process any errors that might have occurred */ if (code == CM_ERROR_BULKSTAT_FAILURE) { for (i=0; icounter; i++) { -- 1.9.4