mirror of
https://git.openafs.org/openafs.git
synced 2025-01-22 17:00:15 +00:00
clean up axscache at shutdown
modify allocations in axscache code to be able to be tracked. at shutdown, clean up allocations. Change-Id: I1fbde0fe49cf0cdeea451dac58718a90f1c87e66 Reviewed-on: http://gerrit.openafs.org/1037 Tested-by: Derrick Brashear <shadow@dementia.org> Reviewed-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
d11ca53be7
commit
0fce88e079
@ -16,8 +16,11 @@
|
|||||||
#include "afs/afs_stats.h" /* statistics */
|
#include "afs/afs_stats.h" /* statistics */
|
||||||
#include "afs/stds.h"
|
#include "afs/stds.h"
|
||||||
static struct axscache *afs_axsfreelist = NULL;
|
static struct axscache *afs_axsfreelist = NULL;
|
||||||
|
|
||||||
|
#define NAXSs (1000 / sizeof(struct axscache))
|
||||||
static struct xfreelist {
|
static struct xfreelist {
|
||||||
struct xfreelist *next;
|
struct xfreelist *next;
|
||||||
|
struct axscache data[NAXSs];
|
||||||
} *xfreemallocs = 0;
|
} *xfreemallocs = 0;
|
||||||
static int afs_xaxscnt = 0;
|
static int afs_xaxscnt = 0;
|
||||||
afs_rwlock_t afs_xaxs;
|
afs_rwlock_t afs_xaxs;
|
||||||
@ -52,24 +55,25 @@ afs_SlowFindAxs(struct axscache **cachep, afs_int32 id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define NAXSs (1000 / sizeof(struct axscache))
|
|
||||||
struct axscache *
|
struct axscache *
|
||||||
axs_Alloc(void)
|
axs_Alloc(void)
|
||||||
{
|
{
|
||||||
register struct axscache *i, *j, *xsp;
|
struct axscache *i, *j;
|
||||||
struct axscache *h;
|
struct xfreelist *h, *xsp;
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
ObtainWriteLock(&afs_xaxs, 174);
|
ObtainWriteLock(&afs_xaxs, 174);
|
||||||
if ((h = afs_axsfreelist)) {
|
if ((i = afs_axsfreelist)) {
|
||||||
afs_axsfreelist = h->next;
|
afs_axsfreelist = i->next;
|
||||||
|
ReleaseWriteLock(&afs_xaxs);
|
||||||
|
return i;
|
||||||
} else {
|
} else {
|
||||||
h = i = j =
|
h = afs_osi_Alloc(sizeof(struct xfreelist));
|
||||||
(struct axscache *)afs_osi_Alloc(NAXSs * sizeof(struct axscache));
|
|
||||||
afs_xaxscnt++;
|
afs_xaxscnt++;
|
||||||
xsp = (struct axscache *)xfreemallocs;
|
xsp = xfreemallocs;
|
||||||
xfreemallocs = (struct xfreelist *)h;
|
xfreemallocs = h;
|
||||||
xfreemallocs->next = (struct xfreelist *)xsp;
|
xfreemallocs->next = xsp;
|
||||||
|
i = j = h->data;
|
||||||
for (k = 0; k < NAXSs - 1; k++, i++) {
|
for (k = 0; k < NAXSs - 1; k++, i++) {
|
||||||
i->uid = -2;
|
i->uid = -2;
|
||||||
i->axess = 0;
|
i->axess = 0;
|
||||||
@ -78,10 +82,10 @@ axs_Alloc(void)
|
|||||||
i->uid = -2;
|
i->uid = -2;
|
||||||
i->axess = 0;
|
i->axess = 0;
|
||||||
i->next = NULL;
|
i->next = NULL;
|
||||||
afs_axsfreelist = h->next;
|
afs_axsfreelist = (h->data)->next;
|
||||||
}
|
}
|
||||||
ReleaseWriteLock(&afs_xaxs);
|
ReleaseWriteLock(&afs_xaxs);
|
||||||
return (h);
|
return (h->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -165,8 +169,7 @@ afs_FreeAllAxs(struct axscache **headp)
|
|||||||
|
|
||||||
|
|
||||||
/* doesn't appear to be used at all */
|
/* doesn't appear to be used at all */
|
||||||
#if 0
|
void
|
||||||
static void
|
|
||||||
shutdown_xscache(void)
|
shutdown_xscache(void)
|
||||||
{
|
{
|
||||||
struct xfreelist *xp, *nxp;
|
struct xfreelist *xp, *nxp;
|
||||||
@ -175,10 +178,9 @@ shutdown_xscache(void)
|
|||||||
xp = xfreemallocs;
|
xp = xfreemallocs;
|
||||||
while (xp) {
|
while (xp) {
|
||||||
nxp = xp->next;
|
nxp = xp->next;
|
||||||
afs_osi_Free((char *)xp, NAXSs * sizeof(struct axscache));
|
afs_osi_Free(xp, sizeof(struct xfreelist));
|
||||||
xp = nxp;
|
xp = nxp;
|
||||||
}
|
}
|
||||||
afs_axsfreelist = NULL;
|
afs_axsfreelist = NULL;
|
||||||
xfreemallocs = NULL;
|
xfreemallocs = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
@ -1331,6 +1331,7 @@ afs_shutdown(void)
|
|||||||
shutdown_osifile();
|
shutdown_osifile();
|
||||||
shutdown_vnodeops();
|
shutdown_vnodeops();
|
||||||
shutdown_memcache();
|
shutdown_memcache();
|
||||||
|
shutdown_xscache();
|
||||||
#if (!defined(AFS_NONFSTRANS) || defined(AFS_AIX_IAUTH_ENV))
|
#if (!defined(AFS_NONFSTRANS) || defined(AFS_AIX_IAUTH_ENV))
|
||||||
shutdown_exporter();
|
shutdown_exporter();
|
||||||
shutdown_nfsclnt();
|
shutdown_nfsclnt();
|
||||||
|
@ -22,6 +22,7 @@ extern struct axscache *afs_SlowFindAxs(struct axscache **cachep,
|
|||||||
extern struct axscache *axs_Alloc(void);
|
extern struct axscache *axs_Alloc(void);
|
||||||
extern void afs_RemoveAxs(struct axscache **headp, struct axscache *axsp);
|
extern void afs_RemoveAxs(struct axscache **headp, struct axscache *axsp);
|
||||||
extern void afs_FreeAllAxs(struct axscache **headp);
|
extern void afs_FreeAllAxs(struct axscache **headp);
|
||||||
|
extern void shutdown_xscache(void);
|
||||||
|
|
||||||
/* afs_buffer.c */
|
/* afs_buffer.c */
|
||||||
extern void DInit(int abuffers);
|
extern void DInit(int abuffers);
|
||||||
|
Loading…
Reference in New Issue
Block a user