Skip to contentSkip to conversation

metadata_update sends message to other nodes

PATCH In review Goldwyn Rodrigues 1 participant 1 message Dec 18, 2014 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 18/24 metadata_update sends message to other nodes

- request to send a message
- make changes to superblock
- send messages telling everyone that the superblock has changed
- other nodes all read the superblock
- other nodes all ack the messages
- updating node release the "I'm sending a message" resource.

---
 drivers/md/md-cluster.c | 28 ++++++++++++++-
 drivers/md/md-cluster.h |  3 ++
 drivers/md/md.c         | 91 +++++++++++++++++++++++++++++++++++++++++--------
 3 files changed, 106 insertions(+), 16 deletions(-)
drivers/md/md-cluster.c +27 -1
index 1e11a9b..db81ef1 100644
@@ -620,11 +620,37 @@ static void resync_info_update(struct mddev *mddev, sector_t lo, sector_t hi)
 	dlm_lock_sync(cinfo->bitmap_lockres, DLM_LOCK_PW);
 }
 
+static int metadata_update_start(struct mddev *mddev)
+{
+	return lock_comm(mddev->cluster_info);
+}
+
+static int metadata_update_finish(struct mddev *mddev)
+{
+	struct md_cluster_info *cinfo = mddev->cluster_info;
+	struct cluster_msg cmsg;
+	int ret;
+	memset(&cmsg, 0, sizeof(cmsg));
+	cmsg.type = cpu_to_le32(METADATA_UPDATED);
+	ret = __sendmsg(cinfo, &cmsg);
+	unlock_comm(cinfo);
+	return ret;
+}
+
+static int metadata_update_cancel(struct mddev *mddev)
+{
+	struct md_cluster_info *cinfo = mddev->cluster_info;
+	return dlm_unlock_sync(cinfo->token_lockres);
+}
+
 static struct md_cluster_operations cluster_ops = {
 	.join   = join,
 	.leave  = leave,
 	.slot_number = slot_number,
-	.resync_info_update = resync_info_update
+	.resync_info_update = resync_info_update,
+	.metadata_update_start = metadata_update_start,
+	.metadata_update_finish = metadata_update_finish,
+	.metadata_update_cancel = metadata_update_cancel
 };
 
 static int __init cluster_init(void)
drivers/md/md-cluster.h +3 -0
index 51a24df..658982a 100644
@@ -12,6 +12,9 @@ struct md_cluster_operations {
 	int (*leave)(struct mddev *mddev);
 	int (*slot_number)(struct mddev *mddev);
 	void (*resync_info_update)(struct mddev *mddev, sector_t lo, sector_t hi);
+	int (*metadata_update_start)(struct mddev *mddev);
+	int (*metadata_update_finish)(struct mddev *mddev);
+	int (*metadata_update_cancel)(struct mddev *mddev);
 };
 
 #endif /* _MD_CLUSTER_H */
drivers/md/md.c +76 -15

217 lines not on this page · raw message

Signature · 1 line
2.1.2