From 18459cd32abe9aba75d46910f9a676e4a535e0da Mon Sep 17 00:00:00 2001 From: Chas Williams - CONTRACTOR Date: Thu, 7 Jan 2010 18:07:43 -0500 Subject: [PATCH] afsd: decprecate -mem_alloc_sleep flag (and related code) On most platforms, afs_osi_Alloc_NoSleep() is already afs_osi_Alloc(). I have tested this on Solaris (the major exception) and haven't seen any problems. Change-Id: I0e8bfd76b2bd25889c1491633a3a6d50aceac510 Reviewed-on: http://gerrit.openafs.org/1079 Reviewed-by: Simon Wilkinson Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/afs/afs_memcache.c | 16 ++-------------- src/afsd/afsd.c | 2 +- src/config/afs_args.h | 2 -- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/afs/afs_memcache.c b/src/afs/afs_memcache.c index 8853fa497..65fc2bdd8 100644 --- a/src/afs/afs_memcache.c +++ b/src/afs/afs_memcache.c @@ -22,7 +22,6 @@ static struct memCacheEntry *memCache; static int memCacheBlkSize = 8192; static int memMaxBlkNumber = 0; -static int memAllocMaySleep = 0; extern int cacheDiskType; @@ -38,20 +37,13 @@ afs_InitMemCache(int blkCount, int blkSize, int flags) memMaxBlkNumber = blkCount; memCache = (struct memCacheEntry *) afs_osi_Alloc(memMaxBlkNumber * sizeof(struct memCacheEntry)); - if (flags & AFSCALL_INIT_MEMCACHE_SLEEP) { - memAllocMaySleep = 1; - } for (index = 0; index < memMaxBlkNumber; index++) { char *blk; (memCache + index)->size = 0; (memCache + index)->dataSize = memCacheBlkSize; LOCK_INIT(&((memCache + index)->afs_memLock), "afs_memLock"); - if (memAllocMaySleep) { - blk = afs_osi_Alloc(memCacheBlkSize); - } else { - blk = afs_osi_Alloc_NoSleep(memCacheBlkSize); - } + blk = afs_osi_Alloc(memCacheBlkSize); if (blk == NULL) goto nomem; (memCache + index)->data = blk; @@ -188,11 +180,7 @@ afs_MemWriteBlk(register struct osi_file *fP, int offset, void *src, if (size + offset > mceP->dataSize) { char *oldData = mceP->data; - if (memAllocMaySleep) { - mceP->data = afs_osi_Alloc(size + offset); - } else { - mceP->data = afs_osi_Alloc_NoSleep(size + offset); - } + mceP->data = afs_osi_Alloc(size + offset); if (mceP->data == NULL) { /* no available memory */ mceP->data = oldData; /* revert back change that was made */ ReleaseWriteLock(&mceP->afs_memLock); diff --git a/src/afsd/afsd.c b/src/afsd/afsd.c index 268a6570b..adc6becd0 100644 --- a/src/afsd/afsd.c +++ b/src/afsd/afsd.c @@ -1666,7 +1666,7 @@ mainproc(struct cmd_syndesc *as, void *arock) } if (as->parms[23].items) { /* -mem_alloc_sleep */ - cacheFlags |= AFSCALL_INIT_MEMCACHE_SLEEP; + printf("afsd: -mem_alloc_sleep is deprecated -- ignored\n"); } if (as->parms[24].items) { /* -afsdb */ diff --git a/src/config/afs_args.h b/src/config/afs_args.h index 2bd77ef53..90368617b 100644 --- a/src/config/afs_args.h +++ b/src/config/afs_args.h @@ -99,8 +99,6 @@ /* these are for initialization flags */ #define AFSCALL_INIT_MEMCACHE 0x1 -#define AFSCALL_INIT_MEMCACHE_SLEEP 0x2 /* Use osi_Alloc to allocate memcache - * instead of osi_Alloc_NoSleep */ /* flags for rxstats pioctl */ -- 2.39.5