]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
partially compiles on older kernels
authorYehuda Sadeh-Weinraub <yehuda@yehuda.infit.com>
Sun, 9 Mar 2008 13:47:46 +0000 (15:47 +0200)
committerYehuda Sadeh-Weinraub <yehuda@yehuda.infit.com>
Sun, 9 Mar 2008 13:47:46 +0000 (15:47 +0200)
src/kernel/file.c
src/kernel/ktcp.c
src/kernel/mds_client.h
src/kernel/messenger.c
src/kernel/messenger.h
src/kernel/osdmap.h
src/kernel/super.c
src/kernel/super.h

index e3081e0486c963fdc783c91c407c35b2066e6e43..631ebd0a0adeec3a85b1a8566414dbf87fcf7cac 100644 (file)
@@ -32,7 +32,7 @@ prepare_open_request(struct super_block *sb, struct dentry *dentry,
                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;
@@ -290,7 +290,7 @@ out:
 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;
index db45a55772f18322062b61e12d907f557ca2456c..56c5dd22c50d7fa0b21f20285ab1f5e97603912e 100644 (file)
@@ -152,7 +152,11 @@ int ceph_tcp_listen(struct ceph_messenger *msgr)
                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);
@@ -177,7 +181,11 @@ int ceph_tcp_listen(struct ceph_messenger *msgr)
        }
        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);
index bb84e61707862a15924b7fbe1ae91b1850d0cdb5..6a63abebf5c1b367993f80db615a3c5ed88a2493 100644 (file)
@@ -68,7 +68,7 @@ struct ceph_mds_request {
        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];
@@ -97,7 +97,11 @@ struct ceph_mds_client {
        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);
index ddf5807a993720a2c4c3eadf062d6a2fabad5e32..5f2f3dce8869d142350ec64054047e0d4bff4e42 100644 (file)
@@ -20,7 +20,11 @@ static char tag_msg = CEPH_MSGR_TAG_MSG;
 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 *);
 
@@ -52,7 +56,11 @@ static struct ceph_connection *new_connection(struct ceph_messenger *msgr)
        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;
@@ -890,13 +898,21 @@ static void process_accept(struct ceph_connection *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;
 
index ae89394a03ae77e77e5805c05a1293f0fc5b9a89..6f870713af00700c116c50ccff1e2c0cf2a29729 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/radix-tree.h>
 #include <linux/workqueue.h>
 #include <linux/ceph_fs.h>
+#include <linux/version.h>
 
 struct ceph_msg;
 
@@ -111,7 +112,11 @@ struct ceph_connection {
        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 */
 };
index a05ec339aa4afe402686736f63008d60ea51e319..54d801cd84210a688247a02c7eb3479ea7c72aa0 100644 (file)
@@ -27,7 +27,7 @@ struct ceph_osdmap {
        } *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);
 }
index 90439ce9ed172b55f2aba277b4e7c55197be2e69..e02683561ad8742e89b45228628ff3e68b695381 100644 (file)
@@ -159,11 +159,20 @@ static void init_once(struct kmem_cache *cachep, void *foo)
 
 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;
index bf269e0093b6f9b06318875b3a809b7614cf7587..3bc997b6bbbd6491b746776057926093f71f7493 100644 (file)
@@ -237,6 +237,8 @@ static inline int ceph_file_mode(int flags)
        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)