switch to struct lnet_nid and adjust accordingly.
Note the return value of nrs_crrn_cmpfn() is changed from a bool to
"0 or negative error" to make it more clear which is success and which
is failure. The end result is the same.
Test-Parameters:trivial testlist=sanityn envdefinitions=ONLY=77b
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I3e5f2e9d88d7aeccb68ebfb4c814cc4e388cbc42
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50100
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: jsimmons <jsimmons@infradead.org>
Reviewed-by: Nikitas Angelinas <nikitas.angelinas@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
struct nrs_crrn_client {
struct ptlrpc_nrs_resource cc_res;
struct rhash_head cc_rhead;
struct nrs_crrn_client {
struct ptlrpc_nrs_resource cc_res;
struct rhash_head cc_rhead;
+ struct lnet_nid cc_nid;
/**
* The round number against which this client is currently scheduling
* requests.
/**
* The round number against which this client is currently scheduling
* requests.
static int nrs_crrn_cmpfn(struct rhashtable_compare_arg *arg, const void *obj)
{
const struct nrs_crrn_client *cli = obj;
static int nrs_crrn_cmpfn(struct rhashtable_compare_arg *arg, const void *obj)
{
const struct nrs_crrn_client *cli = obj;
- const lnet_nid_t *nid = arg->key;
+ const struct lnet_nid *nid = arg->key;
- return *nid != cli->cc_nid;
+ return nid_same(nid, &cli->cc_nid) ? 0 : -ESRCH;
}
static const struct rhashtable_params nrs_crrn_hash_params = {
}
static const struct rhashtable_params nrs_crrn_hash_params = {
- .key_len = sizeof(lnet_nid_t),
+ .key_len = sizeof(struct lnet_nid),
.key_offset = offsetof(struct nrs_crrn_client, cc_nid),
.head_offset = offsetof(struct nrs_crrn_client, cc_rhead),
.hashfn = nrs_crrn_hashfn,
.key_offset = offsetof(struct nrs_crrn_client, cc_nid),
.head_offset = offsetof(struct nrs_crrn_client, cc_rhead),
.hashfn = nrs_crrn_hashfn,
LASSERTF(atomic_read(&cli->cc_ref) == 0,
"Busy CRR-N object from client with NID %s, with %d refs\n",
LASSERTF(atomic_read(&cli->cc_ref) == 0,
"Busy CRR-N object from client with NID %s, with %d refs\n",
- libcfs_nid2str(cli->cc_nid), atomic_read(&cli->cc_ref));
+ libcfs_nidstr(&cli->cc_nid), atomic_read(&cli->cc_ref));
struct nrs_crrn_client *cli;
struct nrs_crrn_client *tmp;
struct ptlrpc_request *req;
struct nrs_crrn_client *cli;
struct nrs_crrn_client *tmp;
struct ptlrpc_request *req;
if (parent == NULL) {
*resp = &((struct nrs_crrn_net *)policy->pol_private)->cn_res;
if (parent == NULL) {
*resp = &((struct nrs_crrn_net *)policy->pol_private)->cn_res;
net = container_of(parent, struct nrs_crrn_net, cn_res);
req = container_of(nrq, struct ptlrpc_request, rq_nrq);
net = container_of(parent, struct nrs_crrn_net, cn_res);
req = container_of(nrq, struct ptlrpc_request, rq_nrq);
- nid4 = lnet_nid_to_nid4(&req->rq_peer.nid);
- cli = rhashtable_lookup_fast(&net->cn_cli_hash, &nid4,
+ cli = rhashtable_lookup_fast(&net->cn_cli_hash, &req->rq_peer.nid,
nrs_crrn_hash_params);
if (cli)
goto out;
nrs_crrn_hash_params);
if (cli)
goto out;
if (cli == NULL)
return -ENOMEM;
if (cli == NULL)
return -ENOMEM;
+ cli->cc_nid = req->rq_peer.nid;
atomic_set(&cli->cc_ref, 0);
atomic_set(&cli->cc_ref, 0);