Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-8726 osd-ldiskfs: bypass read for benchmarking
[fs/lustre-release.git]
/
lnet
/
selftest
/
conrpc.c
diff --git
a/lnet/selftest/conrpc.c
b/lnet/selftest/conrpc.c
index
de80dd9
..
b445183
100644
(file)
--- a/
lnet/selftest/conrpc.c
+++ b/
lnet/selftest/conrpc.c
@@
-15,11
+15,7
@@
*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
*
* GPL HEADER END
*/
*
* GPL HEADER END
*/
@@
-27,7
+23,7
@@
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 201
4
, Intel Corporation.
+ * Copyright (c) 2011, 201
6
, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
*/
/*
* This file is part of Lustre, http://www.lustre.org/
@@
-40,7
+36,6
@@
* Author: Liang Zhen <liang@whamcloud.com>
*/
* Author: Liang Zhen <liang@whamcloud.com>
*/
-#ifdef __KERNEL__
#include <libcfs/libcfs.h>
#include <lnet/lib-lnet.h>
#include <libcfs/libcfs.h>
#include <lnet/lib-lnet.h>
@@
-49,7
+44,7
@@
#include "console.h"
void lstcon_rpc_stat_reply(lstcon_rpc_trans_t *, srpc_msg_t *,
#include "console.h"
void lstcon_rpc_stat_reply(lstcon_rpc_trans_t *, srpc_msg_t *,
- lstcon_node_t *,
lstcon_trans_stat_
t *);
+ lstcon_node_t *,
struct lstcon_trans_sta
t *);
static void
lstcon_rpc_done(srpc_client_rpc_t *rpc)
static void
lstcon_rpc_done(srpc_client_rpc_t *rpc)
@@
-423,7
+418,7
@@
lstcon_rpc_get_reply(lstcon_rpc_t *crpc, srpc_msg_t **msgpp)
}
void
}
void
-lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans,
lstcon_trans_stat_
t *stat)
+lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans,
struct lstcon_trans_sta
t *stat)
{
lstcon_rpc_t *crpc;
srpc_msg_t *rep;
{
lstcon_rpc_t *crpc;
srpc_msg_t *rep;
@@
-475,7
+470,7
@@
lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
{
struct list_head tmp;
struct list_head __user *next;
{
struct list_head tmp;
struct list_head __user *next;
-
lstcon_rpc_ent_
t *ent;
+
struct lstcon_rpc_en
t *ent;
srpc_generic_reply_t *rep;
lstcon_rpc_t *crpc;
srpc_msg_t *msg;
srpc_generic_reply_t *rep;
lstcon_rpc_t *crpc;
srpc_msg_t *msg;
@@
-498,7
+493,7
@@
lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
next = tmp.next;
next = tmp.next;
- ent = list_entry(next,
lstcon_rpc_ent_
t, rpe_link);
+ ent = list_entry(next,
struct lstcon_rpc_en
t, rpe_link);
LASSERT(crpc->crp_stamp != 0);
LASSERT(crpc->crp_stamp != 0);
@@
-511,7
+506,7
@@
lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
cfs_duration_usec(dur, &tv);
if (copy_to_user(&ent->rpe_peer,
cfs_duration_usec(dur, &tv);
if (copy_to_user(&ent->rpe_peer,
- &nd->nd_id, sizeof(
lnet_process_id_t
)) ||
+ &nd->nd_id, sizeof(
struct lnet_process_id
)) ||
copy_to_user(&ent->rpe_stamp, &tv, sizeof(tv)) ||
copy_to_user(&ent->rpe_state,
&nd->nd_state, sizeof(nd->nd_state)) ||
copy_to_user(&ent->rpe_stamp, &tv, sizeof(tv)) ||
copy_to_user(&ent->rpe_state,
&nd->nd_state, sizeof(nd->nd_state)) ||
@@
-526,7
+521,7
@@
lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
rep = (srpc_generic_reply_t *)&msg->msg_body.reply;
if (copy_to_user(&ent->rpe_sid,
rep = (srpc_generic_reply_t *)&msg->msg_body.reply;
if (copy_to_user(&ent->rpe_sid,
- &rep->sid, sizeof(
lst_sid_t
)) ||
+ &rep->sid, sizeof(
rep->sid
)) ||
copy_to_user(&ent->rpe_fwk_errno,
&rep->status, sizeof(rep->status)))
return -EFAULT;
copy_to_user(&ent->rpe_fwk_errno,
&rep->status, sizeof(rep->status)))
return -EFAULT;
@@
-704,17
+699,17
@@
lstcon_statrpc_prep(lstcon_node_t *nd, unsigned feats, lstcon_rpc_t **crpc)
return 0;
}
return 0;
}
-static
lnet_process_id_packed_t
*
+static
struct lnet_process_id_packed
*
lstcon_next_id(int idx, int nkiov, lnet_kiov_t *kiov)
{
lstcon_next_id(int idx, int nkiov, lnet_kiov_t *kiov)
{
-
lnet_process_id_packed_t
*pid;
+
struct lnet_process_id_packed
*pid;
int i;
i = idx / SFW_ID_PER_PAGE;
LASSERT (i < nkiov);
int i;
i = idx / SFW_ID_PER_PAGE;
LASSERT (i < nkiov);
- pid = (
lnet_process_id_packed_t
*)page_address(kiov[i].kiov_page);
+ pid = (
struct lnet_process_id_packed
*)page_address(kiov[i].kiov_page);
return &pid[idx % SFW_ID_PER_PAGE];
}
return &pid[idx % SFW_ID_PER_PAGE];
}
@@
-723,7
+718,7
@@
static int
lstcon_dstnodes_prep(lstcon_group_t *grp, int idx,
int dist, int span, int nkiov, lnet_kiov_t *kiov)
{
lstcon_dstnodes_prep(lstcon_group_t *grp, int idx,
int dist, int span, int nkiov, lnet_kiov_t *kiov)
{
-
lnet_process_id_packed_t
*pid;
+
struct lnet_process_id_packed
*pid;
lstcon_ndlink_t *ndl;
lstcon_node_t *nd;
int start;
lstcon_ndlink_t *ndl;
lstcon_node_t *nd;
int start;
@@
-774,7
+769,7
@@
lstcon_dstnodes_prep(lstcon_group_t *grp, int idx,
}
static int
}
static int
-lstcon_pingrpc_prep(
lst_test_ping_param_t
*param, srpc_test_reqst_t *req)
+lstcon_pingrpc_prep(
struct lst_test_ping_param
*param, srpc_test_reqst_t *req)
{
test_ping_req_t *prq = &req->tsr_u.ping;
{
test_ping_req_t *prq = &req->tsr_u.ping;
@@
-785,27
+780,28
@@
lstcon_pingrpc_prep(lst_test_ping_param_t *param, srpc_test_reqst_t *req)
}
static int
}
static int
-lstcon_bulkrpc_v0_prep(
lst_test_bulk_param_t
*param, srpc_test_reqst_t *req)
+lstcon_bulkrpc_v0_prep(
struct lst_test_bulk_param
*param, srpc_test_reqst_t *req)
{
test_bulk_req_t *brq = &req->tsr_u.bulk_v0;
brq->blk_opc = param->blk_opc;
{
test_bulk_req_t *brq = &req->tsr_u.bulk_v0;
brq->blk_opc = param->blk_opc;
- brq->blk_npg = (param->blk_size + PAGE_
CACHE_
SIZE - 1) /
- PAGE_
CACHE_
SIZE;
+ brq->blk_npg = (param->blk_size + PAGE_SIZE - 1) /
+ PAGE_SIZE;
brq->blk_flags = param->blk_flags;
return 0;
}
static int
brq->blk_flags = param->blk_flags;
return 0;
}
static int
-lstcon_bulkrpc_v1_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req)
+lstcon_bulkrpc_v1_prep(struct lst_test_bulk_param *param, bool is_client,
+ srpc_test_reqst_t *req)
{
test_bulk_req_v1_t *brq = &req->tsr_u.bulk_v1;
brq->blk_opc = param->blk_opc;
brq->blk_flags = param->blk_flags;
brq->blk_len = param->blk_size;
{
test_bulk_req_v1_t *brq = &req->tsr_u.bulk_v1;
brq->blk_opc = param->blk_opc;
brq->blk_flags = param->blk_flags;
brq->blk_len = param->blk_size;
- brq->blk_offset =
0; /* reserved */
+ brq->blk_offset =
is_client ? param->blk_cli_off : param->blk_srv_off;
return 0;
}
return 0;
}
@@
-826,8
+822,8
@@
lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats,
if (transop == LST_TRANS_TSBCLIADD) {
npg = sfw_id_pages(test->tes_span);
nob = (feats & LST_FEAT_BULK_LEN) == 0 ?
if (transop == LST_TRANS_TSBCLIADD) {
npg = sfw_id_pages(test->tes_span);
nob = (feats & LST_FEAT_BULK_LEN) == 0 ?
- npg * PAGE_
CACHE_
SIZE :
- sizeof(
lnet_process_id_packed_t
) * test->tes_span;
+ npg * PAGE_SIZE :
+ sizeof(
struct lnet_process_id_packed
) * test->tes_span;
}
rc = lstcon_rpc_prep(nd, SRPC_SERVICE_TEST, feats, npg, nob, crpc);
}
rc = lstcon_rpc_prep(nd, SRPC_SERVICE_TEST, feats, npg, nob, crpc);
@@
-853,13
+849,13
@@
lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats,
LASSERT(nob > 0);
len = (feats & LST_FEAT_BULK_LEN) == 0 ?
LASSERT(nob > 0);
len = (feats & LST_FEAT_BULK_LEN) == 0 ?
- PAGE_
CACHE_SIZE : min_t(int, nob, PAGE_CACH
E_SIZE);
+ PAGE_
SIZE : min_t(int, nob, PAG
E_SIZE);
nob -= len;
bulk->bk_iovs[i].kiov_offset = 0;
bulk->bk_iovs[i].kiov_len = len;
bulk->bk_iovs[i].kiov_page =
nob -= len;
bulk->bk_iovs[i].kiov_offset = 0;
bulk->bk_iovs[i].kiov_len = len;
bulk->bk_iovs[i].kiov_page =
- alloc_page(GFP_
IOFS
);
+ alloc_page(GFP_
KERNEL
);
if (bulk->bk_iovs[i].kiov_page == NULL) {
lstcon_rpc_put(*crpc);
if (bulk->bk_iovs[i].kiov_page == NULL) {
lstcon_rpc_put(*crpc);
@@
-894,18
+890,19
@@
lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats,
switch (test->tes_type) {
case LST_TEST_PING:
trq->tsr_service = SRPC_SERVICE_PING;
switch (test->tes_type) {
case LST_TEST_PING:
trq->tsr_service = SRPC_SERVICE_PING;
- rc = lstcon_pingrpc_prep((
lst_test_ping_param_t
*)
+ rc = lstcon_pingrpc_prep((
struct lst_test_ping_param
*)
&test->tes_param[0], trq);
break;
case LST_TEST_BULK:
trq->tsr_service = SRPC_SERVICE_BRW;
if ((feats & LST_FEAT_BULK_LEN) == 0) {
&test->tes_param[0], trq);
break;
case LST_TEST_BULK:
trq->tsr_service = SRPC_SERVICE_BRW;
if ((feats & LST_FEAT_BULK_LEN) == 0) {
- rc = lstcon_bulkrpc_v0_prep((
lst_test_bulk_param_t
*)
+ rc = lstcon_bulkrpc_v0_prep((
struct lst_test_bulk_param
*)
&test->tes_param[0], trq);
} else {
&test->tes_param[0], trq);
} else {
- rc = lstcon_bulkrpc_v1_prep((lst_test_bulk_param_t *)
- &test->tes_param[0], trq);
+ rc = lstcon_bulkrpc_v1_prep((struct lst_test_bulk_param *)
+ &test->tes_param[0],
+ trq->tsr_is_client, trq);
}
break;
}
break;
@@
-966,7
+963,7
@@
lstcon_sesnew_stat_reply(lstcon_rpc_trans_t *trans,
void
lstcon_rpc_stat_reply(lstcon_rpc_trans_t *trans, srpc_msg_t *msg,
void
lstcon_rpc_stat_reply(lstcon_rpc_trans_t *trans, srpc_msg_t *msg,
-
lstcon_node_t *nd, lstcon_trans_stat_
t *stat)
+
lstcon_node_t *nd, struct lstcon_trans_sta
t *stat)
{
srpc_rmsn_reply_t *rmsn_rep;
srpc_debug_reply_t *dbg_rep;
{
srpc_rmsn_reply_t *rmsn_rep;
srpc_debug_reply_t *dbg_rep;
@@
-1179,7
+1176,7
@@
lstcon_rpc_pinger(void *arg)
srpc_debug_reqst_t *drq;
lstcon_ndlink_t *ndl;
lstcon_node_t *nd;
srpc_debug_reqst_t *drq;
lstcon_ndlink_t *ndl;
lstcon_node_t *nd;
-
time_t
intv;
+
int
intv;
int count = 0;
int rc;
int count = 0;
int rc;
@@
-1193,10
+1190,10
@@
lstcon_rpc_pinger(void *arg)
return;
}
return;
}
-
if (!console_session.ses_expired &&
-
cfs_time_current_sec
() - console_session.ses_laststamp >
-
(time
_t)console_session.ses_timeout)
-
console_session.ses_expired = 1;
+ if (!console_session.ses_expired &&
+
ktime_get_real_seconds
() - console_session.ses_laststamp >
+
(time64
_t)console_session.ses_timeout)
+ console_session.ses_expired = 1;
trans = console_session.ses_ping;
trans = console_session.ses_ping;
@@
-1251,9
+1248,8
@@
lstcon_rpc_pinger(void *arg)
if (nd->nd_state != LST_NODE_ACTIVE)
continue;
if (nd->nd_state != LST_NODE_ACTIVE)
continue;
- intv = cfs_duration_sec(cfs_time_sub(cfs_time_current(),
- nd->nd_stamp));
- if (intv < (time_t)nd->nd_timeout / 2)
+ intv = cfs_duration_sec(jiffies - nd->nd_stamp);
+ if (intv < nd->nd_timeout / 2)
continue;
rc = lstcon_rpc_init(nd, SRPC_SERVICE_DEBUG,
continue;
rc = lstcon_rpc_init(nd, SRPC_SERVICE_DEBUG,
@@
-1281,8
+1277,8
@@
lstcon_rpc_pinger(void *arg)
CDEBUG(D_NET, "Ping %d nodes in session\n", count);
CDEBUG(D_NET, "Ping %d nodes in session\n", count);
-
ptimer->stt_expires = (cfs_time_t)(cfs_time_current_sec() + LST_PING_INTERVAL)
;
-
stt_add_timer(ptimer);
+
ptimer->stt_expires = ktime_get_real_seconds() + LST_PING_INTERVAL
;
+ stt_add_timer(ptimer);
mutex_unlock(&console_session.ses_mutex);
}
mutex_unlock(&console_session.ses_mutex);
}
@@
-1303,10
+1299,10
@@
lstcon_rpc_pinger_start(void)
return rc;
}
return rc;
}
-
ptimer = &console_session.ses_ping_timer;
-
ptimer->stt_expires = (cfs_time_t)(cfs_time_current_sec() + LST_PING_INTERVAL)
;
+ ptimer = &console_session.ses_ping_timer;
+
ptimer->stt_expires = ktime_get_real_seconds() + LST_PING_INTERVAL
;
-
stt_add_timer(ptimer);
+ stt_add_timer(ptimer);
return 0;
}
return 0;
}
@@
-1322,7
+1318,7
@@
lstcon_rpc_pinger_stop(void)
lstcon_rpc_trans_stat(console_session.ses_ping, lstcon_trans_stat());
lstcon_rpc_trans_destroy(console_session.ses_ping);
lstcon_rpc_trans_stat(console_session.ses_ping, lstcon_trans_stat());
lstcon_rpc_trans_destroy(console_session.ses_ping);
-
memset(lstcon_trans_stat(), 0, sizeof(lstcon_trans_stat_
t));
+
memset(lstcon_trans_stat(), 0, sizeof(struct lstcon_trans_sta
t));
console_session.ses_ping = NULL;
}
console_session.ses_ping = NULL;
}
@@
-1354,7
+1350,8
@@
lstcon_rpc_cleanup_wait(void)
CWARN("Session is shutting down, "
"waiting for termination of transactions\n");
CWARN("Session is shutting down, "
"waiting for termination of transactions\n");
- cfs_pause(cfs_time_seconds(1));
+ set_current_state(TASK_UNINTERRUPTIBLE);
+ schedule_timeout(cfs_time_seconds(1));
mutex_lock(&console_session.ses_mutex);
}
mutex_lock(&console_session.ses_mutex);
}
@@
-1403,4
+1400,3
@@
lstcon_rpc_module_fini(void)
LASSERT(atomic_read(&console_session.ses_rpc_counter) == 0);
}
LASSERT(atomic_read(&console_session.ses_rpc_counter) == 0);
}
-#endif