* (C) Copyright 2012 Commissariat a l'energie atomique et aux energies
* alternatives
*
+ * Copyright (c) 2014, Intel Corporation.
*/
/*
* lustre/mdt/mdt_hsm_cdt_requests.c
int rc, osz, nsz;
struct interval_node **new_vv;
struct interval_node *v, *node;
+ __u64 end;
ENTRY;
+ end = extent->offset + extent->length;
+ if (end <= extent->offset)
+ RETURN(-EINVAL);
+
mutex_lock(&crp->crp_lock);
/* new node index */
v = crp->crp_node[crp->crp_cnt / NODE_VECTOR_SZ];
node = &v[crp->crp_cnt % NODE_VECTOR_SZ];
- interval_set(node, extent->offset, extent->offset + extent->length);
+ interval_set(node, extent->offset, end);
/* try to insert, if entry already exist ignore the new one
* it can happen if ct sends 2 times the same progress */
if (interval_insert(node, &crp->crp_root) == NULL)
rc = 0;
out:
mutex_unlock(&crp->crp_lock);
- return rc;
+ RETURN(rc);
}
/**
crp->crp_max = 0;
}
-/** Allocate/init a agent request and its sub-structures.
+/** Allocate/init an agent request and its sub-structures.
*
* \param compound_id [IN]
* \param archive_id [IN]
}
/**
- * Free a agent request and its sub-structures.
+ * Free an agent request and its sub-structures.
*
* \param car [IN] Request to be freed.
*/
/**
* seq_file method called to start access to /proc file
*/
-static void *mdt_hsm_request_proc_start(struct seq_file *s, loff_t *p)
+static void *mdt_hsm_active_requests_proc_start(struct seq_file *s, loff_t *p)
{
struct mdt_device *mdt = s->private;
struct coordinator *cdt = &mdt->mdt_coordinator;
* seq_file method called to get next item
* just returns NULL at eof
*/
-static void *mdt_hsm_request_proc_next(struct seq_file *s, void *v, loff_t *p)
+static void *mdt_hsm_active_requests_proc_next(struct seq_file *s, void *v,
+ loff_t *p)
{
struct mdt_device *mdt = s->private;
struct coordinator *cdt = &mdt->mdt_coordinator;
/**
* display request data
*/
-static int mdt_hsm_request_proc_show(struct seq_file *s, void *v)
+static int mdt_hsm_active_requests_proc_show(struct seq_file *s, void *v)
{
struct list_head *pos = v;
struct cdt_agent_req *car;
" compound/cookie="LPX64"/"LPX64
" action=%s archive#=%d flags="LPX64
" extent="LPX64"-"LPX64" gid="LPX64
- " data=[%s] canceled=%d uuid=%s done="LPU64"%%\n",
+ " data=[%s] canceled=%d uuid=%s done="LPU64"\n",
PFID(&car->car_hai->hai_fid),
PFID(&car->car_hai->hai_dfid),
car->car_compound_id, car->car_hai->hai_cookie,
/**
* seq_file method called to stop access to /proc file
*/
-static void mdt_hsm_request_proc_stop(struct seq_file *s, void *v)
+static void mdt_hsm_active_requests_proc_stop(struct seq_file *s, void *v)
{
struct mdt_device *mdt = s->private;
struct coordinator *cdt = &mdt->mdt_coordinator;
}
/* hsm agent list proc functions */
-static const struct seq_operations mdt_hsm_request_proc_ops = {
- .start = mdt_hsm_request_proc_start,
- .next = mdt_hsm_request_proc_next,
- .show = mdt_hsm_request_proc_show,
- .stop = mdt_hsm_request_proc_stop,
+static const struct seq_operations mdt_hsm_active_requests_proc_ops = {
+ .start = mdt_hsm_active_requests_proc_start,
+ .next = mdt_hsm_active_requests_proc_next,
+ .show = mdt_hsm_active_requests_proc_show,
+ .stop = mdt_hsm_active_requests_proc_stop,
};
/**
* public function called at open of /proc file to get
* list of agents
*/
-static int lprocfs_open_hsm_request(struct inode *inode, struct file *file)
+static int lprocfs_open_hsm_active_requests(struct inode *inode,
+ struct file *file)
{
struct seq_file *s;
int rc;
ENTRY;
- if (LPROCFS_ENTRY_CHECK(PDE(inode)))
- RETURN(-ENOENT);
-
- rc = seq_open(file, &mdt_hsm_request_proc_ops);
+ rc = seq_open(file, &mdt_hsm_active_requests_proc_ops);
if (rc) {
RETURN(rc);
}
s = file->private_data;
- s->private = PDE(inode)->data;
+ s->private = PDE_DATA(inode);
RETURN(rc);
}
/* methods to access hsm request list */
-const struct file_operations mdt_hsm_request_fops = {
+const struct file_operations mdt_hsm_active_requests_fops = {
.owner = THIS_MODULE,
- .open = lprocfs_open_hsm_request,
+ .open = lprocfs_open_hsm_active_requests,
.read = seq_read,
.llseek = seq_lseek,
.release = lprocfs_seq_release,