aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/mdsmap.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-10-14 12:59:09 -0400
committerSage Weil <sage@newdream.net>2009-10-14 12:59:09 -0400
commitc89136ea4253c73e89e97f5138bb22d97ad9f564 (patch)
treeba8080adfaa6f5b84eadd4d65eff70840f9dfe22 /fs/ceph/mdsmap.c
parent535bbb530764b1b2b3b732837f0e61e1baae7109 (diff)
ceph: convert encode/decode macros to inlines
This avoids the fugly pass by reference and makes the code a bit easier to read. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/mdsmap.c')
-rw-r--r--fs/ceph/mdsmap.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c
index 09180d8fafe4..80daea064470 100644
--- a/fs/ceph/mdsmap.c
+++ b/fs/ceph/mdsmap.c
@@ -60,21 +60,21 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
60 ceph_decode_16_safe(p, end, version, bad); 60 ceph_decode_16_safe(p, end, version, bad);
61 61
62 ceph_decode_need(p, end, 8*sizeof(u32) + sizeof(u64), bad); 62 ceph_decode_need(p, end, 8*sizeof(u32) + sizeof(u64), bad);
63 ceph_decode_32(p, m->m_epoch); 63 m->m_epoch = ceph_decode_32(p);
64 ceph_decode_32(p, m->m_client_epoch); 64 m->m_client_epoch = ceph_decode_32(p);
65 ceph_decode_32(p, m->m_last_failure); 65 m->m_last_failure = ceph_decode_32(p);
66 ceph_decode_32(p, m->m_root); 66 m->m_root = ceph_decode_32(p);
67 ceph_decode_32(p, m->m_session_timeout); 67 m->m_session_timeout = ceph_decode_32(p);
68 ceph_decode_32(p, m->m_session_autoclose); 68 m->m_session_autoclose = ceph_decode_32(p);
69 ceph_decode_64(p, m->m_max_file_size); 69 m->m_max_file_size = ceph_decode_64(p);
70 ceph_decode_32(p, m->m_max_mds); 70 m->m_max_mds = ceph_decode_32(p);
71 71
72 m->m_info = kcalloc(m->m_max_mds, sizeof(*m->m_info), GFP_NOFS); 72 m->m_info = kcalloc(m->m_max_mds, sizeof(*m->m_info), GFP_NOFS);
73 if (m->m_info == NULL) 73 if (m->m_info == NULL)
74 goto badmem; 74 goto badmem;
75 75
76 /* pick out active nodes from mds_info (state > 0) */ 76 /* pick out active nodes from mds_info (state > 0) */
77 ceph_decode_32(p, n); 77 n = ceph_decode_32(p);
78 for (i = 0; i < n; i++) { 78 for (i = 0; i < n; i++) {
79 u32 namelen; 79 u32 namelen;
80 s32 mds, inc, state; 80 s32 mds, inc, state;
@@ -86,18 +86,18 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
86 86
87 ceph_decode_need(p, end, sizeof(addr) + 1 + sizeof(u32), bad); 87 ceph_decode_need(p, end, sizeof(addr) + 1 + sizeof(u32), bad);
88 ceph_decode_copy(p, &addr, sizeof(addr)); 88 ceph_decode_copy(p, &addr, sizeof(addr));
89 ceph_decode_8(p, infoversion); 89 infoversion = ceph_decode_8(p);
90 ceph_decode_32(p, namelen); /* skip mds name */ 90 namelen = ceph_decode_32(p); /* skip mds name */
91 *p += namelen; 91 *p += namelen;
92 92
93 ceph_decode_need(p, end, 93 ceph_decode_need(p, end,
94 4*sizeof(u32) + sizeof(u64) + 94 4*sizeof(u32) + sizeof(u64) +
95 sizeof(addr) + sizeof(struct ceph_timespec), 95 sizeof(addr) + sizeof(struct ceph_timespec),
96 bad); 96 bad);
97 ceph_decode_32(p, mds); 97 mds = ceph_decode_32(p);
98 ceph_decode_32(p, inc); 98 inc = ceph_decode_32(p);
99 ceph_decode_32(p, state); 99 state = ceph_decode_32(p);
100 ceph_decode_64(p, state_seq); 100 state_seq = ceph_decode_64(p);
101 *p += sizeof(addr); 101 *p += sizeof(addr);
102 *p += sizeof(struct ceph_timespec); 102 *p += sizeof(struct ceph_timespec);
103 *p += sizeof(u32); 103 *p += sizeof(u32);
@@ -123,8 +123,8 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
123 kcalloc(num_export_targets, sizeof(u32), 123 kcalloc(num_export_targets, sizeof(u32),
124 GFP_NOFS); 124 GFP_NOFS);
125 for (j = 0; j < num_export_targets; j++) 125 for (j = 0; j < num_export_targets; j++)
126 ceph_decode_32(&pexport_targets, 126 m->m_info[mds].export_targets[j] =
127 m->m_info[mds].export_targets[j]); 127 ceph_decode_32(&pexport_targets);
128 } else { 128 } else {
129 m->m_info[mds].export_targets = NULL; 129 m->m_info[mds].export_targets = NULL;
130 } 130 }
@@ -139,8 +139,8 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
139 goto badmem; 139 goto badmem;
140 ceph_decode_need(p, end, sizeof(u32)*(n+1), bad); 140 ceph_decode_need(p, end, sizeof(u32)*(n+1), bad);
141 for (i = 0; i < n; i++) 141 for (i = 0; i < n; i++)
142 ceph_decode_32(p, m->m_data_pg_pools[i]); 142 m->m_data_pg_pools[i] = ceph_decode_32(p);
143 ceph_decode_32(p, m->m_cas_pg_pool); 143 m->m_cas_pg_pool = ceph_decode_32(p);
144 144
145 /* ok, we don't care about the rest. */ 145 /* ok, we don't care about the rest. */
146 dout("mdsmap_decode success epoch %u\n", m->m_epoch); 146 dout("mdsmap_decode success epoch %u\n", m->m_epoch);