req->r_reply = 0;
req->r_last_inode = 0;
req->r_last_dentry = 0;
- req->r_expects_cap = false;
+ req->r_expects_cap = 0;
req->r_cap = 0;
req->r_session = 0;
req->r_num_mds = 0;
schedule_delayed_work(&mdsc->delayed_work, hz);
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
void delayed_work(struct work_struct *work)
+#else
+void delayed_work(void *arg)
+#endif
{
int i;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
struct ceph_mds_client *mdsc = container_of(work, struct ceph_mds_client, delayed_work.work);
+#else
+ struct ceph_mds_client *mdsc = arg;
+#endif
dout(10, "delayed_work on %p\n", mdsc);
mdsc->last_requested_map = 0;
init_completion(&mdsc->map_waiters);
init_completion(&mdsc->session_close_waiters);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
INIT_DELAYED_WORK(&mdsc->delayed_work, delayed_work);
+#else
+ INIT_WORK(&mdsc->delayed_work, delayed_work, mdsc);
+#endif
}
void ceph_mdsc_stop(struct ceph_mds_client *mdsc)
spin_lock(&mdsc->lock);
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
cancel_delayed_work_sync(&mdsc->delayed_work); /* cancel timer */
+#else
+ cancel_delayed_work(&mdsc->delayed_work); /* cancel timer */
+ flush_scheduled_work();
+#endif
spin_unlock(&mdsc->lock);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
static void try_read(struct work_struct *);
+static void try_write(struct work_struct *);
+static void try_accept(struct work_struct *);
#else
static void try_read(void *);
+static void try_write(void *);
+static void try_accept(void *);
#endif
-static void try_write(struct work_struct *);
-static void try_accept(struct work_struct *);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
INIT_WORK(&con->rwork, try_read);
+ INIT_DELAYED_WORK(&con->swork, try_write);
#else
INIT_WORK(&con->rwork, try_read, con);
+ INIT_WORK(&con->swork, try_write, con);
#endif
- INIT_DELAYED_WORK(&con->swork, try_write);
return con;
}
radix_tree_delete(&msgr->con_open, key);
} else {
slot = radix_tree_lookup_slot(&msgr->con_open, key);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
val = radix_tree_deref_slot(slot);
+#else
+ val = *slot;
+#endif
dout(20, "__remove_connection %p from bucket %lu head %p\n", con, key, val);
if (val == &con->list_bucket) {
dout(20, "__remove_connection adjusting bucket ptr"
" for %lu to next item, %p\n", key,
con->list_bucket.next);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
radix_tree_replace_slot(slot, con->list_bucket.next);
+#else
+ *slot = con->list_bucket.next;
+#endif
}
list_del(&con->list_bucket);
}
{
dout(40, "ceph_queue_write %p\n", con);
atomic_inc(&con->nref);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
if (!queue_work(send_wq, &con->swork.work)) {
+#else
+ if (!queue_work(send_wq, &con->swork)) {
+#endif
dout(40, "ceph_queue_write %p - already queued\n", con);
put_connection(con);
}
/*
* worker function when socket is writeable
*/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
static void try_write(struct work_struct *work)
+#else
+static void try_write(void *arg)
+#endif
{
struct ceph_connection *con =
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
container_of(work, struct ceph_connection, swork.work);
+#else
+ arg;
+#endif
struct ceph_messenger *msgr = con->msgr;
int ret = 1;
/*
* worker function when listener receives a connect
*/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
static void try_accept(struct work_struct *work)
+#else
+static void try_accept(void *arg)
+#endif
{
- struct ceph_connection *new_con = NULL;
+ struct ceph_connection *new_con = NULL;
struct ceph_messenger *msgr;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
msgr = container_of(work, struct ceph_messenger, awork);
+#else
+ msgr = arg;
+#endif
dout(5, "Entered try_accept\n");
msgr = kzalloc(sizeof(*msgr), GFP_KERNEL);
if (msgr == NULL)
return ERR_PTR(-ENOMEM);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
INIT_WORK(&msgr->awork, try_accept);
+#else
+ INIT_WORK(&msgr->awork, try_accept, msgr);
+#endif
spin_lock_init(&msgr->con_lock);
INIT_LIST_HEAD(&msgr->con_all);
INIT_LIST_HEAD(&msgr->con_accepting);
break;
default:
BUG_ON(1);
+
+ return; /* remove compilation warning */
}
nr_osds = crush_do_rule(osdc->osdmap->crush, rule,
req->r_pgid.pg.ps, osds, 10,
calc_file_object_mapping(layout, &off, &len, &reqhead->oid,
&reqhead->offset, &reqhead->length);
BUG_ON(len != 0);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
nr_pages = DIV_ROUND_UP(reqhead->length, PAGE_SIZE);
+#else
+ nr_pages = (reqhead->length + PAGE_SIZE - 1) / PAGE_SIZE;
+#endif
calc_object_layout(&reqhead->layout, &reqhead->oid, layout, osdc->osdmap);
dout(10, "readpage object block %u %llu~%llu\n", reqhead->oid.bno, reqhead->offset, reqhead->length);