[PVFS2-CVS]
commit by neill in pvfs2/src/client/sysint: acache.c acache.h
CVS commit program
cvs at parl.clemson.edu
Tue Jul 27 14:08:52 EDT 2004
Update of /projects/cvsroot/pvfs2/src/client/sysint
In directory parlweb:/tmp/cvs-serv31978/src/client/sysint
Modified Files:
acache.c acache.h
Log Message:
- some acache tweaks and more comments -- try to more aggressively reclaim
cache entries if we've reached the specified soft limit
- re-disable the acache timeout in the pvfs2-client-core; my testing is done
for now as we can build pvfs2 on pvfs2 at this point with the acache enabled
- kernel fix: if we know the file system is still mounted at device close time,
don't try to shrink the dcache based on the sb
Index: acache.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/acache.c,v
diff -p -u -r1.11 -r1.12
--- acache.c 26 Jul 2004 21:32:41 -0000 1.11
+++ acache.c 27 Jul 2004 17:08:52 -0000 1.12
@@ -181,12 +181,12 @@ static PINT_pinode *acache_internal_look
}
/*
- returns the pinode matching the specified reference if
- present in the acache. returns NULL otherwise.
+ returns the pinode matching the specified reference if present in
+ the acache. returns NULL otherwise.
- NOTE: if a pinode is returned, it is returned with the
- lock held. That means no one else can use it before
- the lock is released (in release, or set_valid);
+ NOTE: if a pinode is returned, it is returned with the lock held.
+ That means no one else can use it before the lock is released (in
+ release, or set_valid);
*/
PINT_pinode *PINT_acache_lookup(PVFS_object_ref refn)
{
@@ -225,12 +225,14 @@ PINT_pinode *PINT_acache_pinode_alloc()
#ifdef PINT_ACACHE_AUTO_CLEANUP
gen_mutex_lock(&s_acache_interface_mutex);
/*
- PINT_ACACHE_NUM_FLUSH_ENTRIES is a soft limit that triggers
- an attempt to reclaim any expired or invalidated entries
- that currently reside in the acache.
+ PINT_ACACHE_NUM_FLUSH_ENTRIES is a soft limit that triggers an
+ attempt to reclaim any expired or invalidated entries that
+ currently reside in the acache.
*/
- if (s_acache_allocated_entries &&
- (s_acache_allocated_entries % PINT_ACACHE_NUM_FLUSH_ENTRIES) == 0)
+ if (((s_acache_allocated_entries &&
+ (s_acache_allocated_entries %
+ PINT_ACACHE_NUM_FLUSH_ENTRIES) == 0)) ||
+ (s_acache_allocated_entries > PINT_ACACHE_NUM_ENTRIES))
{
reclaim_pinode_entries();
}
@@ -391,7 +393,7 @@ static int pinode_hash_refn(void *refn_p
tmp += (unsigned long)(refn->handle + refn->fs_id);
tmp = tmp%table_size;
- return ((int)tmp);
+ return (int)tmp;
}
static int pinode_hash_refn_compare(void *key, struct qlist_head *link)
@@ -405,9 +407,9 @@ static int pinode_hash_refn_compare(void
if ((pinode->refn.handle == refn->handle) &&
(pinode->refn.fs_id == refn->fs_id))
{
- return(1);
+ return 1;
}
- return(0);
+ return 0;
}
/* never call this directly; internal use only */
@@ -589,10 +591,10 @@ static void reclaim_pinode_entries()
reclaim_exit:
gen_mutex_unlock(s_acache_htable_mutex);
}
-/* fprintf(stderr,"reclaim_pinode_entries reclaimed %d entries\n", */
-/* num_reclaimed); */
-/* fprintf(stderr,"Total allocated is %d\n", */
-/* s_acache_allocated_entries); */
+ gossip_debug(GOSSIP_ACACHE_DEBUG, "reclaim_pinode_entries "
+ "reclaimed %d entries\n", num_reclaimed);
+ gossip_debug(GOSSIP_ACACHE_DEBUG, "Total allocated is %d\n",
+ s_acache_allocated_entries);
acache_debug("reclaim_pinode_entries exited\n");
}
#endif /* PINT_ACACHE_AUTO_CLEANUP */
Index: acache.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/acache.h,v
diff -p -u -r1.5 -r1.6
--- acache.h 26 Jul 2004 21:32:41 -0000 1.5
+++ acache.h 27 Jul 2004 17:08:52 -0000 1.6
@@ -59,6 +59,15 @@
are no longer being referenced. If none meet these requirements,
nothing is reclaimed. The important thing is that we've tried.
this 'feature' is mostly untested and may not be beneficial.
+
+ PINT_ACACHE_NUM_ENTRIES is a soft limit. when there are more
+ allocated entries than this number, the reclaim becomes much more
+ aggressive, but we still can't guarantee to free any entries if
+ they're all valid (as callers have references that we can't pull out
+ from under them). in practice, the reclaim appears to work very
+ well, but if it becomes a problem and we need an absolute hard
+ limit, we could fail the allocations of new pinodes (and modify the
+ caller code to better handle allocation failures)
*/
#define PINT_ACACHE_TIMEOUT_MS 5000
More information about the PVFS2-CVS
mailing list