* Author: Liang Zhen <liang@whamcloud.com>
* Author: Nikitas Angelinas <nikitas_angelinas@xyratex.com>
*/
-#ifdef HAVE_SERVER_SUPPORT
/**
* \addtogoup nrs
* \retval 1 e1 < e2
*/
static int
-orr_req_compare(struct cfs_binheap_node *e1, struct cfs_binheap_node *e2)
+orr_req_compare(struct binheap_node *e1, struct binheap_node *e2)
{
struct ptlrpc_nrs_request *nrq1;
struct ptlrpc_nrs_request *nrq2;
/**
* ORR binary heap operations
*/
-static struct cfs_binheap_ops nrs_orr_heap_ops = {
+static struct binheap_ops nrs_orr_heap_ops = {
.hop_enter = NULL,
.hop_exit = NULL,
.hop_compare = orr_req_compare,
/*
* Binary heap instance for sorted incoming requests.
*/
- orrd->od_binheap = cfs_binheap_create(&nrs_orr_heap_ops,
+ orrd->od_binheap = binheap_create(&nrs_orr_heap_ops,
CBH_FLAG_ATOMIC_GROW, 4096, NULL,
nrs_pol2cptab(policy),
nrs_pol2cptid(policy));
out_cache:
kmem_cache_destroy(orrd->od_cache);
out_binheap:
- cfs_binheap_destroy(orrd->od_binheap);
+ binheap_destroy(orrd->od_binheap);
out_orrd:
OBD_FREE_PTR(orrd);
LASSERT(orrd->od_binheap != NULL);
LASSERT(orrd->od_obj_hash != NULL);
LASSERT(orrd->od_cache != NULL);
- LASSERT(cfs_binheap_is_empty(orrd->od_binheap));
+ LASSERT(binheap_is_empty(orrd->od_binheap));
- cfs_binheap_destroy(orrd->od_binheap);
+ binheap_destroy(orrd->od_binheap);
cfs_hash_putref(orrd->od_obj_hash);
kmem_cache_destroy(orrd->od_cache);
bool peek, bool force)
{
struct nrs_orr_data *orrd = policy->pol_private;
- struct cfs_binheap_node *node = cfs_binheap_root(orrd->od_binheap);
+ struct binheap_node *node = binheap_root(orrd->od_binheap);
struct ptlrpc_nrs_request *nrq;
nrq = unlikely(node == NULL) ? NULL :
LASSERT(nrq->nr_u.orr.or_round <= orro->oo_round);
- cfs_binheap_remove(orrd->od_binheap, &nrq->nr_node);
+ binheap_remove(orrd->od_binheap, &nrq->nr_node);
orro->oo_active--;
if (strncmp(policy->pol_desc->pd_name, NRS_POL_NAME_ORR,
nrq->nr_u.orr.or_round);
/** Peek at the next request to be served */
- node = cfs_binheap_root(orrd->od_binheap);
+ node = binheap_root(orrd->od_binheap);
/** No more requests */
if (unlikely(node == NULL)) {
nrq->nr_u.orr.or_round = orro->oo_round;
nrq->nr_u.orr.or_sequence = orro->oo_sequence;
- rc = cfs_binheap_insert(orrd->od_binheap, &nrq->nr_node);
+ rc = binheap_insert(orrd->od_binheap, &nrq->nr_node);
if (rc == 0) {
orro->oo_active++;
if (--orro->oo_quantum == 0)
LASSERT(nrq->nr_u.orr.or_round <= orro->oo_round);
- is_root = &nrq->nr_node == cfs_binheap_root(orrd->od_binheap);
+ is_root = &nrq->nr_node == binheap_root(orrd->od_binheap);
- cfs_binheap_remove(orrd->od_binheap, &nrq->nr_node);
+ binheap_remove(orrd->od_binheap, &nrq->nr_node);
orro->oo_active--;
/**
*/
if (unlikely(is_root)) {
/** Peek at the next request to be served */
- struct cfs_binheap_node *node = cfs_binheap_root(orrd->od_binheap);
+ struct binheap_node *node = binheap_root(orrd->od_binheap);
/** No more requests */
if (unlikely(node == NULL)) {
}
/**
- * lprocfs interface
+ * debugfs interface
*/
-#ifdef CONFIG_PROC_FS
-
/**
* This allows to bundle the policy name into the lprocfs_vars::data pointer
* so that lprocfs read/write functions can be used by both the ORR and TRR
val = lprocfs_find_named_value(kernbuf, NRS_LPROCFS_QUANTUM_NAME_REG,
&count_copy);
if (val != kernbuf) {
- quantum_reg = simple_strtol(val, NULL, 10);
-
+ rc = kstrtol(val, 10, &quantum_reg);
+ if (rc)
+ return rc;
queue |= PTLRPC_NRS_QUEUE_REG;
}
if (!nrs_svc_has_hp(svc))
return -ENODEV;
- quantum_hp = simple_strtol(val, NULL, 10);
+ rc = kstrtol(val, 10, &quantum_hp);
+ if (rc)
+ return rc;
queue |= PTLRPC_NRS_QUEUE_HP;
}
* value
*/
if (queue == 0) {
- if (!isdigit(kernbuf[0]))
- return -EINVAL;
-
- quantum_reg = simple_strtol(kernbuf, NULL, 10);
+ rc = kstrtol(kernbuf, 10, &quantum_reg);
+ if (rc)
+ return rc;
queue = PTLRPC_NRS_QUEUE_REG;
return rc == -ENODEV && rc2 == -ENODEV ? -ENODEV : count;
}
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_quantum);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_quantum);
#define LPROCFS_NRS_OFF_NAME_REG "reg_offset_type:"
#define LPROCFS_NRS_OFF_NAME_HP "hp_offset_type:"
return rc == -ENODEV && rc2 == -ENODEV ? -ENODEV : count;
}
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_offset_type);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_offset_type);
#define NRS_LPROCFS_REQ_SUPP_NAME_REG "reg_supported:"
#define NRS_LPROCFS_REQ_SUPP_NAME_HP "hp_supported:"
return rc == -ENODEV && rc2 == -ENODEV ? -ENODEV : count;
}
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_supported);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_supported);
static int nrs_orr_lprocfs_init(struct ptlrpc_service *svc)
{
int i;
- struct lprocfs_vars nrs_orr_lprocfs_vars[] = {
+ struct ldebugfs_vars nrs_orr_lprocfs_vars[] = {
{ .name = "nrs_orr_quantum",
.fops = &ptlrpc_lprocfs_nrs_orr_quantum_fops },
{ .name = "nrs_orr_offset_type",
{ NULL }
};
- if (svc->srv_procroot == NULL)
+ if (!svc->srv_debugfs_entry)
return 0;
lprocfs_orr_data.svc = svc;
for (i = 0; i < ARRAY_SIZE(nrs_orr_lprocfs_vars); i++)
nrs_orr_lprocfs_vars[i].data = &lprocfs_orr_data;
- return lprocfs_add_vars(svc->srv_procroot, nrs_orr_lprocfs_vars, NULL);
-}
+ ldebugfs_add_vars(svc->srv_debugfs_entry, nrs_orr_lprocfs_vars, NULL);
-static void nrs_orr_lprocfs_fini(struct ptlrpc_service *svc)
-{
- if (svc->srv_procroot == NULL)
- return;
-
- lprocfs_remove_proc_entry("nrs_orr_quantum", svc->srv_procroot);
- lprocfs_remove_proc_entry("nrs_orr_offset_type", svc->srv_procroot);
- lprocfs_remove_proc_entry("nrs_orr_supported", svc->srv_procroot);
+ return 0;
}
-#endif /* CONFIG_PROC_FS */
-
static const struct ptlrpc_nrs_pol_ops nrs_orr_ops = {
.op_policy_init = nrs_orr_init,
.op_policy_start = nrs_orr_start,
.op_req_enqueue = nrs_orr_req_add,
.op_req_dequeue = nrs_orr_req_del,
.op_req_stop = nrs_orr_req_stop,
-#ifdef CONFIG_PROC_FS
.op_lprocfs_init = nrs_orr_lprocfs_init,
- .op_lprocfs_fini = nrs_orr_lprocfs_fini,
-#endif
};
struct ptlrpc_nrs_pol_conf nrs_conf_orr = {
*
* TRR reuses much of the functions and data structures of ORR
*/
-
-#ifdef CONFIG_PROC_FS
-
static int nrs_trr_lprocfs_init(struct ptlrpc_service *svc)
{
int i;
- struct lprocfs_vars nrs_trr_lprocfs_vars[] = {
+ struct ldebugfs_vars nrs_trr_lprocfs_vars[] = {
{ .name = "nrs_trr_quantum",
.fops = &ptlrpc_lprocfs_nrs_orr_quantum_fops },
{ .name = "nrs_trr_offset_type",
{ NULL }
};
- if (svc->srv_procroot == NULL)
+ if (!svc->srv_debugfs_entry)
return 0;
lprocfs_trr_data.svc = svc;
for (i = 0; i < ARRAY_SIZE(nrs_trr_lprocfs_vars); i++)
nrs_trr_lprocfs_vars[i].data = &lprocfs_trr_data;
- return lprocfs_add_vars(svc->srv_procroot, nrs_trr_lprocfs_vars, NULL);
-}
-
-static void nrs_trr_lprocfs_fini(struct ptlrpc_service *svc)
-{
- if (svc->srv_procroot == NULL)
- return;
+ ldebugfs_add_vars(svc->srv_debugfs_entry, nrs_trr_lprocfs_vars, NULL);
- lprocfs_remove_proc_entry("nrs_trr_quantum", svc->srv_procroot);
- lprocfs_remove_proc_entry("nrs_trr_offset_type", svc->srv_procroot);
- lprocfs_remove_proc_entry("nrs_trr_supported", svc->srv_procroot);
+ return 0;
}
-#endif /* CONFIG_PROC_FS */
-
/**
* Reuse much of the ORR functionality for TRR.
*/
.op_req_enqueue = nrs_orr_req_add,
.op_req_dequeue = nrs_orr_req_del,
.op_req_stop = nrs_orr_req_stop,
-#ifdef CONFIG_PROC_FS
.op_lprocfs_init = nrs_trr_lprocfs_init,
- .op_lprocfs_fini = nrs_trr_lprocfs_fini,
-#endif
};
struct ptlrpc_nrs_pol_conf nrs_conf_trr = {
/** @} ORR/TRR policy */
/** @} nrs */
-
-#endif /* HAVE_SERVER_SUPPORT */