Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libceph: support for subscribing to "mdsmap.<id>" maps

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

+17 -5
+2
include/linux/ceph/ceph_fs.h
··· 208 208 struct ceph_fsid fsid; 209 209 } __attribute__ ((packed)); 210 210 211 + #define CEPH_FS_CLUSTER_ID_NONE -1 212 + 211 213 /* 212 214 * mdsmap flags 213 215 */
+1
include/linux/ceph/mon_client.h
··· 96 96 bool want; 97 97 u32 have; /* epoch */ 98 98 } subs[3]; 99 + int fs_cluster_id; /* "mdsmap.<id>" sub */ 99 100 100 101 #ifdef CONFIG_DEBUG_FS 101 102 struct dentry *debugfs_file;
+1
net/ceph/debugfs.c
··· 128 128 CEPH_SUBSCRIBE_ONETIME ? "" : "+")); 129 129 seq_putc(s, '\n'); 130 130 } 131 + seq_printf(s, "fs_cluster_id %d\n", monc->fs_cluster_id); 131 132 132 133 for (rp = rb_first(&monc->generic_request_tree); rp; rp = rb_next(rp)) { 133 134 __u16 op;
+13 -5
net/ceph/mon_client.c
··· 260 260 BUG_ON(num < 1); /* monmap sub is always there */ 261 261 ceph_encode_32(&p, num); 262 262 for (i = 0; i < ARRAY_SIZE(monc->subs); i++) { 263 - const char *s = ceph_sub_str[i]; 263 + char buf[32]; 264 + int len; 264 265 265 266 if (!monc->subs[i].want) 266 267 continue; 267 268 268 - dout("%s %s start %llu flags 0x%x\n", __func__, s, 269 + len = sprintf(buf, "%s", ceph_sub_str[i]); 270 + if (i == CEPH_SUB_MDSMAP && 271 + monc->fs_cluster_id != CEPH_FS_CLUSTER_ID_NONE) 272 + len += sprintf(buf + len, ".%d", monc->fs_cluster_id); 273 + 274 + dout("%s %s start %llu flags 0x%x\n", __func__, buf, 269 275 le64_to_cpu(monc->subs[i].item.start), 270 276 monc->subs[i].item.flags); 271 - ceph_encode_string(&p, end, s, strlen(s)); 277 + ceph_encode_string(&p, end, buf, len); 272 278 memcpy(p, &monc->subs[i].item, sizeof(monc->subs[i].item)); 273 279 p += sizeof(monc->subs[i].item); 274 280 } 275 281 276 - BUG_ON(p != (end - 35 - (ARRAY_SIZE(monc->subs) - num) * 19)); 282 + BUG_ON(p > end); 277 283 msg->front.iov_len = p - msg->front.iov_base; 278 284 msg->hdr.front_len = cpu_to_le32(msg->front.iov_len); 279 285 ceph_msg_revoke(msg); ··· 954 948 if (!monc->m_subscribe_ack) 955 949 goto out_auth; 956 950 957 - monc->m_subscribe = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE, 96, GFP_NOFS, 951 + monc->m_subscribe = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE, 128, GFP_NOFS, 958 952 true); 959 953 if (!monc->m_subscribe) 960 954 goto out_subscribe_ack; ··· 979 973 INIT_DELAYED_WORK(&monc->delayed_work, delayed_work); 980 974 monc->generic_request_tree = RB_ROOT; 981 975 monc->last_tid = 0; 976 + 977 + monc->fs_cluster_id = CEPH_FS_CLUSTER_ID_NONE; 982 978 983 979 return 0; 984 980