aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/mdsmap.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2013-05-29 07:46:56 -0400
committerSage Weil <sage@inktank.com>2013-07-01 12:52:02 -0400
commit6af8652849a15e407b458a271ef9154e472f6dd4 (patch)
tree357842a120ca1a094495e3789c2b356a9da257eb /fs/ceph/mdsmap.c
parentc213b50b7dcbf06abcfbf1e4eee5b76586718bd9 (diff)
ceph: tidy ceph_mdsmap_decode() a little
I introduced a new temporary variable "info" instead of "m->m_info[mds]". Also I reversed the if condition and pulled everything in one indent level. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Alex Elder <elder@inktank.com>
Diffstat (limited to 'fs/ceph/mdsmap.c')
-rw-r--r--fs/ceph/mdsmap.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c
index d4d38977dcbb..132b64eeecd4 100644
--- a/fs/ceph/mdsmap.c
+++ b/fs/ceph/mdsmap.c
@@ -92,6 +92,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
92 u32 num_export_targets; 92 u32 num_export_targets;
93 void *pexport_targets = NULL; 93 void *pexport_targets = NULL;
94 struct ceph_timespec laggy_since; 94 struct ceph_timespec laggy_since;
95 struct ceph_mds_info *info;
95 96
96 ceph_decode_need(p, end, sizeof(u64)*2 + 1 + sizeof(u32), bad); 97 ceph_decode_need(p, end, sizeof(u64)*2 + 1 + sizeof(u32), bad);
97 global_id = ceph_decode_64(p); 98 global_id = ceph_decode_64(p);
@@ -126,26 +127,27 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
126 i+1, n, global_id, mds, inc, 127 i+1, n, global_id, mds, inc,
127 ceph_pr_addr(&addr.in_addr), 128 ceph_pr_addr(&addr.in_addr),
128 ceph_mds_state_name(state)); 129 ceph_mds_state_name(state));
129 if (mds >= 0 && mds < m->m_max_mds && state > 0) { 130
130 m->m_info[mds].global_id = global_id; 131 if (mds < 0 || mds >= m->m_max_mds || state <= 0)
131 m->m_info[mds].state = state; 132 continue;
132 m->m_info[mds].addr = addr; 133
133 m->m_info[mds].laggy = 134 info = &m->m_info[mds];
134 (laggy_since.tv_sec != 0 || 135 info->global_id = global_id;
135 laggy_since.tv_nsec != 0); 136 info->state = state;
136 m->m_info[mds].num_export_targets = num_export_targets; 137 info->addr = addr;
137 if (num_export_targets) { 138 info->laggy = (laggy_since.tv_sec != 0 ||
138 m->m_info[mds].export_targets = 139 laggy_since.tv_nsec != 0);
139 kcalloc(num_export_targets, sizeof(u32), 140 info->num_export_targets = num_export_targets;
140 GFP_NOFS); 141 if (num_export_targets) {
141 if (m->m_info[mds].export_targets == NULL) 142 info->export_targets = kcalloc(num_export_targets,
142 goto badmem; 143 sizeof(u32), GFP_NOFS);
143 for (j = 0; j < num_export_targets; j++) 144 if (info->export_targets == NULL)
144 m->m_info[mds].export_targets[j] = 145 goto badmem;
145 ceph_decode_32(&pexport_targets); 146 for (j = 0; j < num_export_targets; j++)
146 } else { 147 info->export_targets[j] =
147 m->m_info[mds].export_targets = NULL; 148 ceph_decode_32(&pexport_targets);
148 } 149 } else {
150 info->export_targets = NULL;
149 } 151 }
150 } 152 }
151 153