]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: last bit of mon_client cleanup
authorSage Weil <sage@newdream.net>
Mon, 20 Oct 2008 16:54:23 +0000 (09:54 -0700)
committerSage Weil <sage@newdream.net>
Mon, 20 Oct 2008 16:54:23 +0000 (09:54 -0700)
src/kernel/mon_client.c
src/kernel/mon_client.h
src/mon/MonMap.h

index 543a66ad8074944ae2e20a4a5dd57c87cd710dae..41d375b374cccdcb331c927daab3ef50636d94ae 100644 (file)
@@ -23,15 +23,15 @@ struct ceph_monmap *ceph_monmap_decode(void *p, void *end)
 
        dout(30, "monmap_decode %p %p len %d\n", p, end, (int)(end-p));
 
-       /* the encoded and decoded sizes match. */
+       /* The encoded and decoded sizes match. */
        m = kmalloc(end-p, GFP_NOFS);
        if (m == NULL)
                return ERR_PTR(-ENOMEM);
 
        ceph_decode_need(&p, end, 2*sizeof(__u32) + 2*sizeof(__u64), bad);
-       ceph_decode_32(&p, m->epoch);
        ceph_decode_64_le(&p, m->fsid.major);
        ceph_decode_64_le(&p, m->fsid.minor);
+       ceph_decode_32(&p, m->epoch);
        ceph_decode_32(&p, m->num_mon);
        ceph_decode_need(&p, end, m->num_mon*sizeof(m->mon_inst[0]), bad);
        ceph_decode_copy(&p, m->mon_inst, m->num_mon*sizeof(m->mon_inst[0]));
@@ -240,6 +240,7 @@ void ceph_monc_request_umount(struct ceph_mon_client *monc)
        /* don't bother if forced unmount */
        if (client->mount_state == CEPH_MOUNT_SHUTDOWN)
                return;
+
        mutex_lock(&monc->req_mutex);
        monc->umount_delay = BASE_DELAY_INTERVAL;
        do_request_umount(&monc->umount_delayed_work.work);
@@ -362,12 +363,13 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
        if (monc->monmap == NULL)
                return -ENOMEM;
        spin_lock_init(&monc->statfs_lock);
-       mutex_init(&monc->req_mutex);
        INIT_RADIX_TREE(&monc->statfs_request_tree, GFP_ATOMIC);
+       monc->last_tid = 0;
        INIT_DELAYED_WORK(&monc->mds_delayed_work, do_request_mdsmap);
        INIT_DELAYED_WORK(&monc->osd_delayed_work, do_request_osdmap);
        INIT_DELAYED_WORK(&monc->umount_delayed_work, do_request_umount);
-       monc->last_tid = 0;
+       monc->mds_delay = monc->osd_delay = monc->umount_delay = 0;
+       mutex_init(&monc->req_mutex);
        monc->want_mdsmap = 0;
        monc->want_osdmap = 0;
        return 0;
index 2cbca984d2c0e1cd88b8abdb536514d8b794ecfe..d3b6d36aabf7514ba0c1179f5deb376b210733e9 100644 (file)
@@ -75,6 +75,11 @@ extern int ceph_monmap_contains(struct ceph_monmap *m,
 extern int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl);
 extern void ceph_monc_stop(struct ceph_mon_client *monc);
 
+/*
+ * The model here is to indicate that we need a new map of at least epoch
+ * @want, and to indicate which maps receive.  Periodically rerequest the map
+ * from the monitor cluster until we get what we want.
+ */
 extern void ceph_monc_request_mdsmap(struct ceph_mon_client *monc, __u32 want);
 extern int ceph_monc_got_mdsmap(struct ceph_mon_client *monc, __u32 have);
 
@@ -82,8 +87,6 @@ extern void ceph_monc_request_osdmap(struct ceph_mon_client *monc, __u32 want);
 extern int ceph_monc_got_osdmap(struct ceph_mon_client *monc, __u32 have);
 
 extern void ceph_monc_request_umount(struct ceph_mon_client *monc);
-extern void ceph_monc_report_failure(struct ceph_mon_client *monc,
-                                    struct ceph_entity_inst *who);
 
 extern int ceph_monc_do_statfs(struct ceph_mon_client *monc,
                               struct ceph_statfs *buf);
index d5b4f43a45caecd2c02c33590d0fbd9ed7c30841..57c2f23147fed69f045300ca8191fded615f4848 100644 (file)
@@ -42,16 +42,6 @@ class MonMap {
     mon_inst.push_back(inst);
   }
 
-  /*
-  int add(const char *a) {
-    entity_addr_t addr;
-    if (!parse_ip_port(a, addr))
-      return -EINVAL;
-    if (contains(addr))
-      return -EEXIST;
-    add(addr);
-  }
-  */
   void add(entity_addr_t a) {
     entity_inst_t i;
     i.addr = a;
@@ -91,8 +81,8 @@ class MonMap {
   }
 
   void encode(bufferlist& blist) {
-    ::encode(epoch, blist);
     ::encode_raw(fsid, blist);
+    ::encode(epoch, blist);
     ::encode(mon_inst, blist);
   }  
   void decode(bufferlist& blist) {
@@ -100,8 +90,8 @@ class MonMap {
     decode(p);
   }
   void decode(bufferlist::iterator &p) {
-    ::decode(epoch, p);
     ::decode_raw(fsid, p);
+    ::decode(epoch, p);
     ::decode(mon_inst, p);
   }