]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
Merge 231831:
authorglebius <glebius@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 14 Apr 2012 10:13:36 +0000 (10:13 +0000)
committerglebius <glebius@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 14 Apr 2012 10:13:36 +0000 (10:13 +0000)
commit5bd6ea79ce3794b8ef5bfc9b867aabc047f25925
tree577962d9e7c6ef775c6b5c7178ad84a4ffb1f844
parent758b4fe974cc49b8cb9fdaedb6a53c406a29a85e
Merge 231831:
  Refactor the name hash and the ID hash, that are used to address nodes:

  - Make hash sizes growable, to satisfy users running large mpd
    installations, having thousands of nodes.
  - NG_NAMEHASH() proved to give a very bad distribution in real life
    name sets, while generic hash32_str(name, HASHINIT) proved to give
    an even one, so use the latter for name hash.
  - Do not store unnamed nodes in slot 0 of name hash, no reason for that.
  - Use the ID hash in cases when we need to run through all nodes: the
    NGM_LISTNODES command and in the vnet_netgraph_uninit().
  - Implement NGM_LISTNODES and NGM_LISTNAMES as separate code, the former
    iterates through the ID hash, and the latter through the name hash.
  - Keep count of all nodes and of named nodes, so that we don't need
    to count nodes in NGM_LISTNODES and NGM_LISTNAMES. The counters are
    also used to estimate whether we need to grow hashes.
  - Close a race between two threads running ng_name_node() assigning same
    name to different nodes.

git-svn-id: svn://svn.freebsd.org/base/stable/9@234277 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/netgraph/netgraph.h
sys/netgraph/ng_base.c