[Libsysio-commit] HEAD: libsysio/src inode.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2008-04-23 16:46:43
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27174/src Modified Files: inode.c Log Message: If P_RECLAIM_DEBUG is definded then at each reclaim a count of the number of pnode_base nodes present in the system is printed along with the number of those that are leaves and the number of interior nodes without aliases (orphpans). Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -w -b -B -p -r1.41 -r1.42 --- inode.c 23 Apr 2008 00:24:50 -0000 1.41 +++ inode.c 23 Apr 2008 16:46:40 -0000 1.42 @@ -107,6 +107,10 @@ static size_t max_names; */ struct pnodes_head _sysio_idle_pnodes; +#ifdef P_RECLAIM_DEBUG +static LIST_HEAD(, pnode_base) pbnodes; +#endif + /* * The system root -- Aka `/'. */ @@ -331,6 +335,33 @@ _sysio_i_undead(struct inode *ino) ino->i_zombie = 1; } +#ifdef P_RECLAIM_DEBUG +static void +p_reclaim_debug() +{ + struct pnode_base *nxt, *pb; + unsigned long npb, npbleaves, npborphans; + + npb = 0; + npbleaves = 0; + npborphans = 0; + + nxt = pbnodes.lh_first; + while ((pb = nxt)) { + nxt = pb->pb_links.le_next; + npb++; + if (!pb->pb_children.lh_first) + npbleaves++; + else if (!pb->pb_aliases.lh_first) + npborphans++; + } + _sysio_cprintf("PBSTATS: n %lu, leaves %lu, orphans %lu\n", + npb, + npbleaves, + npborphans); +} +#endif + /* * Garbage collect idle path (and base path) nodes tracked by the system. */ @@ -346,6 +377,10 @@ p_reclaim(unsigned count) if (count) adjust = 1; +#ifdef P_RECLAIM_DEBUG + p_reclaim_debug(); +#endif + INO_CST_UPDCNT(preclaims); next = _sysio_idle_pnodes.tqh_first; if (!next) @@ -505,6 +540,9 @@ _sysio_pb_new(struct qstr *name, struct LIST_INIT(&pb->pb_aliases); if (parent) LIST_INSERT_HEAD(&parent->pb_children, pb, pb_sibs); +#ifdef P_RECLAIM_DEBUG + LIST_INSERT_HEAD(&pbnodes, pb, pb_links); +#endif n_names++; assert(n_names); @@ -531,6 +569,9 @@ pb_destroy(struct pnode_base *pb) ncache_delete(pb); if (pb->pb_key.pbk_parent) LIST_REMOVE(pb, pb_sibs); +#ifdef P_RECLAIM_DEBUG + LIST_REMOVE(pb, pb_links); +#endif free(pb); } |