Whamcloud - gitweb
LU-56 lnet: split lnet_commit_md and cleanup
authorLiang Zhen <liang@whamcloud.com>
Fri, 1 Jun 2012 05:53:01 +0000 (13:53 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 22 Jun 2012 07:41:15 +0000 (03:41 -0400)
commit75a8f4b4aa9ad6bf697aedece539e62111e9029a
treed434067c8d7ba975ad3896867f0b0480df26354f
parent938f645db07ee57bcc0f6b687cf60044d161ed50
LU-56 lnet: split lnet_commit_md and cleanup

Briefly, LNet has two types of operations: 1) resource operations
on EQ, MD and ME; 2) network operations on credits, peer, NI etc.
Most of them are in different logic blocks, but there are still
a few functions have mixed operations, lnet_commit_md() is one of
these functions.

This patch is a key step for LNet SMP improvements, lnet_commit_md()
of current LNet did two things: 1) consume MD threshold and commit
it to network; 2) attach the message on active message list to show
it might have taken LNet message credits. This patch split it into
two sets of functions, lnet_msg_attach/detach_md and
lnet_msg_commit/decommit,

We need to call lnet_msg_attach_md and lnet_msg_comit before deliver
a message to network, call lnet_msg_detach_md and lnet_msg_decommit
while finalizing a message. These two sets of functions will be
protected by different locks in upcoming patches.

Another change in this patch is, we moved most counters operations
into lnet_msg_decommit, this will make code cleaner and easier for
the next step work. The reason that we put counters operations in
lnet_msg_decommit instead of lnet_msg_commit is because we can't
guarantee lnet_msg_commit is always called after lnet_msg_attach_md,
and counters need information filled by lnet_msg_attach_md, which
means lnet_msg_commit might not have enough information for counters.
The thing we know for sure is lnet_msg_decommit is always called
after lnet_msg_attach_md, so it's safe to put counter operations
inside lnet_msg_decommit.

Signed-off-by: Liang Zhen <liang@whamcloud.com>
Change-Id: Iee961fbff6e6e39ed76c14c0bd5b6560a7730af9
Reviewed-on: http://review.whamcloud.com/2997
Tested-by: Hudson
Reviewed-by: Doug Oucharek <doug@whamcloud.com>
Reviewed-by: Bobi Jam <bobijam@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lnet/include/lnet/lib-lnet.h
lnet/include/lnet/lib-types.h
lnet/include/lnet/types.h
lnet/lnet/lib-move.c
lnet/lnet/lib-msg.c
lnet/lnet/lib-ptl.c