Minor changes to remove excessive whitespace and improve
readability of ptlrpc functions.
Signed-off-by: Chris Hanna <hannac@iu.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 files changed:
struct ptlrpc_client *cl)
{
cl->cli_request_portal = req_portal;
struct ptlrpc_client *cl)
{
cl->cli_request_portal = req_portal;
- cl->cli_reply_portal = rep_portal;
- cl->cli_name = name;
+ cl->cli_reply_portal = rep_portal;
+ cl->cli_name = name;
}
EXPORT_SYMBOL(ptlrpc_init_client);
}
EXPORT_SYMBOL(ptlrpc_init_client);
struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid)
{
struct ptlrpc_connection *c;
struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid)
{
struct ptlrpc_connection *c;
- lnet_nid_t self;
- lnet_process_id_t peer;
- int err;
+ lnet_nid_t self;
+ lnet_process_id_t peer;
+ int err;
/* ptlrpc_uuid_to_peer() initializes its 2nd parameter
* before accessing its values. */
/* ptlrpc_uuid_to_peer() initializes its 2nd parameter
* before accessing its values. */
desc->bd_import = class_import_get(imp);
desc->bd_req = req;
desc->bd_import = class_import_get(imp);
desc->bd_req = req;
- desc->bd_cbid.cbid_fn = client_bulk_callback;
+ desc->bd_cbid.cbid_fn = client_bulk_callback;
desc->bd_cbid.cbid_arg = desc;
/* This makes req own desc, and free it when she frees herself */
desc->bd_cbid.cbid_arg = desc;
/* This makes req own desc, and free it when she frees herself */
static int ptlrpc_at_recv_early_reply(struct ptlrpc_request *req)
{
struct ptlrpc_request *early_req;
static int ptlrpc_at_recv_early_reply(struct ptlrpc_request *req)
{
struct ptlrpc_request *early_req;
- time_t olddl;
- int rc;
+ time_t olddl;
+ int rc;
req->rq_early = 0;
spin_unlock(&req->rq_lock);
req->rq_early = 0;
spin_unlock(&req->rq_lock);
int count, __u32 *lengths, char **bufs,
struct ptlrpc_cli_ctx *ctx)
{
int count, __u32 *lengths, char **bufs,
struct ptlrpc_cli_ctx *ctx)
{
- struct obd_import *imp = request->rq_import;
- int rc;
+ struct obd_import *imp = request->rq_import;
+ int rc;
if (unlikely(ctx))
request->rq_cli_ctx = sptlrpc_cli_ctx_get(ctx);
if (unlikely(ctx))
request->rq_cli_ctx = sptlrpc_cli_ctx_get(ctx);
request->rq_type = PTL_RPC_MSG_REQUEST;
request->rq_export = NULL;
request->rq_type = PTL_RPC_MSG_REQUEST;
request->rq_export = NULL;
- request->rq_req_cbid.cbid_fn = request_out_callback;
+ request->rq_req_cbid.cbid_fn = request_out_callback;
request->rq_req_cbid.cbid_arg = request;
request->rq_req_cbid.cbid_arg = request;
- request->rq_reply_cbid.cbid_fn = reply_in_callback;
+ request->rq_reply_cbid.cbid_fn = reply_in_callback;
request->rq_reply_cbid.cbid_arg = request;
request->rq_reply_deadline = 0;
request->rq_reply_cbid.cbid_arg = request;
request->rq_reply_deadline = 0;
* initialize its buffer structure according to capsule template \a format.
*/
struct ptlrpc_request *ptlrpc_request_alloc_pool(struct obd_import *imp,
* initialize its buffer structure according to capsule template \a format.
*/
struct ptlrpc_request *ptlrpc_request_alloc_pool(struct obd_import *imp,
- struct ptlrpc_request_pool *pool,
- const struct req_format *format)
+ struct ptlrpc_request_pool *pool,
+ const struct req_format *format)
{
return ptlrpc_request_alloc_internal(imp, pool, format);
}
{
return ptlrpc_request_alloc_internal(imp, pool, format);
}
* Returns allocated request or NULL on error.
*/
struct ptlrpc_request *ptlrpc_request_alloc_pack(struct obd_import *imp,
* Returns allocated request or NULL on error.
*/
struct ptlrpc_request *ptlrpc_request_alloc_pack(struct obd_import *imp,
- const struct req_format *format,
- __u32 version, int opcode)
+ const struct req_format *format,
+ __u32 version, int opcode)
{
struct ptlrpc_request *req = ptlrpc_request_alloc(imp, format);
{
struct ptlrpc_request *req = ptlrpc_request_alloc(imp, format);
if (req) {
rc = ptlrpc_request_pack(req, version, opcode);
if (req) {
rc = ptlrpc_request_pack(req, version, opcode);
struct ptlrpc_request_pool *pool)
{
struct ptlrpc_request *request;
struct ptlrpc_request_pool *pool)
{
struct ptlrpc_request *request;
request = __ptlrpc_request_alloc(imp, pool);
if (!request)
request = __ptlrpc_request_alloc(imp, pool);
if (!request)
INIT_LIST_HEAD(&set->set_new_requests);
INIT_LIST_HEAD(&set->set_cblist);
set->set_max_inflight = UINT_MAX;
INIT_LIST_HEAD(&set->set_new_requests);
INIT_LIST_HEAD(&set->set_cblist);
set->set_max_inflight = UINT_MAX;
- set->set_producer = NULL;
+ set->set_producer = NULL;
set->set_producer_arg = NULL;
set->set_producer_arg = NULL;
- set->set_max_inflight = max;
- set->set_producer = func;
- set->set_producer_arg = arg;
+ set->set_max_inflight = max;
+ set->set_producer = func;
+ set->set_producer_arg = arg;
*/
void ptlrpc_set_destroy(struct ptlrpc_request_set *set)
{
*/
void ptlrpc_set_destroy(struct ptlrpc_request_set *set)
{
- struct list_head *tmp;
- struct list_head *next;
- int expected_phase;
- int n = 0;
+ struct list_head *tmp;
+ struct list_head *next;
+ int expected_phase;
+ int n = 0;
/* Requests on the set should either all be completed, or all be new */
expected_phase = (atomic_read(&set->set_remaining) == 0) ?
/* Requests on the set should either all be completed, or all be new */
expected_phase = (atomic_read(&set->set_remaining) == 0) ?
* Currently only used for ptlrpcd.
*/
void ptlrpc_set_add_new_req(struct ptlrpcd_ctl *pc,
* Currently only used for ptlrpcd.
*/
void ptlrpc_set_add_new_req(struct ptlrpcd_ctl *pc,
- struct ptlrpc_request *req)
+ struct ptlrpc_request *req)
{
struct ptlrpc_request_set *set = pc->pc_set;
int count, i;
{
struct ptlrpc_request_set *set = pc->pc_set;
int count, i;
*/
static int ptlrpc_send_new_req(struct ptlrpc_request *req)
{
*/
static int ptlrpc_send_new_req(struct ptlrpc_request *req)
{
- struct obd_import *imp = req->rq_import;
+ struct obd_import *imp = req->rq_import;
int rc;
LASSERT(req->rq_phase == RQ_PHASE_NEW);
int rc;
LASSERT(req->rq_phase == RQ_PHASE_NEW);
req->rq_status = status;
ptlrpc_rqphase_move(req,
RQ_PHASE_INTERPRET);
req->rq_status = status;
ptlrpc_rqphase_move(req,
RQ_PHASE_INTERPRET);
int ptlrpc_expired_set(void *data)
{
struct ptlrpc_request_set *set = data;
int ptlrpc_expired_set(void *data)
{
struct ptlrpc_request_set *set = data;
- struct list_head *tmp;
- time_t now = get_seconds();
+ struct list_head *tmp;
+ time_t now = get_seconds();
*/
int ptlrpc_set_next_timeout(struct ptlrpc_request_set *set)
{
*/
int ptlrpc_set_next_timeout(struct ptlrpc_request_set *set)
{
- struct list_head *tmp;
- time_t now = get_seconds();
- int timeout = 0;
+ struct list_head *tmp;
+ time_t now = get_seconds();
+ int timeout = 0;
struct ptlrpc_request *req;
struct ptlrpc_request *req;
list_for_each(tmp, &set->set_requests) {
req = list_entry(tmp, struct ptlrpc_request, rq_set_chain);
list_for_each(tmp, &set->set_requests) {
req = list_entry(tmp, struct ptlrpc_request, rq_set_chain);
*/
int ptlrpc_set_wait(struct ptlrpc_request_set *set)
{
*/
int ptlrpc_set_wait(struct ptlrpc_request_set *set)
{
struct ptlrpc_request *req;
struct ptlrpc_request *req;
- struct l_wait_info lwi;
- int rc, timeout;
+ struct l_wait_info lwi;
+ int rc, timeout;
if (set->set_producer)
(void)ptlrpc_set_producer(set);
if (set->set_producer)
(void)ptlrpc_set_producer(set);
*/
int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async)
{
*/
int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async)
{
- int rc;
- wait_queue_head_t *wq;
+ int rc;
+ wait_queue_head_t *wq;
struct l_wait_info lwi;
/*
struct l_wait_info lwi;
/*
{
struct ptlrpc_request *req, *saved;
struct ptlrpc_request *last_req = NULL; /* temporary fire escape */
{
struct ptlrpc_request *req, *saved;
struct ptlrpc_request *last_req = NULL; /* temporary fire escape */
- bool skip_committed_list = true;
+ bool skip_committed_list = true;
LASSERT(imp != NULL);
assert_spin_locked(&imp->imp_lock);
LASSERT(imp != NULL);
assert_spin_locked(&imp->imp_lock);
* have delay before it really runs by ptlrpcd thread.
*/
struct ptlrpc_work_async_args {
* have delay before it really runs by ptlrpcd thread.
*/
struct ptlrpc_work_async_args {
- int (*cb)(const struct lu_env *, void *);
- void *cbdata;
+ int (*cb)(const struct lu_env *, void *);
+ void *cbdata;
};
static void ptlrpcd_add_work_req(struct ptlrpc_request *req)
};
static void ptlrpcd_add_work_req(struct ptlrpc_request *req)
CLASSERT(sizeof(*args) <= sizeof(req->rq_async_args));
args = ptlrpc_req_async_args(req);
CLASSERT(sizeof(*args) <= sizeof(req->rq_async_args));
args = ptlrpc_req_async_args(req);
args->cbdata = cbdata;
return req;
args->cbdata = cbdata;
return req;
*/
void request_out_callback(lnet_event_t *ev)
{
*/
void request_out_callback(lnet_event_t *ev)
{
- struct ptlrpc_cb_id *cbid = ev->md.user_ptr;
+ struct ptlrpc_cb_id *cbid = ev->md.user_ptr;
struct ptlrpc_request *req = cbid->cbid_arg;
LASSERT(ev->type == LNET_EVENT_SEND ||
struct ptlrpc_request *req = cbid->cbid_arg;
LASSERT(ev->type == LNET_EVENT_SEND ||
*/
void reply_in_callback(lnet_event_t *ev)
{
*/
void reply_in_callback(lnet_event_t *ev)
{
- struct ptlrpc_cb_id *cbid = ev->md.user_ptr;
+ struct ptlrpc_cb_id *cbid = ev->md.user_ptr;
struct ptlrpc_request *req = cbid->cbid_arg;
DEBUG_REQ(D_NET, req, "type %d, status %d", ev->type, ev->status);
struct ptlrpc_request *req = cbid->cbid_arg;
DEBUG_REQ(D_NET, req, "type %d, status %d", ev->type, ev->status);
*/
void client_bulk_callback(lnet_event_t *ev)
{
*/
void client_bulk_callback(lnet_event_t *ev)
{
- struct ptlrpc_cb_id *cbid = ev->md.user_ptr;
+ struct ptlrpc_cb_id *cbid = ev->md.user_ptr;
struct ptlrpc_bulk_desc *desc = cbid->cbid_arg;
struct ptlrpc_bulk_desc *desc = cbid->cbid_arg;
- struct ptlrpc_request *req;
+ struct ptlrpc_request *req;
LASSERT((desc->bd_type == BULK_PUT_SINK &&
ev->type == LNET_EVENT_PUT) ||
LASSERT((desc->bd_type == BULK_PUT_SINK &&
ev->type == LNET_EVENT_PUT) ||
static void ptlrpc_req_add_history(struct ptlrpc_service_part *svcpt,
struct ptlrpc_request *req)
{
static void ptlrpc_req_add_history(struct ptlrpc_service_part *svcpt,
struct ptlrpc_request *req)
{
- __u64 sec = req->rq_arrival_time.tv_sec;
- __u32 usec = req->rq_arrival_time.tv_usec >> 4; /* usec / 16 */
- __u64 new_seq;
+ __u64 sec = req->rq_arrival_time.tv_sec;
+ __u32 usec = req->rq_arrival_time.tv_usec >> 4; /* usec / 16 */
+ __u64 new_seq;
/* set sequence ID for request and add it to history list,
* it must be called with hold svcpt::scp_lock */
/* set sequence ID for request and add it to history list,
* it must be called with hold svcpt::scp_lock */
*/
void request_in_callback(lnet_event_t *ev)
{
*/
void request_in_callback(lnet_event_t *ev)
{
- struct ptlrpc_cb_id *cbid = ev->md.user_ptr;
+ struct ptlrpc_cb_id *cbid = ev->md.user_ptr;
struct ptlrpc_request_buffer_desc *rqbd = cbid->cbid_arg;
struct ptlrpc_request_buffer_desc *rqbd = cbid->cbid_arg;
- struct ptlrpc_service_part *svcpt = rqbd->rqbd_svcpt;
- struct ptlrpc_service *service = svcpt->scp_service;
- struct ptlrpc_request *req;
+ struct ptlrpc_service_part *svcpt = rqbd->rqbd_svcpt;
+ struct ptlrpc_service *service = svcpt->scp_service;
+ struct ptlrpc_request *req;
LASSERT(ev->type == LNET_EVENT_PUT ||
ev->type == LNET_EVENT_UNLINK);
LASSERT(ev->type == LNET_EVENT_PUT ||
ev->type == LNET_EVENT_UNLINK);
*/
void reply_out_callback(lnet_event_t *ev)
{
*/
void reply_out_callback(lnet_event_t *ev)
{
- struct ptlrpc_cb_id *cbid = ev->md.user_ptr;
+ struct ptlrpc_cb_id *cbid = ev->md.user_ptr;
struct ptlrpc_reply_state *rs = cbid->cbid_arg;
struct ptlrpc_service_part *svcpt = rs->rs_svcpt;
struct ptlrpc_reply_state *rs = cbid->cbid_arg;
struct ptlrpc_service_part *svcpt = rs->rs_svcpt;
}
int ptlrpc_uuid_to_peer(struct obd_uuid *uuid,
}
int ptlrpc_uuid_to_peer(struct obd_uuid *uuid,
- lnet_process_id_t *peer, lnet_nid_t *self)
+ lnet_process_id_t *peer, lnet_nid_t *self)
- int best_dist = 0;
- __u32 best_order = 0;
- int count = 0;
- int rc = -ENOENT;
- int portals_compatibility;
- int dist;
- __u32 order;
- lnet_nid_t dst_nid;
- lnet_nid_t src_nid;
+ int best_dist = 0;
+ __u32 best_order = 0;
+ int count = 0;
+ int rc = -ENOENT;
+ int portals_compatibility;
+ int dist;
+ __u32 order;
+ lnet_nid_t dst_nid;
+ lnet_nid_t src_nid;
portals_compatibility = LNetCtl(IOC_LIBCFS_PORTALS_COMPATIBILITY, NULL);
portals_compatibility = LNetCtl(IOC_LIBCFS_PORTALS_COMPATIBILITY, NULL);
void ptlrpc_ni_fini(void)
{
void ptlrpc_ni_fini(void)
{
- wait_queue_head_t waitq;
- struct l_wait_info lwi;
- int rc;
- int retries;
+ wait_queue_head_t waitq;
+ struct l_wait_info lwi;
+ int rc;
+ int retries;
/* Wait for the event queue to become idle since there may still be
* messages in flight with pending events (i.e. the fire-and-forget
/* Wait for the event queue to become idle since there may still be
* messages in flight with pending events (i.e. the fire-and-forget
lnet_pid_t ptl_get_pid(void)
{
lnet_pid_t ptl_get_pid(void)
{
pid = LUSTRE_SRV_LNET_PID;
return pid;
pid = LUSTRE_SRV_LNET_PID;
return pid;
int ptlrpc_ni_init(void)
{
int ptlrpc_ni_init(void)
{
- int rc;
- lnet_pid_t pid;
+ int rc;
+ lnet_pid_t pid;
pid = ptl_get_pid();
CDEBUG(D_NET, "My pid is: %x\n", pid);
pid = ptl_get_pid();
CDEBUG(D_NET, "My pid is: %x\n", pid);
int ptlrpc_init_portals(void)
{
int ptlrpc_init_portals(void)
{
- int rc = ptlrpc_ni_init();
+ int rc = ptlrpc_ni_init();
if (rc != 0) {
CERROR("network initialisation failed\n");
if (rc != 0) {
CERROR("network initialisation failed\n");
spin_lock(&imp->imp_lock);
imp->imp_generation++;
spin_lock(&imp->imp_lock);
imp->imp_generation++;
- imp->imp_state = LUSTRE_IMP_NEW;
+ imp->imp_state = LUSTRE_IMP_NEW;
spin_unlock(&imp->imp_lock);
spin_unlock(&imp->imp_lock);
imp_unregistering));
}
spin_unlock(&imp->imp_lock);
imp_unregistering));
}
spin_unlock(&imp->imp_lock);
ptlrpc_connection_put(imp->imp_connection);
imp->imp_connection = ptlrpc_connection_addref(imp_conn->oic_conn);
ptlrpc_connection_put(imp->imp_connection);
imp->imp_connection = ptlrpc_connection_addref(imp_conn->oic_conn);
- dlmexp = class_conn2export(&imp->imp_dlm_handle);
+ dlmexp = class_conn2export(&imp->imp_dlm_handle);
LASSERT(dlmexp != NULL);
if (dlmexp->exp_connection)
ptlrpc_connection_put(dlmexp->exp_connection);
LASSERT(dlmexp != NULL);
if (dlmexp->exp_connection)
ptlrpc_connection_put(dlmexp->exp_connection);
INITIAL_CONNECT_TIMEOUT);
IMPORT_SET_STATE(imp, LUSTRE_IMP_CONNECTING);
INITIAL_CONNECT_TIMEOUT);
IMPORT_SET_STATE(imp, LUSTRE_IMP_CONNECTING);
- req->rq_send_state = LUSTRE_IMP_CONNECTING;
+ req->rq_send_state = LUSTRE_IMP_CONNECTING;
ptlrpc_request_set_replen(req);
rc = ptlrpc_queue_wait(req);
ptlrpc_req_finished(req);
ptlrpc_request_set_replen(req);
rc = ptlrpc_queue_wait(req);
ptlrpc_req_finished(req);
-#define DEFINE_MSGF(name, flags, size, swabber, dumper) { \
- .rmf_name = (name), \
- .rmf_flags = (flags), \
- .rmf_size = (size), \
- .rmf_swabber = (void (*)(void *))(swabber), \
+#define DEFINE_MSGF(name, flags, size, swabber, dumper) { \
+ .rmf_name = (name), \
+ .rmf_flags = (flags), \
+ .rmf_size = (size), \
+ .rmf_swabber = (void (*)(void *))(swabber), \
.rmf_dumper = (void (*)(void *))(dumper) \
}
.rmf_dumper = (void (*)(void *))(dumper) \
}
struct req_format {
const char *rf_name;
struct req_format {
const char *rf_name;
const struct req_msg_field **d;
} rf_fields[RCL_NR];
};
const struct req_msg_field **d;
} rf_fields[RCL_NR];
};
-#define DEFINE_REQ_FMT(name, client, client_nr, server, server_nr) { \
- .rf_name = name, \
- .rf_fields = { \
+#define DEFINE_REQ_FMT(name, client, client_nr, server, server_nr) { \
+ .rf_name = name, \
+ .rf_fields = { \
[RCL_CLIENT] = { \
.nr = client_nr, \
[RCL_CLIENT] = { \
.nr = client_nr, \
[RCL_SERVER] = { \
.nr = server_nr, \
[RCL_SERVER] = { \
.nr = server_nr, \
- .d = server \
- } \
- } \
+ .d = server \
+ } \
+ } \
}
#define DEFINE_REQ_FMT0(name, client, server) \
}
#define DEFINE_REQ_FMT0(name, client, server) \
* field of a \a pill's \a rc_fmt's RMF's.
*/
int req_capsule_filled_sizes(struct req_capsule *pill,
* field of a \a pill's \a rc_fmt's RMF's.
*/
int req_capsule_filled_sizes(struct req_capsule *pill,
{
const struct req_format *fmt = pill->rc_fmt;
{
const struct req_format *fmt = pill->rc_fmt;
int req_capsule_server_pack(struct req_capsule *pill)
{
const struct req_format *fmt;
int req_capsule_server_pack(struct req_capsule *pill)
{
const struct req_format *fmt;
LASSERT(pill->rc_loc == RCL_SERVER);
fmt = pill->rc_fmt;
LASSERT(pill->rc_loc == RCL_SERVER);
fmt = pill->rc_fmt;
int offset,
void *value, int len, int dump, void (*swabber)(void *))
{
int offset,
void *value, int len, int dump, void (*swabber)(void *))
{
- void *p;
- int i;
- int n;
- int do_swab;
- int inout = loc == RCL_CLIENT;
+ void *p;
+ int i;
+ int n;
+ int do_swab;
+ int inout = loc == RCL_CLIENT;
swabber = swabber ?: field->rmf_swabber;
swabber = swabber ?: field->rmf_swabber;
int dump)
{
const struct req_format *fmt;
int dump)
{
const struct req_format *fmt;
- struct lustre_msg *msg;
- void *value;
- int len;
- int offset;
+ struct lustre_msg *msg;
+ void *value;
+ int len;
+ int offset;
void *(*getter)(struct lustre_msg *m, int n, int minlen);
void *(*getter)(struct lustre_msg *m, int n, int minlen);
*/
static void __req_capsule_dump(struct req_capsule *pill, enum req_location loc)
{
*/
static void __req_capsule_dump(struct req_capsule *pill, enum req_location loc)
{
- const struct req_format *fmt;
- const struct req_msg_field *field;
- int len;
- int i;
+ const struct req_format *fmt;
+ const struct req_msg_field *field;
+ int len;
+ int i;
enum req_location loc)
{
const struct req_format *fmt;
enum req_location loc)
{
const struct req_format *fmt;
- struct lustre_msg *msg;
- int len;
- int offset;
+ struct lustre_msg *msg;
+ int len;
+ int offset;
fmt = pill->rc_fmt;
LASSERT(fmt != NULL);
fmt = pill->rc_fmt;
LASSERT(fmt != NULL);
#include "../include/lustre_net.h"
#include <linux/list.h>
#include "../include/lustre_net.h"
#include <linux/list.h>
-#define LLOG_CLIENT_ENTRY(ctxt, imp) do { \
- mutex_lock(&ctxt->loc_mutex); \
- if (ctxt->loc_imp) { \
- imp = class_import_get(ctxt->loc_imp); \
- } else { \
- CERROR("ctxt->loc_imp == NULL for context idx %d." \
- "Unable to complete MDS/OSS recovery," \
- "but I'll try again next time. Not fatal.\n", \
- ctxt->loc_idx); \
- imp = NULL; \
- mutex_unlock(&ctxt->loc_mutex); \
- return (-EINVAL); \
- } \
- mutex_unlock(&ctxt->loc_mutex); \
+#define LLOG_CLIENT_ENTRY(ctxt, imp) do { \
+ mutex_lock(&ctxt->loc_mutex); \
+ if (ctxt->loc_imp) { \
+ imp = class_import_get(ctxt->loc_imp); \
+ } else { \
+ CERROR("ctxt->loc_imp == NULL for context idx %d." \
+ "Unable to complete MDS/OSS recovery," \
+ "but I'll try again next time. Not fatal.\n", \
+ ctxt->loc_idx); \
+ imp = NULL; \
+ mutex_unlock(&ctxt->loc_mutex); \
+ return (-EINVAL); \
+ } \
+ mutex_unlock(&ctxt->loc_mutex); \
-#define LLOG_CLIENT_EXIT(ctxt, imp) do { \
- mutex_lock(&ctxt->loc_mutex); \
- if (ctxt->loc_imp != imp) \
- CWARN("loc_imp has changed from %p to %p\n", \
- ctxt->loc_imp, imp); \
- class_import_put(imp); \
- mutex_unlock(&ctxt->loc_mutex); \
+#define LLOG_CLIENT_EXIT(ctxt, imp) do { \
+ mutex_lock(&ctxt->loc_mutex); \
+ if (ctxt->loc_imp != imp) \
+ CWARN("loc_imp has changed from %p to %p\n", \
+ ctxt->loc_imp, imp); \
+ class_import_put(imp); \
+ mutex_unlock(&ctxt->loc_mutex); \
} while (0)
/* This is a callback from the llog_* functions.
} while (0)
/* This is a callback from the llog_* functions.
struct llog_handle *lgh, struct llog_logid *logid,
char *name, enum llog_open_param open_param)
{
struct llog_handle *lgh, struct llog_logid *logid,
char *name, enum llog_open_param open_param)
{
- struct obd_import *imp;
- struct llogd_body *body;
- struct llog_ctxt *ctxt = lgh->lgh_ctxt;
+ struct obd_import *imp;
+ struct llogd_body *body;
+ struct llog_ctxt *ctxt = lgh->lgh_ctxt;
struct ptlrpc_request *req = NULL;
struct ptlrpc_request *req = NULL;
LLOG_CLIENT_ENTRY(ctxt, imp);
LLOG_CLIENT_ENTRY(ctxt, imp);
static int llog_client_destroy(const struct lu_env *env,
struct llog_handle *loghandle)
{
static int llog_client_destroy(const struct lu_env *env,
struct llog_handle *loghandle)
{
- struct obd_import *imp;
+ struct obd_import *imp;
struct ptlrpc_request *req = NULL;
struct ptlrpc_request *req = NULL;
- struct llogd_body *body;
- int rc;
+ struct llogd_body *body;
+ int rc;
LLOG_CLIENT_ENTRY(loghandle->lgh_ctxt, imp);
req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_DESTROY,
LLOG_CLIENT_ENTRY(loghandle->lgh_ctxt, imp);
req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_DESTROY,
int *cur_idx, int next_idx,
__u64 *cur_offset, void *buf, int len)
{
int *cur_idx, int next_idx,
__u64 *cur_offset, void *buf, int len)
{
- struct obd_import *imp;
+ struct obd_import *imp;
struct ptlrpc_request *req = NULL;
struct ptlrpc_request *req = NULL;
- struct llogd_body *body;
- void *ptr;
- int rc;
+ struct llogd_body *body;
+ void *ptr;
+ int rc;
LLOG_CLIENT_ENTRY(loghandle->lgh_ctxt, imp);
req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_NEXT_BLOCK,
LLOG_CLIENT_ENTRY(loghandle->lgh_ctxt, imp);
req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_NEXT_BLOCK,
struct llog_handle *loghandle,
int prev_idx, void *buf, int len)
{
struct llog_handle *loghandle,
int prev_idx, void *buf, int len)
{
- struct obd_import *imp;
+ struct obd_import *imp;
struct ptlrpc_request *req = NULL;
struct ptlrpc_request *req = NULL;
- struct llogd_body *body;
- void *ptr;
- int rc;
+ struct llogd_body *body;
+ void *ptr;
+ int rc;
LLOG_CLIENT_ENTRY(loghandle->lgh_ctxt, imp);
req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_PREV_BLOCK,
LLOG_CLIENT_ENTRY(loghandle->lgh_ctxt, imp);
req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_PREV_BLOCK,
static int llog_client_read_header(const struct lu_env *env,
struct llog_handle *handle)
{
static int llog_client_read_header(const struct lu_env *env,
struct llog_handle *handle)
{
- struct obd_import *imp;
+ struct obd_import *imp;
struct ptlrpc_request *req = NULL;
struct ptlrpc_request *req = NULL;
- struct llogd_body *body;
- struct llog_log_hdr *hdr;
- struct llog_rec_hdr *llh_hdr;
- int rc;
+ struct llogd_body *body;
+ struct llog_log_hdr *hdr;
+ struct llog_rec_hdr *llh_hdr;
+ int rc;
LLOG_CLIENT_ENTRY(handle->lgh_ctxt, imp);
req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_READ_HEADER,
LLOG_CLIENT_ENTRY(handle->lgh_ctxt, imp);
req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_READ_HEADER,
{
struct ptlrpc_service *svc = m->private;
struct ptlrpc_service_part *svcpt;
{
struct ptlrpc_service *svc = m->private;
struct ptlrpc_service_part *svcpt;
- int total = 0;
- int i;
+ int total = 0;
+ int i;
ptlrpc_service_for_each_part(svcpt, i, svc)
total += svcpt->scp_hist_nrqbds;
ptlrpc_service_for_each_part(svcpt, i, svc)
total += svcpt->scp_hist_nrqbds;
{
struct ptlrpc_service *svc = m->private;
struct ptlrpc_service_part *svcpt;
{
struct ptlrpc_service *svc = m->private;
struct ptlrpc_service_part *svcpt;
- int total = 0;
- int i;
+ int total = 0;
+ int i;
ptlrpc_service_for_each_part(svcpt, i, svc)
total += svc->srv_hist_nrqbds_cpt_max;
ptlrpc_service_for_each_part(svcpt, i, svc)
total += svc->srv_hist_nrqbds_cpt_max;
static ssize_t
ptlrpc_lprocfs_req_history_max_seq_write(struct file *file,
static ssize_t
ptlrpc_lprocfs_req_history_max_seq_write(struct file *file,
- const char __user *buffer,
- size_t count, loff_t *off)
+ const char __user *buffer,
+ size_t count, loff_t *off)
{
struct ptlrpc_service *svc = ((struct seq_file *)file->private_data)->private;
{
struct ptlrpc_service *svc = ((struct seq_file *)file->private_data)->private;
- int bufpages;
- int val;
- int rc;
+ int bufpages;
+ int val;
+ int rc;
rc = lprocfs_write_helper(buffer, count, &val);
if (rc < 0)
rc = lprocfs_write_helper(buffer, count, &val);
if (rc < 0)
*/
static int ptlrpc_lprocfs_nrs_seq_show(struct seq_file *m, void *n)
{
*/
static int ptlrpc_lprocfs_nrs_seq_show(struct seq_file *m, void *n)
{
- struct ptlrpc_service *svc = m->private;
- struct ptlrpc_service_part *svcpt;
- struct ptlrpc_nrs *nrs;
- struct ptlrpc_nrs_policy *policy;
- struct ptlrpc_nrs_pol_info *infos;
- struct ptlrpc_nrs_pol_info tmp;
- unsigned num_pols;
- unsigned pol_idx = 0;
- bool hp = false;
- int i;
- int rc = 0;
+ struct ptlrpc_service *svc = m->private;
+ struct ptlrpc_service_part *svcpt;
+ struct ptlrpc_nrs *nrs;
+ struct ptlrpc_nrs_policy *policy;
+ struct ptlrpc_nrs_pol_info *infos;
+ struct ptlrpc_nrs_pol_info tmp;
+ unsigned num_pols;
+ unsigned pol_idx = 0;
+ bool hp = false;
+ int i;
+ int rc = 0;
/**
* Serialize NRS core lprocfs operations with policy registration/
/**
* Serialize NRS core lprocfs operations with policy registration/
* regular and high-priority (if the service has one) NRS head.
*/
static ssize_t ptlrpc_lprocfs_nrs_seq_write(struct file *file,
* regular and high-priority (if the service has one) NRS head.
*/
static ssize_t ptlrpc_lprocfs_nrs_seq_write(struct file *file,
- const char __user *buffer,
- size_t count, loff_t *off)
+ const char __user *buffer,
+ size_t count, loff_t *off)
{
struct ptlrpc_service *svc = ((struct seq_file *)file->private_data)->private;
{
struct ptlrpc_service *svc = ((struct seq_file *)file->private_data)->private;
- enum ptlrpc_nrs_queue_type queue = PTLRPC_NRS_QUEUE_BOTH;
- char *cmd;
- char *cmd_copy = NULL;
- char *token;
- int rc = 0;
+ enum ptlrpc_nrs_queue_type queue = PTLRPC_NRS_QUEUE_BOTH;
+ char *cmd;
+ char *cmd_copy = NULL;
+ char *token;
+ int rc = 0;
if (count >= LPROCFS_NRS_WR_MAX_CMD)
return -EINVAL;
if (count >= LPROCFS_NRS_WR_MAX_CMD)
return -EINVAL;
struct ptlrpc_srh_iterator *srhi,
__u64 seq)
{
struct ptlrpc_srh_iterator *srhi,
__u64 seq)
{
- struct list_head *e;
- struct ptlrpc_request *req;
+ struct list_head *e;
+ struct ptlrpc_request *req;
if (srhi->srhi_req != NULL &&
srhi->srhi_seq > svcpt->scp_hist_seq_culled &&
if (srhi->srhi_req != NULL &&
srhi->srhi_seq > svcpt->scp_hist_seq_culled &&
ptlrpc_lprocfs_svc_req_history_next(struct seq_file *s,
void *iter, loff_t *pos)
{
ptlrpc_lprocfs_svc_req_history_next(struct seq_file *s,
void *iter, loff_t *pos)
{
- struct ptlrpc_service *svc = s->private;
- struct ptlrpc_srh_iterator *srhi = iter;
- struct ptlrpc_service_part *svcpt;
- __u64 seq;
- int rc;
- int i;
+ struct ptlrpc_service *svc = s->private;
+ struct ptlrpc_srh_iterator *srhi = iter;
+ struct ptlrpc_service_part *svcpt;
+ __u64 seq;
+ int rc;
+ int i;
for (i = srhi->srhi_idx; i < svc->srv_ncpts; i++) {
svcpt = svc->srv_parts[i];
for (i = srhi->srhi_idx; i < svc->srv_ncpts; i++) {
svcpt = svc->srv_parts[i];
static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter)
{
static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter)
{
- struct ptlrpc_service *svc = s->private;
- struct ptlrpc_srh_iterator *srhi = iter;
- struct ptlrpc_service_part *svcpt;
- struct ptlrpc_request *req;
- int rc;
+ struct ptlrpc_service *svc = s->private;
+ struct ptlrpc_srh_iterator *srhi = iter;
+ struct ptlrpc_service_part *svcpt;
+ struct ptlrpc_request *req;
+ int rc;
LASSERT(srhi->srhi_idx < svc->srv_ncpts);
LASSERT(srhi->srhi_idx < svc->srv_ncpts);
.next = ptlrpc_lprocfs_svc_req_history_next,
.show = ptlrpc_lprocfs_svc_req_history_show,
};
.next = ptlrpc_lprocfs_svc_req_history_next,
.show = ptlrpc_lprocfs_svc_req_history_show,
};
- struct seq_file *seqf;
- int rc;
+ struct seq_file *seqf;
+ int rc;
rc = seq_open(file, &sops);
if (rc)
rc = seq_open(file, &sops);
if (rc)
/* See also lprocfs_rd_timeouts */
static int ptlrpc_lprocfs_timeouts_seq_show(struct seq_file *m, void *n)
{
/* See also lprocfs_rd_timeouts */
static int ptlrpc_lprocfs_timeouts_seq_show(struct seq_file *m, void *n)
{
- struct ptlrpc_service *svc = m->private;
- struct ptlrpc_service_part *svcpt;
- struct dhms ts;
- time_t worstt;
- unsigned int cur;
- unsigned int worst;
- int i;
+ struct ptlrpc_service *svc = m->private;
+ struct ptlrpc_service_part *svcpt;
+ struct dhms ts;
+ time_t worstt;
+ unsigned int cur;
+ unsigned int worst;
+ int i;
if (AT_OFF) {
seq_printf(m, "adaptive timeouts off, using obd_timeout %u\n",
if (AT_OFF) {
seq_printf(m, "adaptive timeouts off, using obd_timeout %u\n",
size_t count, loff_t *off)
{
struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
size_t count, loff_t *off)
{
struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
- char *kbuf;
- char *tmpbuf;
+ char *kbuf;
+ char *tmpbuf;
kbuf = kzalloc(BUFLEN, GFP_NOFS);
if (kbuf == NULL)
kbuf = kzalloc(BUFLEN, GFP_NOFS);
if (kbuf == NULL)
{
struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
struct ptlrpc_request *req;
{
struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
struct ptlrpc_request *req;
LPROCFS_CLIMP_CHECK(obd);
req = ptlrpc_prep_ping(obd->u.cli.cl_import);
LPROCFS_CLIMP_CHECK(obd);
req = ptlrpc_prep_ping(obd->u.cli.cl_import);
struct ptlrpc_connection *conn, int portal, __u64 xid,
unsigned int offset)
{
struct ptlrpc_connection *conn, int portal, __u64 xid,
unsigned int offset)
{
- int rc;
- lnet_md_t md;
+ int rc;
+ lnet_md_t md;
LASSERT(portal != 0);
LASSERT(conn != NULL);
CDEBUG(D_INFO, "conn=%p id %s\n", conn, libcfs_id2str(conn->c_peer));
LASSERT(portal != 0);
LASSERT(conn != NULL);
CDEBUG(D_INFO, "conn=%p id %s\n", conn, libcfs_id2str(conn->c_peer));
- md.start = base;
- md.length = len;
+ md.start = base;
+ md.length = len;
md.threshold = (ack == LNET_ACK_REQ) ? 2 : 1;
md.threshold = (ack == LNET_ACK_REQ) ? 2 : 1;
- md.options = PTLRPC_MD_OPTIONS;
- md.user_ptr = cbid;
+ md.options = PTLRPC_MD_OPTIONS;
+ md.user_ptr = cbid;
md.eq_handle = ptlrpc_eq_h;
if (unlikely(ack == LNET_ACK_REQ &&
md.eq_handle = ptlrpc_eq_h;
if (unlikely(ack == LNET_ACK_REQ &&
int posted_md;
int total_md;
__u64 xid;
int posted_md;
int total_md;
__u64 xid;
- lnet_handle_me_t me_h;
- lnet_md_t md;
+ lnet_handle_me_t me_h;
+ lnet_md_t md;
if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_BULK_GET_NET))
return 0;
if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_BULK_GET_NET))
return 0;
int ptlrpc_unregister_bulk(struct ptlrpc_request *req, int async)
{
struct ptlrpc_bulk_desc *desc = req->rq_bulk;
int ptlrpc_unregister_bulk(struct ptlrpc_request *req, int async)
{
struct ptlrpc_bulk_desc *desc = req->rq_bulk;
- wait_queue_head_t *wq;
- struct l_wait_info lwi;
- int rc;
+ wait_queue_head_t *wq;
+ struct l_wait_info lwi;
+ int rc;
LASSERT(!in_interrupt()); /* might sleep */
LASSERT(!in_interrupt()); /* might sleep */
static void ptlrpc_at_set_reply(struct ptlrpc_request *req, int flags)
{
static void ptlrpc_at_set_reply(struct ptlrpc_request *req, int flags)
{
- struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt;
- struct ptlrpc_service *svc = svcpt->scp_service;
+ struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt;
+ struct ptlrpc_service *svc = svcpt->scp_service;
int service_time = max_t(int, get_seconds() -
req->rq_arrival_time.tv_sec, 1);
int service_time = max_t(int, get_seconds() -
req->rq_arrival_time.tv_sec, 1);
int ptlrpc_send_reply(struct ptlrpc_request *req, int flags)
{
struct ptlrpc_reply_state *rs = req->rq_reply_state;
int ptlrpc_send_reply(struct ptlrpc_request *req, int flags)
{
struct ptlrpc_reply_state *rs = req->rq_reply_state;
- struct ptlrpc_connection *conn;
- int rc;
+ struct ptlrpc_connection *conn;
+ int rc;
/* We must already have a reply buffer (only ptlrpc_error() may be
* called without one). The reply generated by sptlrpc layer (e.g.
/* We must already have a reply buffer (only ptlrpc_error() may be
* called without one). The reply generated by sptlrpc layer (e.g.
int rc2;
int mpflag = 0;
struct ptlrpc_connection *connection;
int rc2;
int mpflag = 0;
struct ptlrpc_connection *connection;
- lnet_handle_me_t reply_me_h;
- lnet_md_t reply_md;
+ lnet_handle_me_t reply_me_h;
+ lnet_md_t reply_md;
struct obd_device *obd = request->rq_import->imp_obd;
if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_DROP_RPC))
struct obd_device *obd = request->rq_import->imp_obd;
if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_DROP_RPC))
spin_unlock(&request->rq_lock);
if (!noreply) {
spin_unlock(&request->rq_lock);
if (!noreply) {
- reply_md.start = request->rq_repbuf;
- reply_md.length = request->rq_repbuf_len;
+ reply_md.start = request->rq_repbuf;
+ reply_md.length = request->rq_repbuf_len;
/* Allow multiple early replies */
reply_md.threshold = LNET_MD_THRESH_INF;
/* Manage remote for early replies */
/* Allow multiple early replies */
reply_md.threshold = LNET_MD_THRESH_INF;
/* Manage remote for early replies */
- reply_md.options = PTLRPC_MD_OPTIONS | LNET_MD_OP_PUT |
+ reply_md.options = PTLRPC_MD_OPTIONS | LNET_MD_OP_PUT |
LNET_MD_MANAGE_REMOTE |
LNET_MD_TRUNCATE; /* allow to make EOVERFLOW error */;
LNET_MD_MANAGE_REMOTE |
LNET_MD_TRUNCATE; /* allow to make EOVERFLOW error */;
- reply_md.user_ptr = &request->rq_reply_cbid;
+ reply_md.user_ptr = &request->rq_reply_cbid;
reply_md.eq_handle = ptlrpc_eq_h;
/* We must see the unlink callback to unset rq_reply_unlink,
reply_md.eq_handle = ptlrpc_eq_h;
/* We must see the unlink callback to unset rq_reply_unlink,
*/
int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd)
{
*/
int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd)
{
- struct ptlrpc_service *service = rqbd->rqbd_svcpt->scp_service;
- static lnet_process_id_t match_id = {LNET_NID_ANY, LNET_PID_ANY};
- int rc;
- lnet_md_t md;
- lnet_handle_me_t me_h;
+ struct ptlrpc_service *service = rqbd->rqbd_svcpt->scp_service;
+ static lnet_process_id_t match_id = {LNET_NID_ANY, LNET_PID_ANY};
+ int rc;
+ lnet_md_t md;
+ lnet_handle_me_t me_h;
CDEBUG(D_NET, "LNetMEAttach: portal %d\n",
service->srv_req_portal);
CDEBUG(D_NET, "LNetMEAttach: portal %d\n",
service->srv_req_portal);
LASSERT(rqbd->rqbd_refcount == 0);
rqbd->rqbd_refcount = 1;
LASSERT(rqbd->rqbd_refcount == 0);
rqbd->rqbd_refcount = 1;
- md.start = rqbd->rqbd_buffer;
- md.length = service->srv_buf_size;
- md.max_size = service->srv_max_req_size;
+ md.start = rqbd->rqbd_buffer;
+ md.length = service->srv_buf_size;
+ md.max_size = service->srv_max_req_size;
md.threshold = LNET_MD_THRESH_INF;
md.threshold = LNET_MD_THRESH_INF;
- md.options = PTLRPC_MD_OPTIONS | LNET_MD_OP_PUT | LNET_MD_MAX_SIZE;
- md.user_ptr = &rqbd->rqbd_cbid;
+ md.options = PTLRPC_MD_OPTIONS | LNET_MD_OP_PUT | LNET_MD_MAX_SIZE;
+ md.user_ptr = &rqbd->rqbd_cbid;
md.eq_handle = ptlrpc_eq_h;
rc = LNetMDAttach(me_h, md, LNET_UNLINK, &rqbd->rqbd_md_h);
md.eq_handle = ptlrpc_eq_h;
rc = LNetMDAttach(me_h, md, LNET_UNLINK, &rqbd->rqbd_md_h);
*/
static int nrs_policy_start_locked(struct ptlrpc_nrs_policy *policy)
{
*/
static int nrs_policy_start_locked(struct ptlrpc_nrs_policy *policy)
{
- struct ptlrpc_nrs *nrs = policy->pol_nrs;
- int rc = 0;
+ struct ptlrpc_nrs *nrs = policy->pol_nrs;
+ int rc = 0;
/**
* Don't allow multiple starting which is too complex, and has no real
/**
* Don't allow multiple starting which is too complex, and has no real
*/
static
struct ptlrpc_nrs_resource *nrs_resource_get(struct ptlrpc_nrs_policy *policy,
*/
static
struct ptlrpc_nrs_resource *nrs_resource_get(struct ptlrpc_nrs_policy *policy,
- struct ptlrpc_nrs_request *nrq,
- bool moving_req)
+ struct ptlrpc_nrs_request *nrq,
+ bool moving_req)
{
/**
* Set to NULL to traverse the resource hierarchy from the top.
*/
struct ptlrpc_nrs_resource *res = NULL;
struct ptlrpc_nrs_resource *tmp = NULL;
{
/**
* Set to NULL to traverse the resource hierarchy from the top.
*/
struct ptlrpc_nrs_resource *res = NULL;
struct ptlrpc_nrs_resource *tmp = NULL;
while (1) {
rc = policy->pol_desc->pd_ops->op_res_get(policy, nrq, res,
while (1) {
rc = policy->pol_desc->pd_ops->op_res_get(policy, nrq, res,
struct ptlrpc_nrs_resource **resp,
bool moving_req)
{
struct ptlrpc_nrs_resource **resp,
bool moving_req)
{
- struct ptlrpc_nrs_policy *primary = NULL;
- struct ptlrpc_nrs_policy *fallback = NULL;
+ struct ptlrpc_nrs_policy *primary = NULL;
+ struct ptlrpc_nrs_policy *fallback = NULL;
memset(resp, 0, sizeof(resp[0]) * NRS_RES_MAX);
memset(resp, 0, sizeof(resp[0]) * NRS_RES_MAX);
static void nrs_resource_put_safe(struct ptlrpc_nrs_resource **resp)
{
struct ptlrpc_nrs_policy *pols[NRS_RES_MAX];
static void nrs_resource_put_safe(struct ptlrpc_nrs_resource **resp)
{
struct ptlrpc_nrs_policy *pols[NRS_RES_MAX];
- struct ptlrpc_nrs *nrs = NULL;
- int i;
+ struct ptlrpc_nrs *nrs = NULL;
+ int i;
for (i = 0; i < NRS_RES_MAX; i++) {
if (resp[i] != NULL) {
for (i = 0; i < NRS_RES_MAX; i++) {
if (resp[i] != NULL) {
*/
static inline
struct ptlrpc_nrs_request *nrs_request_get(struct ptlrpc_nrs_policy *policy,
*/
static inline
struct ptlrpc_nrs_request *nrs_request_get(struct ptlrpc_nrs_policy *policy,
{
struct ptlrpc_nrs_request *nrq;
{
struct ptlrpc_nrs_request *nrq;
static inline void nrs_request_enqueue(struct ptlrpc_nrs_request *nrq)
{
struct ptlrpc_nrs_policy *policy;
static inline void nrs_request_enqueue(struct ptlrpc_nrs_request *nrq)
{
struct ptlrpc_nrs_policy *policy;
/**
* Try in descending order, because the primary policy (if any) is
/**
* Try in descending order, because the primary policy (if any) is
static int nrs_policy_ctl(struct ptlrpc_nrs *nrs, char *name,
enum ptlrpc_nrs_ctl opc, void *arg)
{
static int nrs_policy_ctl(struct ptlrpc_nrs *nrs, char *name,
enum ptlrpc_nrs_ctl opc, void *arg)
{
- struct ptlrpc_nrs_policy *policy;
- int rc = 0;
+ struct ptlrpc_nrs_policy *policy;
+ int rc = 0;
spin_lock(&nrs->nrs_lock);
spin_lock(&nrs->nrs_lock);
static int nrs_policy_register(struct ptlrpc_nrs *nrs,
struct ptlrpc_nrs_pol_desc *desc)
{
static int nrs_policy_register(struct ptlrpc_nrs *nrs,
struct ptlrpc_nrs_pol_desc *desc)
{
- struct ptlrpc_nrs_policy *policy;
- struct ptlrpc_nrs_policy *tmp;
- struct ptlrpc_service_part *svcpt = nrs->nrs_svcpt;
- int rc;
+ struct ptlrpc_nrs_policy *policy;
+ struct ptlrpc_nrs_policy *tmp;
+ struct ptlrpc_service_part *svcpt = nrs->nrs_svcpt;
+ int rc;
LASSERT(svcpt != NULL);
LASSERT(desc->pd_ops != NULL);
LASSERT(svcpt != NULL);
LASSERT(desc->pd_ops != NULL);
if (policy == NULL)
return -ENOMEM;
if (policy == NULL)
return -ENOMEM;
- policy->pol_nrs = nrs;
- policy->pol_desc = desc;
- policy->pol_state = NRS_POL_STATE_STOPPED;
- policy->pol_flags = desc->pd_flags;
+ policy->pol_nrs = nrs;
+ policy->pol_desc = desc;
+ policy->pol_state = NRS_POL_STATE_STOPPED;
+ policy->pol_flags = desc->pd_flags;
INIT_LIST_HEAD(&policy->pol_list);
INIT_LIST_HEAD(&policy->pol_list_queued);
INIT_LIST_HEAD(&policy->pol_list);
INIT_LIST_HEAD(&policy->pol_list_queued);
*/
static void ptlrpc_nrs_req_add_nolock(struct ptlrpc_request *req)
{
*/
static void ptlrpc_nrs_req_add_nolock(struct ptlrpc_request *req)
{
- struct ptlrpc_nrs_policy *policy;
+ struct ptlrpc_nrs_policy *policy;
LASSERT(req->rq_nrq.nr_initialized);
LASSERT(!req->rq_nrq.nr_enqueued);
LASSERT(req->rq_nrq.nr_initialized);
LASSERT(!req->rq_nrq.nr_enqueued);
*/
static void ptlrpc_nrs_hpreq_add_nolock(struct ptlrpc_request *req)
{
*/
static void ptlrpc_nrs_hpreq_add_nolock(struct ptlrpc_request *req)
{
- int opc = lustre_msg_get_opc(req->rq_reqmsg);
+ int opc = lustre_msg_get_opc(req->rq_reqmsg);
spin_lock(&req->rq_lock);
req->rq_hp = 1;
spin_lock(&req->rq_lock);
req->rq_hp = 1;
{
struct ptlrpc_nrs_pol_desc *desc;
/* for convenience */
{
struct ptlrpc_nrs_pol_desc *desc;
/* for convenience */
- struct ptlrpc_service_part *svcpt = nrs->nrs_svcpt;
- struct ptlrpc_service *svc = svcpt->scp_service;
- int rc = -EINVAL;
+ struct ptlrpc_service_part *svcpt = nrs->nrs_svcpt;
+ struct ptlrpc_service *svc = svcpt->scp_service;
+ int rc = -EINVAL;
LASSERT(mutex_is_locked(&nrs_core.nrs_mutex));
LASSERT(mutex_is_locked(&nrs_core.nrs_mutex));
static int nrs_svcpt_setup_locked0(struct ptlrpc_nrs *nrs,
struct ptlrpc_service_part *svcpt)
{
static int nrs_svcpt_setup_locked0(struct ptlrpc_nrs *nrs,
struct ptlrpc_service_part *svcpt)
{
- enum ptlrpc_nrs_queue_type queue;
+ enum ptlrpc_nrs_queue_type queue;
LASSERT(mutex_is_locked(&nrs_core.nrs_mutex));
LASSERT(mutex_is_locked(&nrs_core.nrs_mutex));
*/
static int nrs_svcpt_setup_locked(struct ptlrpc_service_part *svcpt)
{
*/
static int nrs_svcpt_setup_locked(struct ptlrpc_service_part *svcpt)
{
- struct ptlrpc_nrs *nrs;
- int rc;
+ struct ptlrpc_nrs *nrs;
+ int rc;
LASSERT(mutex_is_locked(&nrs_core.nrs_mutex));
LASSERT(mutex_is_locked(&nrs_core.nrs_mutex));
*/
static void nrs_svcpt_cleanup_locked(struct ptlrpc_service_part *svcpt)
{
*/
static void nrs_svcpt_cleanup_locked(struct ptlrpc_service_part *svcpt)
{
- struct ptlrpc_nrs *nrs;
- struct ptlrpc_nrs_policy *policy;
- struct ptlrpc_nrs_policy *tmp;
- int rc;
- bool hp = false;
+ struct ptlrpc_nrs *nrs;
+ struct ptlrpc_nrs_policy *policy;
+ struct ptlrpc_nrs_policy *tmp;
+ int rc;
+ bool hp = false;
LASSERT(mutex_is_locked(&nrs_core.nrs_mutex));
LASSERT(mutex_is_locked(&nrs_core.nrs_mutex));
*/
static struct ptlrpc_nrs_pol_desc *nrs_policy_find_desc_locked(const char *name)
{
*/
static struct ptlrpc_nrs_pol_desc *nrs_policy_find_desc_locked(const char *name)
{
- struct ptlrpc_nrs_pol_desc *tmp;
+ struct ptlrpc_nrs_pol_desc *tmp;
list_for_each_entry(tmp, &nrs_core.nrs_policies, pd_list) {
if (strncmp(tmp->pd_name, name, NRS_POL_NAME_MAX) == 0)
list_for_each_entry(tmp, &nrs_core.nrs_policies, pd_list) {
if (strncmp(tmp->pd_name, name, NRS_POL_NAME_MAX) == 0)
*/
static int nrs_policy_unregister_locked(struct ptlrpc_nrs_pol_desc *desc)
{
*/
static int nrs_policy_unregister_locked(struct ptlrpc_nrs_pol_desc *desc)
{
- struct ptlrpc_nrs *nrs;
- struct ptlrpc_service *svc;
- struct ptlrpc_service_part *svcpt;
- int i;
- int rc = 0;
+ struct ptlrpc_nrs *nrs;
+ struct ptlrpc_service *svc;
+ struct ptlrpc_service_part *svcpt;
+ int i;
+ int rc = 0;
LASSERT(mutex_is_locked(&nrs_core.nrs_mutex));
LASSERT(mutex_is_locked(&ptlrpc_all_services_mutex));
LASSERT(mutex_is_locked(&nrs_core.nrs_mutex));
LASSERT(mutex_is_locked(&ptlrpc_all_services_mutex));
*/
int ptlrpc_nrs_policy_register(struct ptlrpc_nrs_pol_conf *conf)
{
*/
int ptlrpc_nrs_policy_register(struct ptlrpc_nrs_pol_conf *conf)
{
- struct ptlrpc_service *svc;
- struct ptlrpc_nrs_pol_desc *desc;
- int rc = 0;
+ struct ptlrpc_service *svc;
+ struct ptlrpc_nrs_pol_desc *desc;
+ int rc = 0;
LASSERT(conf != NULL);
LASSERT(conf->nc_ops != NULL);
LASSERT(conf != NULL);
LASSERT(conf->nc_ops != NULL);
}
strncpy(desc->pd_name, conf->nc_name, NRS_POL_NAME_MAX);
}
strncpy(desc->pd_name, conf->nc_name, NRS_POL_NAME_MAX);
- desc->pd_ops = conf->nc_ops;
- desc->pd_compat = conf->nc_compat;
+ desc->pd_ops = conf->nc_ops;
+ desc->pd_compat = conf->nc_compat;
desc->pd_compat_svc_name = conf->nc_compat_svc_name;
if ((conf->nc_flags & PTLRPC_NRS_FL_REG_EXTERN) != 0)
desc->pd_compat_svc_name = conf->nc_compat_svc_name;
if ((conf->nc_flags & PTLRPC_NRS_FL_REG_EXTERN) != 0)
- desc->pd_owner = conf->nc_owner;
- desc->pd_flags = conf->nc_flags;
+ desc->pd_owner = conf->nc_owner;
+ desc->pd_flags = conf->nc_flags;
atomic_set(&desc->pd_refs, 0);
/**
atomic_set(&desc->pd_refs, 0);
/**
mutex_lock(&ptlrpc_all_services_mutex);
list_for_each_entry(svc, &ptlrpc_all_services, srv_list) {
mutex_lock(&ptlrpc_all_services_mutex);
list_for_each_entry(svc, &ptlrpc_all_services, srv_list) {
- struct ptlrpc_service_part *svcpt;
- int i;
- int rc2;
+ struct ptlrpc_service_part *svcpt;
+ int i;
+ int rc2;
if (!nrs_policy_compatible(svc, desc) ||
unlikely(svc->srv_is_stopping))
continue;
ptlrpc_service_for_each_part(svcpt, i, svc) {
if (!nrs_policy_compatible(svc, desc) ||
unlikely(svc->srv_is_stopping))
continue;
ptlrpc_service_for_each_part(svcpt, i, svc) {
- struct ptlrpc_nrs *nrs;
- bool hp = false;
+ struct ptlrpc_nrs *nrs;
+ bool hp = false;
again:
nrs = nrs_svcpt2nrs(svcpt, hp);
rc = nrs_policy_register(nrs, desc);
again:
nrs = nrs_svcpt2nrs(svcpt, hp);
rc = nrs_policy_register(nrs, desc);
*/
int ptlrpc_nrs_policy_unregister(struct ptlrpc_nrs_pol_conf *conf)
{
*/
int ptlrpc_nrs_policy_unregister(struct ptlrpc_nrs_pol_conf *conf)
{
- struct ptlrpc_nrs_pol_desc *desc;
- int rc;
+ struct ptlrpc_nrs_pol_desc *desc;
+ int rc;
*/
int ptlrpc_service_nrs_setup(struct ptlrpc_service *svc)
{
*/
int ptlrpc_service_nrs_setup(struct ptlrpc_service *svc)
{
- struct ptlrpc_service_part *svcpt;
- const struct ptlrpc_nrs_pol_desc *desc;
- int i;
- int rc = 0;
+ struct ptlrpc_service_part *svcpt;
+ const struct ptlrpc_nrs_pol_desc *desc;
+ int i;
+ int rc = 0;
mutex_lock(&nrs_core.nrs_mutex);
mutex_lock(&nrs_core.nrs_mutex);
*/
void ptlrpc_service_nrs_cleanup(struct ptlrpc_service *svc)
{
*/
void ptlrpc_service_nrs_cleanup(struct ptlrpc_service *svc)
{
- struct ptlrpc_service_part *svcpt;
- const struct ptlrpc_nrs_pol_desc *desc;
- int i;
+ struct ptlrpc_service_part *svcpt;
+ const struct ptlrpc_nrs_pol_desc *desc;
+ int i;
mutex_lock(&nrs_core.nrs_mutex);
mutex_lock(&nrs_core.nrs_mutex);
void ptlrpc_nrs_req_initialize(struct ptlrpc_service_part *svcpt,
struct ptlrpc_request *req, bool hp)
{
void ptlrpc_nrs_req_initialize(struct ptlrpc_service_part *svcpt,
struct ptlrpc_request *req, bool hp)
{
- struct ptlrpc_nrs *nrs = nrs_svcpt2nrs(svcpt, hp);
+ struct ptlrpc_nrs *nrs = nrs_svcpt2nrs(svcpt, hp);
memset(&req->rq_nrq, 0, sizeof(req->rq_nrq));
nrs_resource_get_safe(nrs, &req->rq_nrq, req->rq_nrq.nr_res_ptrs,
memset(&req->rq_nrq, 0, sizeof(req->rq_nrq));
nrs_resource_get_safe(nrs, &req->rq_nrq, req->rq_nrq.nr_res_ptrs,
ptlrpc_nrs_req_get_nolock0(struct ptlrpc_service_part *svcpt, bool hp,
bool peek, bool force)
{
ptlrpc_nrs_req_get_nolock0(struct ptlrpc_service_part *svcpt, bool hp,
bool peek, bool force)
{
- struct ptlrpc_nrs *nrs = nrs_svcpt2nrs(svcpt, hp);
- struct ptlrpc_nrs_policy *policy;
+ struct ptlrpc_nrs *nrs = nrs_svcpt2nrs(svcpt, hp);
+ struct ptlrpc_nrs_policy *policy;
struct ptlrpc_nrs_request *nrq;
/**
struct ptlrpc_nrs_request *nrq;
/**
*/
void ptlrpc_nrs_req_hp_move(struct ptlrpc_request *req)
{
*/
void ptlrpc_nrs_req_hp_move(struct ptlrpc_request *req)
{
- struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt;
- struct ptlrpc_nrs_request *nrq = &req->rq_nrq;
- struct ptlrpc_nrs_resource *res1[NRS_RES_MAX];
- struct ptlrpc_nrs_resource *res2[NRS_RES_MAX];
+ struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt;
+ struct ptlrpc_nrs_request *nrq = &req->rq_nrq;
+ struct ptlrpc_nrs_resource *res1[NRS_RES_MAX];
+ struct ptlrpc_nrs_resource *res2[NRS_RES_MAX];
/**
* Obtain the high-priority NRS head resources.
/**
* Obtain the high-priority NRS head resources.
enum ptlrpc_nrs_queue_type queue, char *name,
enum ptlrpc_nrs_ctl opc, bool single, void *arg)
{
enum ptlrpc_nrs_queue_type queue, char *name,
enum ptlrpc_nrs_ctl opc, bool single, void *arg)
{
- struct ptlrpc_service_part *svcpt;
- int i;
- int rc = 0;
+ struct ptlrpc_service_part *svcpt;
+ int i;
+ int rc = 0;
LASSERT(opc != PTLRPC_NRS_CTL_INVALID);
LASSERT(opc != PTLRPC_NRS_CTL_INVALID);
*/
int ptlrpc_nrs_init(void)
{
*/
int ptlrpc_nrs_init(void)
{
mutex_init(&nrs_core.nrs_mutex);
INIT_LIST_HEAD(&nrs_core.nrs_policies);
mutex_init(&nrs_core.nrs_mutex);
INIT_LIST_HEAD(&nrs_core.nrs_policies);
*/
static
struct ptlrpc_nrs_request *nrs_fifo_req_get(struct ptlrpc_nrs_policy *policy,
*/
static
struct ptlrpc_nrs_request *nrs_fifo_req_get(struct ptlrpc_nrs_policy *policy,
- struct nrs_fifo_head *head = policy->pol_private;
+ struct nrs_fifo_head *head = policy->pol_private;
struct ptlrpc_nrs_request *nrq;
nrq = unlikely(list_empty(&head->fh_list)) ? NULL :
struct ptlrpc_nrs_request *nrq;
nrq = unlikely(list_empty(&head->fh_list)) ? NULL :
/* See if we have anything in a pool, and wait if nothing */
while (list_empty(&svcpt->scp_rep_idle)) {
/* See if we have anything in a pool, and wait if nothing */
while (list_empty(&svcpt->scp_rep_idle)) {
- struct l_wait_info lwi;
- int rc;
+ struct l_wait_info lwi;
+ int rc;
spin_unlock(&svcpt->scp_rep_lock);
/* If we cannot get anything for some long time, we better
spin_unlock(&svcpt->scp_rep_lock);
/* If we cannot get anything for some long time, we better
__u32 *lens, char **bufs, int flags)
{
struct ptlrpc_reply_state *rs;
__u32 *lens, char **bufs, int flags)
{
struct ptlrpc_reply_state *rs;
LASSERT(req->rq_reply_state == NULL);
LASSERT(req->rq_reply_state == NULL);
int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, int segment,
unsigned int newlen, int move_data)
{
int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, int segment,
unsigned int newlen, int move_data)
{
- char *tail = NULL, *newpos;
- int tail_len = 0, n;
+ char *tail = NULL, *newpos;
+ int tail_len = 0, n;
LASSERT(msg);
LASSERT(msg->lm_bufcount > segment);
LASSERT(msg);
LASSERT(msg->lm_bufcount > segment);
struct ptlrpc_request_set *set)
{
struct ptlrpc_request *req;
struct ptlrpc_request_set *set)
{
struct ptlrpc_request *req;
req = ptlrpc_request_alloc(imp, &RQF_OBD_SET_INFO);
if (req == NULL)
req = ptlrpc_request_alloc(imp, &RQF_OBD_SET_INFO);
if (req == NULL)
CLASSERT(offsetof(typeof(*ocd), paddingF) != 0);
}
CLASSERT(offsetof(typeof(*ocd), paddingF) != 0);
}
-void lustre_swab_obdo(struct obdo *o)
+void lustre_swab_obdo(struct obdo *o)
{
__swab64s(&o->o_valid);
lustre_swab_ost_id(&o->o_oi);
{
__swab64s(&o->o_valid);
lustre_swab_ost_id(&o->o_oi);
void lustre_swab_ldlm_res_id(struct ldlm_res_id *id)
{
void lustre_swab_ldlm_res_id(struct ldlm_res_id *id)
{
for (i = 0; i < RES_NAME_SIZE; i++)
__swab64s(&id->name[i]);
for (i = 0; i < RES_NAME_SIZE; i++)
__swab64s(&id->name[i]);
#define PET_TERMINATE 2
static int pet_refcount;
#define PET_TERMINATE 2
static int pet_refcount;
-static int pet_state;
-static wait_queue_head_t pet_waitq;
+static int pet_state;
+static wait_queue_head_t pet_waitq;
static LIST_HEAD(pet_list);
static DEFINE_SPINLOCK(pet_lock);
static LIST_HEAD(pet_list);
static DEFINE_SPINLOCK(pet_lock);
#include "ptlrpc_internal.h"
struct ptlrpcd {
#include "ptlrpc_internal.h"
struct ptlrpcd {
- int pd_size;
- int pd_index;
- int pd_nthreads;
+ int pd_size;
+ int pd_index;
+ int pd_nthreads;
struct ptlrpcd_ctl pd_thread_rcv;
struct ptlrpcd_ctl pd_threads[0];
};
struct ptlrpcd_ctl pd_thread_rcv;
struct ptlrpcd_ctl pd_threads[0];
};
struct ptlrpc_sec_policy *sptlrpc_wireflavor2policy(__u32 flavor)
{
static DEFINE_MUTEX(load_mutex);
struct ptlrpc_sec_policy *sptlrpc_wireflavor2policy(__u32 flavor)
{
static DEFINE_MUTEX(load_mutex);
- static atomic_t loaded = ATOMIC_INIT(0);
+ static atomic_t loaded = ATOMIC_INIT(0);
struct ptlrpc_sec_policy *policy;
struct ptlrpc_sec_policy *policy;
- __u16 number = SPTLRPC_FLVR_POLICY(flavor);
- __u16 flag = 0;
+ __u16 number = SPTLRPC_FLVR_POLICY(flavor);
+ __u16 flag = 0;
if (number >= SPTLRPC_POLICY_MAX)
return NULL;
if (number >= SPTLRPC_POLICY_MAX)
return NULL;
static int import_sec_check_expire(struct obd_import *imp)
{
static int import_sec_check_expire(struct obd_import *imp)
{
spin_lock(&imp->imp_lock);
if (imp->imp_sec_expire &&
spin_lock(&imp->imp_lock);
if (imp->imp_sec_expire &&
static int import_sec_validate_get(struct obd_import *imp,
struct ptlrpc_sec **sec)
{
static int import_sec_validate_get(struct obd_import *imp,
struct ptlrpc_sec **sec)
{
if (unlikely(imp->imp_sec_expire)) {
rc = import_sec_check_expire(imp);
if (unlikely(imp->imp_sec_expire)) {
rc = import_sec_check_expire(imp);
struct ptlrpc_cli_ctx *oldctx,
struct ptlrpc_cli_ctx *newctx)
{
struct ptlrpc_cli_ctx *oldctx,
struct ptlrpc_cli_ctx *newctx)
{
- struct sptlrpc_flavor old_flvr;
- char *reqmsg = NULL; /* to workaround old gcc */
- int reqmsg_size;
- int rc = 0;
+ struct sptlrpc_flavor old_flvr;
+ char *reqmsg = NULL; /* to workaround old gcc */
+ int reqmsg_size;
+ int rc = 0;
LASSERT(req->rq_reqmsg);
LASSERT(req->rq_reqlen);
LASSERT(req->rq_reqmsg);
LASSERT(req->rq_reqlen);
{
struct ptlrpc_cli_ctx *oldctx = req->rq_cli_ctx;
struct ptlrpc_cli_ctx *newctx;
{
struct ptlrpc_cli_ctx *oldctx = req->rq_cli_ctx;
struct ptlrpc_cli_ctx *newctx;
*/
int sptlrpc_req_refresh_ctx(struct ptlrpc_request *req, long timeout)
{
*/
int sptlrpc_req_refresh_ctx(struct ptlrpc_request *req, long timeout)
{
- struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx;
- struct ptlrpc_sec *sec;
- struct l_wait_info lwi;
- int rc;
+ struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx;
+ struct ptlrpc_sec *sec;
+ struct l_wait_info lwi;
+ int rc;
*/
int sptlrpc_import_check_ctx(struct obd_import *imp)
{
*/
int sptlrpc_import_check_ctx(struct obd_import *imp)
{
- struct ptlrpc_sec *sec;
+ struct ptlrpc_sec *sec;
struct ptlrpc_cli_ctx *ctx;
struct ptlrpc_request *req = NULL;
int rc;
struct ptlrpc_cli_ctx *ctx;
struct ptlrpc_request *req = NULL;
int rc;
static int do_cli_unwrap_reply(struct ptlrpc_request *req)
{
struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx;
static int do_cli_unwrap_reply(struct ptlrpc_request *req)
{
struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx;
LASSERT(ctx);
LASSERT(ctx->cc_sec);
LASSERT(ctx);
LASSERT(ctx->cc_sec);
int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req,
struct ptlrpc_request **req_ret)
{
int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req,
struct ptlrpc_request **req_ret)
{
- struct ptlrpc_request *early_req;
- char *early_buf;
- int early_bufsz, early_size;
- int rc;
+ struct ptlrpc_request *early_req;
+ char *early_buf;
+ int early_bufsz, early_size;
+ int rc;
early_req = ptlrpc_request_cache_alloc(GFP_NOFS);
if (early_req == NULL)
early_req = ptlrpc_request_cache_alloc(GFP_NOFS);
if (early_req == NULL)
*/
static
struct ptlrpc_sec *sptlrpc_sec_create(struct obd_import *imp,
*/
static
struct ptlrpc_sec *sptlrpc_sec_create(struct obd_import *imp,
- struct ptlrpc_svc_ctx *svc_ctx,
- struct sptlrpc_flavor *sf,
- enum lustre_sec_part sp)
+ struct ptlrpc_svc_ctx *svc_ctx,
+ struct sptlrpc_flavor *sf,
+ enum lustre_sec_part sp)
{
struct ptlrpc_sec_policy *policy;
{
struct ptlrpc_sec_policy *policy;
- struct ptlrpc_sec *sec;
- char str[32];
+ struct ptlrpc_sec *sec;
+ char str[32];
if (svc_ctx) {
LASSERT(imp->imp_dlm_fake == 1);
if (svc_ctx) {
LASSERT(imp->imp_dlm_fake == 1);
struct ptlrpc_sec *sec,
struct sptlrpc_flavor *sf)
{
struct ptlrpc_sec *sec,
struct sptlrpc_flavor *sf)
{
- char str1[32], str2[32];
+ char str1[32], str2[32];
if (sec->ps_flvr.sf_flags != sf->sf_flags)
CDEBUG(D_SEC, "changing sec flags: %s -> %s\n",
if (sec->ps_flvr.sf_flags != sf->sf_flags)
CDEBUG(D_SEC, "changing sec flags: %s -> %s\n",
struct ptlrpc_svc_ctx *svc_ctx,
struct sptlrpc_flavor *flvr)
{
struct ptlrpc_svc_ctx *svc_ctx,
struct sptlrpc_flavor *flvr)
{
- struct ptlrpc_connection *conn;
- struct sptlrpc_flavor sf;
- struct ptlrpc_sec *sec, *newsec;
- enum lustre_sec_part sp;
- char str[24];
- int rc = 0;
+ struct ptlrpc_connection *conn;
+ struct sptlrpc_flavor sf;
+ struct ptlrpc_sec *sec, *newsec;
+ enum lustre_sec_part sp;
+ char str[24];
+ int rc = 0;
sec = sptlrpc_import_sec_ref(imp);
if (sec) {
sec = sptlrpc_import_sec_ref(imp);
if (sec) {
if (flavor_equal(&sf, &sec->ps_flvr))
goto out;
if (flavor_equal(&sf, &sec->ps_flvr))
goto out;
void _sptlrpc_enlarge_msg_inplace(struct lustre_msg *msg,
int segment, int newsize)
{
void _sptlrpc_enlarge_msg_inplace(struct lustre_msg *msg,
int segment, int newsize)
{
- void *src, *dst;
- int oldsize, oldmsg_size, movesize;
+ void *src, *dst;
+ int oldsize, oldmsg_size, movesize;
LASSERT(segment < msg->lm_bufcount);
LASSERT(msg->lm_buflens[segment] <= newsize);
LASSERT(segment < msg->lm_bufcount);
LASSERT(msg->lm_buflens[segment] <= newsize);
int sptlrpc_cli_enlarge_reqbuf(struct ptlrpc_request *req,
int segment, int newsize)
{
int sptlrpc_cli_enlarge_reqbuf(struct ptlrpc_request *req,
int segment, int newsize)
{
- struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx;
- struct ptlrpc_sec_cops *cops;
- struct lustre_msg *msg = req->rq_reqmsg;
+ struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx;
+ struct ptlrpc_sec_cops *cops;
+ struct lustre_msg *msg = req->rq_reqmsg;
LASSERT(ctx);
LASSERT(msg);
LASSERT(ctx);
LASSERT(msg);
int sptlrpc_target_export_check(struct obd_export *exp,
struct ptlrpc_request *req)
{
int sptlrpc_target_export_check(struct obd_export *exp,
struct ptlrpc_request *req)
{
- struct sptlrpc_flavor flavor;
+ struct sptlrpc_flavor flavor;
if (exp == NULL)
return 0;
if (exp == NULL)
return 0;
void sptlrpc_target_update_exp_flavor(struct obd_device *obd,
struct sptlrpc_rule_set *rset)
{
void sptlrpc_target_update_exp_flavor(struct obd_device *obd,
struct sptlrpc_rule_set *rset)
{
- struct obd_export *exp;
- struct sptlrpc_flavor new_flvr;
+ struct obd_export *exp;
+ struct sptlrpc_flavor new_flvr;
int sptlrpc_svc_unwrap_request(struct ptlrpc_request *req)
{
struct ptlrpc_sec_policy *policy;
int sptlrpc_svc_unwrap_request(struct ptlrpc_request *req)
{
struct ptlrpc_sec_policy *policy;
- struct lustre_msg *msg = req->rq_reqbuf;
- int rc;
+ struct lustre_msg *msg = req->rq_reqbuf;
+ int rc;
LASSERT(msg);
LASSERT(req->rq_reqmsg == NULL);
LASSERT(msg);
LASSERT(req->rq_reqmsg == NULL);
struct ptlrpc_bulk_desc *desc,
int nob)
{
struct ptlrpc_bulk_desc *desc,
int nob)
{
- struct ptlrpc_cli_ctx *ctx;
- int rc;
+ struct ptlrpc_cli_ctx *ctx;
+ int rc;
LASSERT(req->rq_bulk_read && !req->rq_bulk_write);
LASSERT(req->rq_bulk_read && !req->rq_bulk_write);
int sptlrpc_cli_unwrap_bulk_write(struct ptlrpc_request *req,
struct ptlrpc_bulk_desc *desc)
{
int sptlrpc_cli_unwrap_bulk_write(struct ptlrpc_request *req,
struct ptlrpc_bulk_desc *desc)
{
- struct ptlrpc_cli_ctx *ctx;
- int rc;
+ struct ptlrpc_cli_ctx *ctx;
+ int rc;
LASSERT(!req->rq_bulk_read && req->rq_bulk_write);
LASSERT(!req->rq_bulk_read && req->rq_bulk_write);
int sptlrpc_unpack_user_desc(struct lustre_msg *msg, int offset, int swabbed)
{
struct ptlrpc_user_desc *pud;
int sptlrpc_unpack_user_desc(struct lustre_msg *msg, int offset, int swabbed)
{
struct ptlrpc_user_desc *pud;
pud = lustre_msg_buf(msg, offset, sizeof(*pud));
if (!pud)
pud = lustre_msg_buf(msg, offset, sizeof(*pud));
if (!pud)
#define POINTERS_PER_PAGE (PAGE_CACHE_SIZE / sizeof(void *))
#define PAGES_PER_POOL (POINTERS_PER_PAGE)
#define POINTERS_PER_PAGE (PAGE_CACHE_SIZE / sizeof(void *))
#define PAGES_PER_POOL (POINTERS_PER_PAGE)
-#define IDLE_IDX_MAX (100)
+#define IDLE_IDX_MAX (100)
#define IDLE_IDX_WEIGHT (3)
#define CACHE_QUIESCENT_PERIOD (20)
#define IDLE_IDX_WEIGHT (3)
#define CACHE_QUIESCENT_PERIOD (20)
static void enc_pools_release_free_pages(long npages)
{
static void enc_pools_release_free_pages(long npages)
{
- int p_idx, g_idx;
- int p_idx_max1, p_idx_max2;
+ int p_idx, g_idx;
+ int p_idx_max1, p_idx_max2;
LASSERT(npages > 0);
LASSERT(npages <= page_pools.epp_free_pages);
LASSERT(npages > 0);
LASSERT(npages <= page_pools.epp_free_pages);
static unsigned long enc_pools_cleanup(struct page ***pools, int npools)
{
unsigned long cleaned = 0;
static unsigned long enc_pools_cleanup(struct page ***pools, int npools)
{
unsigned long cleaned = 0;
for (i = 0; i < npools; i++) {
if (pools[i]) {
for (i = 0; i < npools; i++) {
if (pools[i]) {
*/
static void enc_pools_insert(struct page ***pools, int npools, int npages)
{
*/
static void enc_pools_insert(struct page ***pools, int npools, int npages)
{
- int freeslot;
- int op_idx, np_idx, og_idx, ng_idx;
- int cur_npools, end_npools;
+ int freeslot;
+ int op_idx, np_idx, og_idx, ng_idx;
+ int cur_npools, end_npools;
LASSERT(npages > 0);
LASSERT(page_pools.epp_total_pages+npages <= page_pools.epp_max_pages);
LASSERT(npages > 0);
LASSERT(page_pools.epp_total_pages+npages <= page_pools.epp_max_pages);
static int enc_pools_add_pages(int npages)
{
static DEFINE_MUTEX(add_pages_mutex);
static int enc_pools_add_pages(int npages)
{
static DEFINE_MUTEX(add_pages_mutex);
- struct page ***pools;
- int npools, alloced = 0;
- int i, j, rc = -ENOMEM;
+ struct page ***pools;
+ int npools, alloced = 0;
+ int i, j, rc = -ENOMEM;
if (npages < PTLRPC_MAX_BRW_PAGES)
npages = PTLRPC_MAX_BRW_PAGES;
if (npages < PTLRPC_MAX_BRW_PAGES)
npages = PTLRPC_MAX_BRW_PAGES;
*/
int sptlrpc_enc_pool_get_pages(struct ptlrpc_bulk_desc *desc)
{
*/
int sptlrpc_enc_pool_get_pages(struct ptlrpc_bulk_desc *desc)
{
- wait_queue_t waitlink;
- unsigned long this_idle = -1;
- unsigned long tick = 0;
- long now;
- int p_idx, g_idx;
- int i;
+ wait_queue_t waitlink;
+ unsigned long this_idle = -1;
+ unsigned long tick = 0;
+ long now;
+ int p_idx, g_idx;
+ int i;
LASSERT(desc->bd_iov_count > 0);
LASSERT(desc->bd_iov_count <= page_pools.epp_max_pages);
LASSERT(desc->bd_iov_count > 0);
LASSERT(desc->bd_iov_count <= page_pools.epp_max_pages);
void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc)
{
void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc)
{
- int p_idx, g_idx;
- int i;
+ int p_idx, g_idx;
+ int i;
if (desc->bd_enc_iov == NULL)
return;
if (desc->bd_enc_iov == NULL)
return;
*/
int sptlrpc_enc_pool_add_user(void)
{
*/
int sptlrpc_enc_pool_add_user(void)
{
spin_lock(&page_pools.epp_lock);
if (page_pools.epp_growing == 0 && page_pools.epp_total_pages == 0) {
spin_lock(&page_pools.epp_lock);
if (page_pools.epp_growing == 0 && page_pools.epp_total_pages == 0) {
int sptlrpc_get_bulk_checksum(struct ptlrpc_bulk_desc *desc, __u8 alg,
void *buf, int buflen)
{
int sptlrpc_get_bulk_checksum(struct ptlrpc_bulk_desc *desc, __u8 alg,
void *buf, int buflen)
{
- struct cfs_crypto_hash_desc *hdesc;
- int hashsize;
- char hashbuf[64];
- unsigned int bufsize;
- int i, err;
+ struct cfs_crypto_hash_desc *hdesc;
+ int hashsize;
+ char hashbuf[64];
+ unsigned int bufsize;
+ int i, err;
LASSERT(alg > BULK_HASH_ALG_NULL && alg < BULK_HASH_ALG_MAX);
LASSERT(buflen >= 4);
LASSERT(alg > BULK_HASH_ALG_NULL && alg < BULK_HASH_ALG_MAX);
LASSERT(buflen >= 4);
*/
int sptlrpc_parse_flavor(const char *str, struct sptlrpc_flavor *flvr)
{
*/
int sptlrpc_parse_flavor(const char *str, struct sptlrpc_flavor *flvr)
{
- char buf[32];
- char *bulk, *alg;
+ char buf[32];
+ char *bulk, *alg;
memset(flvr, 0, sizeof(*flvr));
memset(flvr, 0, sizeof(*flvr));
*/
int sptlrpc_parse_rule(char *param, struct sptlrpc_rule *rule)
{
*/
int sptlrpc_parse_rule(char *param, struct sptlrpc_rule *rule)
{
- char *flavor, *dir;
- int rc;
+ char *flavor, *dir;
+ int rc;
int sptlrpc_rule_set_merge(struct sptlrpc_rule_set *rset,
struct sptlrpc_rule *rule)
{
int sptlrpc_rule_set_merge(struct sptlrpc_rule_set *rset,
struct sptlrpc_rule *rule)
{
- struct sptlrpc_rule *p = rset->srs_rules;
- int spec_dir, spec_net;
- int rc, n, match = 0;
+ struct sptlrpc_rule *p = rset->srs_rules;
+ int spec_dir, spec_net;
+ int rc, n, match = 0;
lnet_nid_t nid,
struct sptlrpc_flavor *sf)
{
lnet_nid_t nid,
struct sptlrpc_flavor *sf)
{
- struct sptlrpc_rule *r;
- int n;
+ struct sptlrpc_rule *r;
+ int n;
for (n = 0; n < rset->srs_nrule; n++) {
r = &rset->srs_rules[n];
for (n = 0; n < rset->srs_nrule; n++) {
r = &rset->srs_rules[n];
void sptlrpc_rule_set_dump(struct sptlrpc_rule_set *rset)
{
struct sptlrpc_rule *r;
void sptlrpc_rule_set_dump(struct sptlrpc_rule_set *rset)
{
struct sptlrpc_rule *r;
for (n = 0; n < rset->srs_nrule; n++) {
r = &rset->srs_rules[n];
for (n = 0; n < rset->srs_nrule; n++) {
r = &rset->srs_rules[n];
static void target2fsname(const char *tgt, char *fsname, int buflen)
{
static void target2fsname(const char *tgt, char *fsname, int buflen)
{
- const char *ptr;
- int len;
+ const char *ptr;
+ int len;
ptr = strrchr(tgt, '-');
if (ptr) {
ptr = strrchr(tgt, '-');
if (ptr) {
const char *target,
struct sptlrpc_rule *rule)
{
const char *target,
struct sptlrpc_rule *rule)
{
- struct sptlrpc_conf_tgt *conf_tgt;
- struct sptlrpc_rule_set *rule_set;
+ struct sptlrpc_conf_tgt *conf_tgt;
+ struct sptlrpc_rule_set *rule_set;
/* fsname == target means general rules for the whole fs */
if (strcmp(conf->sc_fsname, target) == 0) {
/* fsname == target means general rules for the whole fs */
if (strcmp(conf->sc_fsname, target) == 0) {
static int __sptlrpc_process_config(struct lustre_cfg *lcfg,
struct sptlrpc_conf *conf)
{
static int __sptlrpc_process_config(struct lustre_cfg *lcfg,
struct sptlrpc_conf *conf)
{
- char *target, *param;
- char fsname[MTI_NAME_MAXLEN];
- struct sptlrpc_rule rule;
- int rc;
+ char *target, *param;
+ char fsname[MTI_NAME_MAXLEN];
+ struct sptlrpc_rule rule;
+ int rc;
target = lustre_cfg_string(lcfg, 1);
if (target == NULL) {
target = lustre_cfg_string(lcfg, 1);
if (target == NULL) {
static int logname2fsname(const char *logname, char *buf, int buflen)
{
static int logname2fsname(const char *logname, char *buf, int buflen)
{
ptr = strrchr(logname, '-');
if (ptr == NULL || strcmp(ptr, "-sptlrpc")) {
ptr = strrchr(logname, '-');
if (ptr == NULL || strcmp(ptr, "-sptlrpc")) {
void sptlrpc_conf_log_update_begin(const char *logname)
{
struct sptlrpc_conf *conf;
void sptlrpc_conf_log_update_begin(const char *logname)
{
struct sptlrpc_conf *conf;
if (logname2fsname(logname, fsname, sizeof(fsname)))
return;
if (logname2fsname(logname, fsname, sizeof(fsname)))
return;
void sptlrpc_conf_log_update_end(const char *logname)
{
struct sptlrpc_conf *conf;
void sptlrpc_conf_log_update_end(const char *logname)
{
struct sptlrpc_conf *conf;
if (logname2fsname(logname, fsname, sizeof(fsname)))
return;
if (logname2fsname(logname, fsname, sizeof(fsname)))
return;
void sptlrpc_conf_log_start(const char *logname)
{
void sptlrpc_conf_log_start(const char *logname)
{
if (logname2fsname(logname, fsname, sizeof(fsname)))
return;
if (logname2fsname(logname, fsname, sizeof(fsname)))
return;
void sptlrpc_conf_log_stop(const char *logname)
{
struct sptlrpc_conf *conf;
void sptlrpc_conf_log_stop(const char *logname)
{
struct sptlrpc_conf *conf;
if (logname2fsname(logname, fsname, sizeof(fsname)))
return;
if (logname2fsname(logname, fsname, sizeof(fsname)))
return;
lnet_nid_t nid,
struct sptlrpc_flavor *sf)
{
lnet_nid_t nid,
struct sptlrpc_flavor *sf)
{
- struct sptlrpc_conf *conf;
+ struct sptlrpc_conf *conf;
struct sptlrpc_conf_tgt *conf_tgt;
struct sptlrpc_conf_tgt *conf_tgt;
- char name[MTI_NAME_MAXLEN];
- int len, rc = 0;
+ char name[MTI_NAME_MAXLEN];
+ int len, rc = 0;
target2fsname(target->uuid, name, sizeof(name));
target2fsname(target->uuid, name, sizeof(name));
*/
void sptlrpc_conf_client_adapt(struct obd_device *obd)
{
*/
void sptlrpc_conf_client_adapt(struct obd_device *obd)
{
- struct obd_import *imp;
+ struct obd_import *imp;
LASSERT(strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 ||
strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME) == 0);
LASSERT(strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 ||
strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME) == 0);
}
EXPORT_SYMBOL(sptlrpc_conf_client_adapt);
}
EXPORT_SYMBOL(sptlrpc_conf_client_adapt);
-int sptlrpc_conf_init(void)
+int sptlrpc_conf_init(void)
{
mutex_init(&sptlrpc_conf_lock);
return 0;
{
mutex_init(&sptlrpc_conf_lock);
return 0;
void sptlrpc_conf_fini(void)
{
void sptlrpc_conf_fini(void)
{
- struct sptlrpc_conf *conf, *conf_next;
+ struct sptlrpc_conf *conf, *conf_next;
mutex_lock(&sptlrpc_conf_lock);
list_for_each_entry_safe(conf, conf_next, &sptlrpc_confs, sc_list) {
mutex_lock(&sptlrpc_conf_lock);
list_for_each_entry_safe(conf, conf_next, &sptlrpc_confs, sc_list) {
static int sec_gc_main(void *arg)
{
struct ptlrpc_thread *thread = (struct ptlrpc_thread *) arg;
static int sec_gc_main(void *arg)
{
struct ptlrpc_thread *thread = (struct ptlrpc_thread *) arg;
- struct l_wait_info lwi;
+ struct l_wait_info lwi;
struct obd_device *dev = seq->private;
struct client_obd *cli = &dev->u.cli;
struct ptlrpc_sec *sec = NULL;
struct obd_device *dev = seq->private;
struct client_obd *cli = &dev->u.cli;
struct ptlrpc_sec *sec = NULL;
LASSERT(strcmp(dev->obd_type->typ_name, LUSTRE_OSC_NAME) == 0 ||
strcmp(dev->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 ||
LASSERT(strcmp(dev->obd_type->typ_name, LUSTRE_OSC_NAME) == 0 ||
strcmp(dev->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 ||
int sptlrpc_lprocfs_cliobd_attach(struct obd_device *dev)
{
int sptlrpc_lprocfs_cliobd_attach(struct obd_device *dev)
{
if (strcmp(dev->obd_type->typ_name, LUSTRE_OSC_NAME) != 0 &&
strcmp(dev->obd_type->typ_name, LUSTRE_MDC_NAME) != 0 &&
if (strcmp(dev->obd_type->typ_name, LUSTRE_OSC_NAME) != 0 &&
strcmp(dev->obd_type->typ_name, LUSTRE_MDC_NAME) != 0 &&
static
int null_ctx_verify(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req)
{
static
int null_ctx_verify(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req)
{
LASSERT(req->rq_repdata);
LASSERT(req->rq_repdata);
struct ptlrpc_request *req,
int segment, int newsize)
{
struct ptlrpc_request *req,
int segment, int newsize)
{
- struct lustre_msg *newbuf;
- struct lustre_msg *oldbuf = req->rq_reqmsg;
- int oldsize, newmsg_size, alloc_size;
+ struct lustre_msg *newbuf;
+ struct lustre_msg *oldbuf = req->rq_reqmsg;
+ int oldsize, newmsg_size, alloc_size;
LASSERT(req->rq_reqbuf);
LASSERT(req->rq_reqbuf == req->rq_reqmsg);
LASSERT(req->rq_reqbuf);
LASSERT(req->rq_reqbuf == req->rq_reqmsg);
struct plain_bulk_token *tokenr)
{
struct plain_bulk_token tokenv;
struct plain_bulk_token *tokenr)
{
struct plain_bulk_token tokenv;
if (hash_alg == BULK_HASH_ALG_NULL)
return 0;
if (hash_alg == BULK_HASH_ALG_NULL)
return 0;
static void corrupt_bulk_data(struct ptlrpc_bulk_desc *desc)
{
static void corrupt_bulk_data(struct ptlrpc_bulk_desc *desc)
{
- char *ptr;
- unsigned int off, i;
+ char *ptr;
+ unsigned int off, i;
for (i = 0; i < desc->bd_iov_count; i++) {
if (desc->bd_iov[i].kiov_len == 0)
for (i = 0; i < desc->bd_iov_count; i++) {
if (desc->bd_iov[i].kiov_len == 0)
static
int plain_ctx_sign(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req)
{
static
int plain_ctx_sign(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req)
{
- struct lustre_msg *msg = req->rq_reqbuf;
+ struct lustre_msg *msg = req->rq_reqbuf;
struct plain_header *phdr;
msg->lm_secflvr = req->rq_flvr.sf_rpc;
struct plain_header *phdr;
msg->lm_secflvr = req->rq_flvr.sf_rpc;
static
int plain_ctx_verify(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req)
{
static
int plain_ctx_verify(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req)
{
- struct lustre_msg *msg = req->rq_repdata;
+ struct lustre_msg *msg = req->rq_repdata;
struct plain_header *phdr;
struct plain_header *phdr;
- __u32 cksum;
- int swabbed;
+ __u32 cksum;
+ int swabbed;
if (msg->lm_bufcount != PLAIN_PACK_SEGMENTS) {
CERROR("unexpected reply buf count %u\n", msg->lm_bufcount);
if (msg->lm_bufcount != PLAIN_PACK_SEGMENTS) {
CERROR("unexpected reply buf count %u\n", msg->lm_bufcount);
struct ptlrpc_bulk_desc *desc)
{
struct ptlrpc_bulk_sec_desc *bsd;
struct ptlrpc_bulk_desc *desc)
{
struct ptlrpc_bulk_sec_desc *bsd;
- struct plain_bulk_token *token;
- int rc;
+ struct plain_bulk_token *token;
+ int rc;
LASSERT(req->rq_pack_bulk);
LASSERT(req->rq_reqbuf->lm_bufcount == PLAIN_PACK_SEGMENTS);
LASSERT(req->rq_pack_bulk);
LASSERT(req->rq_reqbuf->lm_bufcount == PLAIN_PACK_SEGMENTS);
struct ptlrpc_bulk_desc *desc)
{
struct ptlrpc_bulk_sec_desc *bsdv;
struct ptlrpc_bulk_desc *desc)
{
struct ptlrpc_bulk_sec_desc *bsdv;
- struct plain_bulk_token *tokenv;
- int rc;
- int i, nob;
+ struct plain_bulk_token *tokenv;
+ int rc;
+ int i, nob;
LASSERT(req->rq_pack_bulk);
LASSERT(req->rq_reqbuf->lm_bufcount == PLAIN_PACK_SEGMENTS);
LASSERT(req->rq_pack_bulk);
LASSERT(req->rq_reqbuf->lm_bufcount == PLAIN_PACK_SEGMENTS);
static
struct ptlrpc_cli_ctx *plain_sec_install_ctx(struct plain_sec *plsec)
{
static
struct ptlrpc_cli_ctx *plain_sec_install_ctx(struct plain_sec *plsec)
{
- struct ptlrpc_cli_ctx *ctx, *ctx_new;
+ struct ptlrpc_cli_ctx *ctx, *ctx_new;
ctx_new = kzalloc(sizeof(*ctx_new), GFP_NOFS);
ctx_new = kzalloc(sizeof(*ctx_new), GFP_NOFS);
static
void plain_destroy_sec(struct ptlrpc_sec *sec)
{
static
void plain_destroy_sec(struct ptlrpc_sec *sec)
{
- struct plain_sec *plsec = sec2plsec(sec);
+ struct plain_sec *plsec = sec2plsec(sec);
LASSERT(sec->ps_policy == &plain_policy);
LASSERT(sec->ps_import);
LASSERT(sec->ps_policy == &plain_policy);
LASSERT(sec->ps_import);
struct ptlrpc_svc_ctx *svc_ctx,
struct sptlrpc_flavor *sf)
{
struct ptlrpc_svc_ctx *svc_ctx,
struct sptlrpc_flavor *sf)
{
- struct plain_sec *plsec;
- struct ptlrpc_sec *sec;
- struct ptlrpc_cli_ctx *ctx;
+ struct plain_sec *plsec;
+ struct ptlrpc_sec *sec;
+ struct ptlrpc_cli_ctx *ctx;
LASSERT(SPTLRPC_FLVR_POLICY(sf->sf_rpc) == SPTLRPC_POLICY_PLAIN);
LASSERT(SPTLRPC_FLVR_POLICY(sf->sf_rpc) == SPTLRPC_POLICY_PLAIN);
struct vfs_cred *vcred,
int create, int remove_dead)
{
struct vfs_cred *vcred,
int create, int remove_dead)
{
- struct plain_sec *plsec = sec2plsec(sec);
- struct ptlrpc_cli_ctx *ctx;
+ struct plain_sec *plsec = sec2plsec(sec);
+ struct ptlrpc_cli_ctx *ctx;
read_lock(&plsec->pls_lock);
ctx = plsec->pls_ctx;
read_lock(&plsec->pls_lock);
ctx = plsec->pls_ctx;
int plain_flush_ctx_cache(struct ptlrpc_sec *sec,
uid_t uid, int grace, int force)
{
int plain_flush_ctx_cache(struct ptlrpc_sec *sec,
uid_t uid, int grace, int force)
{
- struct plain_sec *plsec = sec2plsec(sec);
- struct ptlrpc_cli_ctx *ctx;
+ struct plain_sec *plsec = sec2plsec(sec);
+ struct ptlrpc_cli_ctx *ctx;
/* do nothing unless caller want to flush for 'all' */
if (uid != -1)
/* do nothing unless caller want to flush for 'all' */
if (uid != -1)
int msgsize)
{
__u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, };
int msgsize)
{
__u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, };
buflens[PLAIN_PACK_HDR_OFF] = sizeof(struct plain_header);
buflens[PLAIN_PACK_MSG_OFF] = msgsize;
buflens[PLAIN_PACK_HDR_OFF] = sizeof(struct plain_header);
buflens[PLAIN_PACK_MSG_OFF] = msgsize;
struct ptlrpc_request *req,
int segment, int newsize)
{
struct ptlrpc_request *req,
int segment, int newsize)
{
- struct lustre_msg *newbuf;
- int oldsize;
- int newmsg_size, newbuf_size;
+ struct lustre_msg *newbuf;
+ int oldsize;
+ int newmsg_size, newbuf_size;
LASSERT(req->rq_reqbuf);
LASSERT(req->rq_reqbuf_len >= req->rq_reqlen);
LASSERT(req->rq_reqbuf);
LASSERT(req->rq_reqbuf_len >= req->rq_reqlen);
static
int plain_accept(struct ptlrpc_request *req)
{
static
int plain_accept(struct ptlrpc_request *req)
{
- struct lustre_msg *msg = req->rq_reqbuf;
+ struct lustre_msg *msg = req->rq_reqbuf;
struct plain_header *phdr;
struct plain_header *phdr;
LASSERT(SPTLRPC_FLVR_POLICY(req->rq_flvr.sf_rpc) ==
SPTLRPC_POLICY_PLAIN);
LASSERT(SPTLRPC_FLVR_POLICY(req->rq_flvr.sf_rpc) ==
SPTLRPC_POLICY_PLAIN);
static
int plain_alloc_rs(struct ptlrpc_request *req, int msgsize)
{
static
int plain_alloc_rs(struct ptlrpc_request *req, int msgsize)
{
- struct ptlrpc_reply_state *rs;
- __u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, };
- int rs_size = sizeof(*rs);
+ struct ptlrpc_reply_state *rs;
+ __u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, };
+ int rs_size = sizeof(*rs);
LASSERT(msgsize % 8 == 0);
LASSERT(msgsize % 8 == 0);
int plain_authorize(struct ptlrpc_request *req)
{
struct ptlrpc_reply_state *rs = req->rq_reply_state;
int plain_authorize(struct ptlrpc_request *req)
{
struct ptlrpc_reply_state *rs = req->rq_reply_state;
- struct lustre_msg_v2 *msg = rs->rs_repbuf;
- struct plain_header *phdr;
- int len;
+ struct lustre_msg_v2 *msg = rs->rs_repbuf;
+ struct plain_header *phdr;
+ int len;
LASSERT(rs);
LASSERT(msg);
LASSERT(rs);
LASSERT(msg);
int plain_svc_unwrap_bulk(struct ptlrpc_request *req,
struct ptlrpc_bulk_desc *desc)
{
int plain_svc_unwrap_bulk(struct ptlrpc_request *req,
struct ptlrpc_bulk_desc *desc)
{
- struct ptlrpc_reply_state *rs = req->rq_reply_state;
+ struct ptlrpc_reply_state *rs = req->rq_reply_state;
struct ptlrpc_bulk_sec_desc *bsdr, *bsdv;
struct ptlrpc_bulk_sec_desc *bsdr, *bsdv;
- struct plain_bulk_token *tokenr;
- int rc;
+ struct plain_bulk_token *tokenr;
+ int rc;
LASSERT(req->rq_bulk_write);
LASSERT(req->rq_pack_bulk);
LASSERT(req->rq_bulk_write);
LASSERT(req->rq_pack_bulk);
int plain_svc_wrap_bulk(struct ptlrpc_request *req,
struct ptlrpc_bulk_desc *desc)
{
int plain_svc_wrap_bulk(struct ptlrpc_request *req,
struct ptlrpc_bulk_desc *desc)
{
- struct ptlrpc_reply_state *rs = req->rq_reply_state;
+ struct ptlrpc_reply_state *rs = req->rq_reply_state;
struct ptlrpc_bulk_sec_desc *bsdr, *bsdv;
struct ptlrpc_bulk_sec_desc *bsdr, *bsdv;
- struct plain_bulk_token *tokenv;
- int rc;
+ struct plain_bulk_token *tokenv;
+ int rc;
LASSERT(req->rq_bulk_read);
LASSERT(req->rq_pack_bulk);
LASSERT(req->rq_bulk_read);
LASSERT(req->rq_pack_bulk);
struct ptlrpc_request_buffer_desc *
ptlrpc_alloc_rqbd(struct ptlrpc_service_part *svcpt)
{
struct ptlrpc_request_buffer_desc *
ptlrpc_alloc_rqbd(struct ptlrpc_service_part *svcpt)
{
- struct ptlrpc_service *svc = svcpt->scp_service;
+ struct ptlrpc_service *svc = svcpt->scp_service;
struct ptlrpc_request_buffer_desc *rqbd;
rqbd = kzalloc_node(sizeof(*rqbd), GFP_NOFS,
struct ptlrpc_request_buffer_desc *rqbd;
rqbd = kzalloc_node(sizeof(*rqbd), GFP_NOFS,
int
ptlrpc_grow_req_bufs(struct ptlrpc_service_part *svcpt, int post)
{
int
ptlrpc_grow_req_bufs(struct ptlrpc_service_part *svcpt, int post)
{
- struct ptlrpc_service *svc = svcpt->scp_service;
+ struct ptlrpc_service *svc = svcpt->scp_service;
struct ptlrpc_request_buffer_desc *rqbd;
struct ptlrpc_request_buffer_desc *rqbd;
if (svcpt->scp_rqbd_allocating)
goto try_post;
if (svcpt->scp_rqbd_allocating)
goto try_post;
struct lustre_handle *lock, int mode, int no_ack)
{
struct ptlrpc_reply_state *rs = req->rq_reply_state;
struct lustre_handle *lock, int mode, int no_ack)
{
struct ptlrpc_reply_state *rs = req->rq_reply_state;
LASSERT(rs != NULL);
LASSERT(rs->rs_nlocks < RS_MAX_LOCKS);
LASSERT(rs != NULL);
LASSERT(rs->rs_nlocks < RS_MAX_LOCKS);
static struct ptlrpc_hr_thread *
ptlrpc_hr_select(struct ptlrpc_service_part *svcpt)
{
static struct ptlrpc_hr_thread *
ptlrpc_hr_select(struct ptlrpc_service_part *svcpt)
{
- struct ptlrpc_hr_partition *hrp;
- unsigned int rotor;
+ struct ptlrpc_hr_partition *hrp;
+ unsigned int rotor;
if (svcpt->scp_cpt >= 0 &&
svcpt->scp_service->srv_cptable == ptlrpc_hr.hr_cpt_table) {
if (svcpt->scp_cpt >= 0 &&
svcpt->scp_service->srv_cptable == ptlrpc_hr.hr_cpt_table) {
ptlrpc_server_post_idle_rqbds(struct ptlrpc_service_part *svcpt)
{
struct ptlrpc_request_buffer_desc *rqbd;
ptlrpc_server_post_idle_rqbds(struct ptlrpc_service_part *svcpt)
{
struct ptlrpc_request_buffer_desc *rqbd;
- int rc;
- int posted = 0;
+ int rc;
+ int posted = 0;
for (;;) {
spin_lock(&svcpt->scp_lock);
for (;;) {
spin_lock(&svcpt->scp_lock);
ptlrpc_server_nthreads_check(struct ptlrpc_service *svc,
struct ptlrpc_service_conf *conf)
{
ptlrpc_server_nthreads_check(struct ptlrpc_service *svc,
struct ptlrpc_service_conf *conf)
{
- struct ptlrpc_service_thr_conf *tc = &conf->psc_thr;
- unsigned init;
- unsigned total;
- unsigned nthrs;
- int weight;
+ struct ptlrpc_service_thr_conf *tc = &conf->psc_thr;
+ unsigned init;
+ unsigned total;
+ unsigned nthrs;
+ int weight;
/*
* Common code for estimating & validating threads number.
/*
* Common code for estimating & validating threads number.
* be up to 8 * nthrs_max */
total = min(tc->tc_nthrs_max * 8, tc->tc_nthrs_user);
nthrs = total / svc->srv_ncpts;
* be up to 8 * nthrs_max */
total = min(tc->tc_nthrs_max * 8, tc->tc_nthrs_user);
nthrs = total / svc->srv_ncpts;
- init = max(init, nthrs);
+ init = max(init, nthrs);
nthrs = tc->tc_nthrs_base;
if (svc->srv_ncpts == 1) {
nthrs = tc->tc_nthrs_base;
if (svc->srv_ncpts == 1) {
/* NB: Increase the base number if it's single partition
* and total number of cores/HTs is larger or equal to 4.
/* NB: Increase the base number if it's single partition
* and total number of cores/HTs is larger or equal to 4.
}
if (tc->tc_thr_factor != 0) {
}
if (tc->tc_thr_factor != 0) {
- int factor = tc->tc_thr_factor;
+ int factor = tc->tc_thr_factor;
struct ptlrpc_service_part *svcpt, int cpt)
{
struct ptlrpc_at_array *array;
struct ptlrpc_service_part *svcpt, int cpt)
{
struct ptlrpc_at_array *array;
- int size;
- int index;
- int rc;
+ int size;
+ int index;
+ int rc;
svcpt->scp_cpt = cpt;
INIT_LIST_HEAD(&svcpt->scp_threads);
svcpt->scp_cpt = cpt;
INIT_LIST_HEAD(&svcpt->scp_threads);
array = &svcpt->scp_at_array;
size = at_est2timeout(at_max);
array = &svcpt->scp_at_array;
size = at_est2timeout(at_max);
- array->paa_size = size;
- array->paa_count = 0;
+ array->paa_size = size;
+ array->paa_count = 0;
array->paa_deadline = -1;
/* allocate memory for scp_at_array (ptlrpc_at_array) */
array->paa_deadline = -1;
/* allocate memory for scp_at_array (ptlrpc_at_array) */
struct kset *parent,
struct dentry *debugfs_entry)
{
struct kset *parent,
struct dentry *debugfs_entry)
{
- struct ptlrpc_service_cpt_conf *cconf = &conf->psc_cpt;
- struct ptlrpc_service *service;
- struct ptlrpc_service_part *svcpt;
- struct cfs_cpt_table *cptable;
- __u32 *cpts = NULL;
- int ncpts;
- int cpt;
- int rc;
- int i;
+ struct ptlrpc_service_cpt_conf *cconf = &conf->psc_cpt;
+ struct ptlrpc_service *service;
+ struct ptlrpc_service_part *svcpt;
+ struct cfs_cpt_table *cptable;
+ __u32 *cpts = NULL;
+ int ncpts;
+ int cpt;
+ int rc;
+ int i;
LASSERT(conf->psc_buf.bc_nbufs > 0);
LASSERT(conf->psc_buf.bc_buf_size >=
LASSERT(conf->psc_buf.bc_nbufs > 0);
LASSERT(conf->psc_buf.bc_buf_size >=
} else {
ncpts = cfs_cpt_number(cptable);
if (cconf->cc_pattern != NULL) {
} else {
ncpts = cfs_cpt_number(cptable);
if (cconf->cc_pattern != NULL) {
- struct cfs_expr_list *el;
+ struct cfs_expr_list *el;
rc = cfs_expr_list_parse(cconf->cc_pattern,
strlen(cconf->cc_pattern),
rc = cfs_expr_list_parse(cconf->cc_pattern,
strlen(cconf->cc_pattern),
return ERR_PTR(-ENOMEM);
}
return ERR_PTR(-ENOMEM);
}
- service->srv_cptable = cptable;
- service->srv_cpts = cpts;
- service->srv_ncpts = ncpts;
+ service->srv_cptable = cptable;
+ service->srv_cpts = cpts;
+ service->srv_ncpts = ncpts;
service->srv_cpt_bits = 0; /* it's zero already, easy to read... */
while ((1 << service->srv_cpt_bits) < cfs_cpt_number(cptable))
service->srv_cpt_bits = 0; /* it's zero already, easy to read... */
while ((1 << service->srv_cpt_bits) < cfs_cpt_number(cptable))
/* public members */
spin_lock_init(&service->srv_lock);
/* public members */
spin_lock_init(&service->srv_lock);
- service->srv_name = conf->psc_name;
- service->srv_watchdog_factor = conf->psc_watchdog_factor;
+ service->srv_name = conf->psc_name;
+ service->srv_watchdog_factor = conf->psc_watchdog_factor;
INIT_LIST_HEAD(&service->srv_list); /* for safety of cleanup */
/* buffer configuration */
INIT_LIST_HEAD(&service->srv_list); /* for safety of cleanup */
/* buffer configuration */
- service->srv_nbuf_per_group = test_req_buffer_pressure ?
+ service->srv_nbuf_per_group = test_req_buffer_pressure ?
1 : conf->psc_buf.bc_nbufs;
1 : conf->psc_buf.bc_nbufs;
- service->srv_max_req_size = conf->psc_buf.bc_req_max_size +
+ service->srv_max_req_size = conf->psc_buf.bc_req_max_size +
- service->srv_buf_size = conf->psc_buf.bc_buf_size;
- service->srv_rep_portal = conf->psc_buf.bc_rep_portal;
- service->srv_req_portal = conf->psc_buf.bc_req_portal;
+ service->srv_buf_size = conf->psc_buf.bc_buf_size;
+ service->srv_rep_portal = conf->psc_buf.bc_rep_portal;
+ service->srv_req_portal = conf->psc_buf.bc_req_portal;
/* Increase max reply size to next power of two */
service->srv_max_reply_size = 1;
/* Increase max reply size to next power of two */
service->srv_max_reply_size = 1;
conf->psc_buf.bc_rep_max_size + SPTLRPC_MAX_PAYLOAD)
service->srv_max_reply_size <<= 1;
conf->psc_buf.bc_rep_max_size + SPTLRPC_MAX_PAYLOAD)
service->srv_max_reply_size <<= 1;
- service->srv_thread_name = conf->psc_thr.tc_thr_name;
- service->srv_ctx_tags = conf->psc_thr.tc_ctx_tags;
- service->srv_hpreq_ratio = PTLRPC_SVC_HP_RATIO;
- service->srv_ops = conf->psc_ops;
+ service->srv_thread_name = conf->psc_thr.tc_thr_name;
+ service->srv_ctx_tags = conf->psc_thr.tc_ctx_tags;
+ service->srv_hpreq_ratio = PTLRPC_SVC_HP_RATIO;
+ service->srv_ops = conf->psc_ops;
for (i = 0; i < ncpts; i++) {
if (!conf->psc_thr.tc_cpu_affinity)
for (i = 0; i < ncpts; i++) {
if (!conf->psc_thr.tc_cpu_affinity)
void ptlrpc_server_drop_request(struct ptlrpc_request *req)
{
struct ptlrpc_request_buffer_desc *rqbd = req->rq_rqbd;
void ptlrpc_server_drop_request(struct ptlrpc_request *req)
{
struct ptlrpc_request_buffer_desc *rqbd = req->rq_rqbd;
- struct ptlrpc_service_part *svcpt = rqbd->rqbd_svcpt;
- struct ptlrpc_service *svc = svcpt->scp_service;
- int refcount;
- struct list_head *tmp;
- struct list_head *nxt;
+ struct ptlrpc_service_part *svcpt = rqbd->rqbd_svcpt;
+ struct ptlrpc_service *svc = svcpt->scp_service;
+ int refcount;
+ struct list_head *tmp;
+ struct list_head *nxt;
if (!atomic_dec_and_test(&req->rq_refcount))
return;
if (!atomic_dec_and_test(&req->rq_refcount))
return;
struct ptlrpc_at_array *array = &svcpt->scp_at_array;
struct ptlrpc_request *rq, *n;
struct list_head work_list;
struct ptlrpc_at_array *array = &svcpt->scp_at_array;
struct ptlrpc_request *rq, *n;
struct list_head work_list;
time_t deadline;
time_t now = get_seconds();
long delay;
time_t deadline;
time_t now = get_seconds();
long delay;
ptlrpc_server_handle_req_in(struct ptlrpc_service_part *svcpt,
struct ptlrpc_thread *thread)
{
ptlrpc_server_handle_req_in(struct ptlrpc_service_part *svcpt,
struct ptlrpc_thread *thread)
{
- struct ptlrpc_service *svc = svcpt->scp_service;
- struct ptlrpc_request *req;
- __u32 deadline;
- int rc;
+ struct ptlrpc_service *svc = svcpt->scp_service;
+ struct ptlrpc_request *req;
+ __u32 deadline;
+ int rc;
spin_lock(&svcpt->scp_lock);
if (list_empty(&svcpt->scp_req_incoming)) {
spin_lock(&svcpt->scp_lock);
if (list_empty(&svcpt->scp_req_incoming)) {
{
struct ptlrpc_service *svc = svcpt->scp_service;
struct ptlrpc_request *request;
{
struct ptlrpc_service *svc = svcpt->scp_service;
struct ptlrpc_request *request;
- struct timeval work_start;
- struct timeval work_end;
- long timediff;
- int rc;
- int fail_opc = 0;
+ struct timeval work_start;
+ struct timeval work_end;
+ long timediff;
+ int rc;
+ int fail_opc = 0;
request = ptlrpc_server_request_get(svcpt, false);
if (request == NULL)
request = ptlrpc_server_request_get(svcpt, false);
if (request == NULL)
ptlrpc_handle_rs(struct ptlrpc_reply_state *rs)
{
struct ptlrpc_service_part *svcpt = rs->rs_svcpt;
ptlrpc_handle_rs(struct ptlrpc_reply_state *rs)
{
struct ptlrpc_service_part *svcpt = rs->rs_svcpt;
- struct ptlrpc_service *svc = svcpt->scp_service;
- struct obd_export *exp;
- int nlocks;
- int been_handled;
+ struct ptlrpc_service *svc = svcpt->scp_service;
+ struct obd_export *exp;
+ int nlocks;
+ int been_handled;
*/
static int ptlrpc_main(void *arg)
{
*/
static int ptlrpc_main(void *arg)
{
- struct ptlrpc_thread *thread = (struct ptlrpc_thread *)arg;
- struct ptlrpc_service_part *svcpt = thread->t_svcpt;
- struct ptlrpc_service *svc = svcpt->scp_service;
- struct ptlrpc_reply_state *rs;
+ struct ptlrpc_thread *thread = (struct ptlrpc_thread *)arg;
+ struct ptlrpc_service_part *svcpt = thread->t_svcpt;
+ struct ptlrpc_service *svc = svcpt->scp_service;
+ struct ptlrpc_reply_state *rs;
struct group_info *ginfo = NULL;
struct lu_env *env;
int counter = 0, rc = 0;
struct group_info *ginfo = NULL;
struct lu_env *env;
int counter = 0, rc = 0;
*/
static int ptlrpc_hr_main(void *arg)
{
*/
static int ptlrpc_hr_main(void *arg)
{
- struct ptlrpc_hr_thread *hrt = (struct ptlrpc_hr_thread *)arg;
- struct ptlrpc_hr_partition *hrp = hrt->hrt_partition;
- LIST_HEAD (replies);
- char threadname[20];
- int rc;
+ struct ptlrpc_hr_thread *hrt = (struct ptlrpc_hr_thread *)arg;
+ struct ptlrpc_hr_partition *hrp = hrt->hrt_partition;
+ LIST_HEAD (replies);
+ char threadname[20];
+ int rc;
snprintf(threadname, sizeof(threadname), "ptlrpc_hr%02d_%03d",
hrp->hrp_cpt, hrt->hrt_id);
snprintf(threadname, sizeof(threadname), "ptlrpc_hr%02d_%03d",
hrp->hrp_cpt, hrt->hrt_id);
static void ptlrpc_stop_hr_threads(void)
{
static void ptlrpc_stop_hr_threads(void)
{
- struct ptlrpc_hr_partition *hrp;
- int i;
- int j;
+ struct ptlrpc_hr_partition *hrp;
+ int i;
+ int j;
ptlrpc_hr.hr_stopping = 1;
ptlrpc_hr.hr_stopping = 1;
static int ptlrpc_start_hr_threads(void)
{
static int ptlrpc_start_hr_threads(void)
{
- struct ptlrpc_hr_partition *hrp;
- int i;
- int j;
+ struct ptlrpc_hr_partition *hrp;
+ int i;
+ int j;
cfs_percpt_for_each(hrp, i, ptlrpc_hr.hr_partitions) {
cfs_percpt_for_each(hrp, i, ptlrpc_hr.hr_partitions) {
for (j = 0; j < hrp->hrp_nthrs; j++) {
struct ptlrpc_hr_thread *hrt = &hrp->hrp_thrs[j];
for (j = 0; j < hrp->hrp_nthrs; j++) {
struct ptlrpc_hr_thread *hrt = &hrp->hrp_thrs[j];
static void ptlrpc_svcpt_stop_threads(struct ptlrpc_service_part *svcpt)
{
static void ptlrpc_svcpt_stop_threads(struct ptlrpc_service_part *svcpt)
{
- struct l_wait_info lwi = { 0 };
- struct ptlrpc_thread *thread;
- LIST_HEAD (zombie);
+ struct l_wait_info lwi = { 0 };
+ struct ptlrpc_thread *thread;
+ LIST_HEAD (zombie);
CDEBUG(D_INFO, "Stopping threads for service %s\n",
svcpt->scp_service->srv_name);
CDEBUG(D_INFO, "Stopping threads for service %s\n",
svcpt->scp_service->srv_name);
void ptlrpc_stop_all_threads(struct ptlrpc_service *svc)
{
struct ptlrpc_service_part *svcpt;
void ptlrpc_stop_all_threads(struct ptlrpc_service *svc)
{
struct ptlrpc_service_part *svcpt;
ptlrpc_service_for_each_part(svcpt, i, svc) {
if (svcpt->scp_service != NULL)
ptlrpc_service_for_each_part(svcpt, i, svc) {
if (svcpt->scp_service != NULL)
int ptlrpc_start_threads(struct ptlrpc_service *svc)
{
int ptlrpc_start_threads(struct ptlrpc_service *svc)
{
- int rc = 0;
- int i;
- int j;
+ int rc = 0;
+ int i;
+ int j;
/* We require 2 threads min, see note in ptlrpc_server_handle_request */
LASSERT(svc->srv_nthrs_cpt_init >= PTLRPC_NTHRS_INIT);
/* We require 2 threads min, see note in ptlrpc_server_handle_request */
LASSERT(svc->srv_nthrs_cpt_init >= PTLRPC_NTHRS_INIT);
int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait)
{
int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait)
{
- struct l_wait_info lwi = { 0 };
- struct ptlrpc_thread *thread;
- struct ptlrpc_service *svc;
- int rc;
+ struct l_wait_info lwi = { 0 };
+ struct ptlrpc_thread *thread;
+ struct ptlrpc_service *svc;
+ int rc;
int ptlrpc_hr_init(void)
{
int ptlrpc_hr_init(void)
{
- struct ptlrpc_hr_partition *hrp;
- struct ptlrpc_hr_thread *hrt;
- int rc;
- int i;
- int j;
- int weight;
+ struct ptlrpc_hr_partition *hrp;
+ struct ptlrpc_hr_thread *hrt;
+ int rc;
+ int i;
+ int j;
+ int weight;
memset(&ptlrpc_hr, 0, sizeof(ptlrpc_hr));
ptlrpc_hr.hr_cpt_table = cfs_cpt_table;
memset(&ptlrpc_hr, 0, sizeof(ptlrpc_hr));
ptlrpc_hr.hr_cpt_table = cfs_cpt_table;
void ptlrpc_hr_fini(void)
{
void ptlrpc_hr_fini(void)
{
- struct ptlrpc_hr_partition *hrp;
- int i;
+ struct ptlrpc_hr_partition *hrp;
+ int i;
if (ptlrpc_hr.hr_partitions == NULL)
return;
if (ptlrpc_hr.hr_partitions == NULL)
return;
static void
ptlrpc_service_del_atimer(struct ptlrpc_service *svc)
{
static void
ptlrpc_service_del_atimer(struct ptlrpc_service *svc)
{
- struct ptlrpc_service_part *svcpt;
- int i;
+ struct ptlrpc_service_part *svcpt;
+ int i;
/* early disarm AT timer... */
ptlrpc_service_for_each_part(svcpt, i, svc) {
/* early disarm AT timer... */
ptlrpc_service_for_each_part(svcpt, i, svc) {
static void
ptlrpc_service_unlink_rqbd(struct ptlrpc_service *svc)
{
static void
ptlrpc_service_unlink_rqbd(struct ptlrpc_service *svc)
{
- struct ptlrpc_service_part *svcpt;
+ struct ptlrpc_service_part *svcpt;
struct ptlrpc_request_buffer_desc *rqbd;
struct ptlrpc_request_buffer_desc *rqbd;
- struct l_wait_info lwi;
- int rc;
- int i;
+ struct l_wait_info lwi;
+ int rc;
+ int i;
/* All history will be culled when the next request buffer is
* freed in ptlrpc_service_purge_all() */
/* All history will be culled when the next request buffer is
* freed in ptlrpc_service_purge_all() */
static void
ptlrpc_service_purge_all(struct ptlrpc_service *svc)
{
static void
ptlrpc_service_purge_all(struct ptlrpc_service *svc)
{
- struct ptlrpc_service_part *svcpt;
- struct ptlrpc_request_buffer_desc *rqbd;
- struct ptlrpc_request *req;
- struct ptlrpc_reply_state *rs;
- int i;
+ struct ptlrpc_service_part *svcpt;
+ struct ptlrpc_request_buffer_desc *rqbd;
+ struct ptlrpc_request *req;
+ struct ptlrpc_reply_state *rs;
+ int i;
ptlrpc_service_for_each_part(svcpt, i, svc) {
if (svcpt->scp_service == NULL)
ptlrpc_service_for_each_part(svcpt, i, svc) {
if (svcpt->scp_service == NULL)
static void
ptlrpc_service_free(struct ptlrpc_service *svc)
{
static void
ptlrpc_service_free(struct ptlrpc_service *svc)
{
- struct ptlrpc_service_part *svcpt;
- struct ptlrpc_at_array *array;
- int i;
+ struct ptlrpc_service_part *svcpt;
+ struct ptlrpc_at_array *array;
+ int i;
ptlrpc_service_for_each_part(svcpt, i, svc) {
if (svcpt->scp_service == NULL)
ptlrpc_service_for_each_part(svcpt, i, svc) {
if (svcpt->scp_service == NULL)
* to be shot, so it's intentionally non-aggressive. */
int ptlrpc_svcpt_health_check(struct ptlrpc_service_part *svcpt)
{
* to be shot, so it's intentionally non-aggressive. */
int ptlrpc_svcpt_health_check(struct ptlrpc_service_part *svcpt)
{
- struct ptlrpc_request *request = NULL;
- struct timeval right_now;
- long timediff;
+ struct ptlrpc_request *request = NULL;
+ struct timeval right_now;
+ long timediff;
do_gettimeofday(&right_now);
do_gettimeofday(&right_now);
int
ptlrpc_service_health_check(struct ptlrpc_service *svc)
{
int
ptlrpc_service_health_check(struct ptlrpc_service *svc)
{
- struct ptlrpc_service_part *svcpt;
- int i;
+ struct ptlrpc_service_part *svcpt;
+ int i;
if (svc == NULL)
return 0;
if (svc == NULL)
return 0;