[Libsysio-commit] HEAD: libsysio/src inode.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2008-12-15 19:56:02
|
Update of /cvsroot/libsysio/libsysio/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20145/src Modified Files: inode.c Log Message: The all-pbnodes list is changed to be maintained as a tailq, instead of a simple linked list. Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.49 retrieving revision 1.50 diff -u -w -b -B -p -r1.49 -r1.50 --- inode.c 12 Dec 2008 22:28:15 -0000 1.49 +++ inode.c 15 Dec 2008 19:55:54 -0000 1.50 @@ -93,7 +93,7 @@ static size_t n_names = 0; struct pnodes_head _sysio_idle_pnodes; #ifdef P_RECLAIM_DEBUG -static LIST_HEAD(, pnode_base) pbnodes; +static TAILQ_HEAD(, pnode_base) pbnodes; #endif /* @@ -385,9 +385,9 @@ p_reclaim_debug() npbleaves = 0; npborphans = 0; - nxt = pbnodes.lh_first; + nxt = pbnodes.tqh_first; while ((pb = nxt)) { - nxt = pb->pb_links.le_next; + nxt = pb->pb_links.tqe_next; npb++; if (!pb->pb_children.lh_first) npbleaves++; @@ -545,7 +545,8 @@ _sysio_pb_new(struct qstr *name, struct PB_INIT(pb, name, parent, ino); if (ino) I_REF(ino); - PB_GET(pb); + PB_LOCK(pb); + if (parent) LIST_INSERT_HEAD(&parent->pb_children, pb, pb_sibs); if (pb->pb_key.pbk_name.len) { @@ -562,14 +563,15 @@ _sysio_pb_new(struct qstr *name, struct pb->pb_key.pbk_name.name = cp; ncache_insert(pb); } +#ifdef P_RECLAIM_DEBUG + TAILQ_INSERT_HEAD(&pbnodes, pb, pb_links); +#endif + PB_GET(pb); + PB_UNLOCK(pb); n_names++; assert(n_names); -#ifdef P_RECLAIM_DEBUG - LIST_INSERT_HEAD(&pbnodes, pb, pb_links); -#endif - if (n_names > NAMES_TABLE_LEN) { unsigned n; /* @@ -603,7 +605,7 @@ _sysio_pb_gone(struct pnode_base *pb) if (pb->pb_key.pbk_parent) LIST_REMOVE(pb, pb_sibs); #ifdef P_RECLAIM_DEBUG - LIST_REMOVE(pb, pb_links); + TAILQ_REMOVE(&pbnodes, pb, pb_links); #endif ino = pb->pb_ino; if (ino) |