return ERR_PTR(PTR_ERR(path));
req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_OPEN, pathbase, path,
0, 0);
- req->r_expects_cap = true;
+ req->r_expects_cap = 1;
kfree(path);
if (!IS_ERR(req)) {
rhead = req->r_request->front.iov_base;
ssize_t ceph_silly_write(struct file *file, const char __user *data,
size_t count, loff_t *offset)
{
- struct inode *inode = file->f_path.dentry->d_inode;
+ struct inode *inode = file->f_dentry->d_inode;
struct ceph_inode_info *ci = ceph_inode(inode);
struct ceph_osd_client *osdc = &ceph_inode_to_client(inode)->osdc;
int ret = 0;
derr(0, "sock_create_kern error: %d\n", ret);
return ret;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
ret = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
+#else
+ ret = sock_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
+#endif
(char *)&optval, sizeof(optval));
if (ret < 0) {
derr(0, "Failed to set SO_REUSEADDR: %d\n", ret);
}
dout(10, "listen on port %d\n", ntohs(myaddr->sin_port));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
ret = kernel_setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
+#else
+ ret = sock_setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
+#endif
(char *)&optval, sizeof(optval));
if (ret < 0) {
derr(0, "Failed to set SO_KEEPALIVE: %d\n", ret);
struct ceph_mds_reply_info r_reply_info;
struct inode * r_last_inode;
struct dentry * r_last_dentry;
- bool r_expects_cap;
+ int r_expects_cap;
struct ceph_inode_cap * r_cap;
struct ceph_mds_session * r_session;
struct ceph_mds_session * r_mds[2];
struct radix_tree_root request_tree; /* pending mds requests */
__u64 last_requested_map;
struct completion map_waiters, session_close_waiters;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
struct delayed_work delayed_work; /* delayed work */
+#else
+ struct work_struct delayed_work; /* delayed work */
+#endif
};
extern const char* ceph_mds_op_name(int op);
static char tag_ack = CEPH_MSGR_TAG_ACK;
//static char tag_close = CEPH_MSGR_TAG_CLOSE;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
static void try_read(struct work_struct *);
+#else
+static void try_read(void *);
+#endif
static void try_write(struct work_struct *);
static void try_accept(struct work_struct *);
INIT_LIST_HEAD(&con->out_queue);
INIT_LIST_HEAD(&con->out_sent);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
INIT_WORK(&con->rwork, try_read);
+#else
+ INIT_WORK(&con->rwork, try_read, con);
+#endif
INIT_DELAYED_WORK(&con->swork, try_write);
return con;
/*
* worker function when data is available on the socket
*/
-void try_read(struct work_struct *work)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
+static void try_read(struct work_struct *work)
+#else
+static void try_read(void *arg)
+#endif
{
int ret = -1;
struct ceph_connection *con;
struct ceph_messenger *msgr;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
con = container_of(work, struct ceph_connection, rwork);
+#else
+ con = arg;
+#endif
dout(20, "try_read start on %p\n", con);
msgr = con->msgr;
#include <linux/radix-tree.h>
#include <linux/workqueue.h>
#include <linux/ceph_fs.h>
+#include <linux/version.h>
struct ceph_msg;
struct ceph_msg_pos in_msg_pos;
struct work_struct rwork; /* receive work */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
struct delayed_work swork; /* send work */
+#else
+ struct work_struct swork; /* send work */
+#endif
unsigned long delay; /* delay interval */
unsigned int retries; /* temp track of retries */
};
} *pg_swap_primary;
};
-static inline bool ceph_osd_is_up(struct ceph_osdmap *map, int osd)
+static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd)
{
return (osd < map->max_osd) && (map->osd_state[osd] & CEPH_OSD_UP);
}
static int init_inodecache(void)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
ceph_inode_cachep = kmem_cache_create("ceph_inode_cache",
sizeof(struct ceph_inode_info),
0, (SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD),
init_once);
+#else
+ ceph_inode_cachep = kmem_cache_create("ceph_inode_cache",
+ sizeof(struct ceph_inode_info),
+ 0, (SLAB_RECLAIM_ACCOUNT|
+ SLAB_MEM_SPREAD),
+ init_once,
+ NULL);
+#endif
if (ceph_inode_cachep == NULL)
return -ENOMEM;
return 0;
if ((flags & O_ACCMODE) == O_RDONLY)
return FILE_MODE_RDONLY;
BUG_ON(1);
+
+ return 0; /* remove compilation warning */
}
static inline struct ceph_client *ceph_inode_to_client(struct inode *inode)