Whamcloud - gitweb
LU-12678 lnet: me: discard struct lnet_handle_me 59/36859/8
authorMr NeilBrown <neilb@suse.de>
Sat, 18 Jan 2020 13:41:38 +0000 (08:41 -0500)
committerOleg Drokin <green@whamcloud.com>
Tue, 28 Jan 2020 06:03:38 +0000 (06:03 +0000)
commitceeeae4271fdda75a1a064774ea28aca75f347ed
tree993cab0a44a24bb97934274c9748bdabd0b1973a
parentc087091cd9014c78883efcc74c10952e6923906c
LU-12678 lnet: me: discard struct lnet_handle_me

The Portals API uses a cookie 'handle' to identify an ME.  This is
appropriate for a user-space API for objects maintained by the
kernel, but it brings no value when the API client and
implementation are both in the kernel, as is the case with Lustre
and LNet.

Instead of using a 'handle', a pointer to the 'struct lnet_me' can
be used.  This object is not reference counted and is always freed
correctly, so there can be no case where the cookie becomes invalid
while it is still held - as can be seen by the fact that the return
value from LNetMEUnlink() is never used except to assert that it is
zero.

So use 'struct lnet_me *' directly instead of having indirection
through a 'struct lnet_handle_me'.

Also:
 - change LNetMEUnlink() to return void as it cannot fail now.
 - have LNetMEAttach() return the pointer, using ERR_PTR() to return
   errors.
 - discard ln_me_containers and don't store the me there-in.
 - store an explicit 'cpt' in each me, we no longer store one
   implicitly via the cookie.

Test-Parameters: trivial testlist=sanity-lnet
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I4e73e3217a244d8d15da90a8ba80371d1fd5f61f
Reviewed-on: https://review.whamcloud.com/36859
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/include/lnet/api.h
lnet/include/lnet/lib-lnet.h
lnet/include/lnet/lib-types.h
lnet/include/uapi/linux/lnet/lnet-types.h
lnet/lnet/api-ni.c
lnet/lnet/lib-md.c
lnet/lnet/lib-me.c
lnet/selftest/rpc.c
lustre/ptlrpc/niobuf.c