Skip to contentSkip to conversation

mirroring: [patch 4 of 6] device failure tolerance

PATCH Jonathan E Brassow 1 participant 1 message Jun 30, 2005 Device mapper

lore
Share & tools
lore
#0 lore raw

This patch adds the components necessary for clustering support. It introduces a new log function - is_remote_recovering(). With this function, we can check if other machines are recovering a region, which means we can not simultaneously write. This function displaces the former idea of having in_sync() return more that two states - which would have changed its predicate nature.

brassow

drivers/md/dm-log.c +5 -0
diff -urN linux-2.6.12-00003/drivers/md/dm-log.c linux-2.6.12-00004/drivers/md/dm-log.c
@@ -545,6 +545,11 @@
 	return log_test_bit(lc->clean_bits, region);
 }
 
+static int core_is_remote_recovering(struct dirty_log *log, region_t region)
+{
+	return 0;
+}
+
 static int core_in_sync(struct dirty_log *log, region_t region, int 

block)
{
struct log_c *lc = (struct log_c *) log->context;
@@ -748,10 +753,12 @@
static struct dirty_log_type _core_type = {
.name = "core",
.module = THIS_MODULE,
+ .multi_node = 0,
.ctr = core_ctr,
.dtr = core_dtr,
.get_region_size = core_get_region_size, .is_clean = core_is_clean,
+ .is_remote_recovering = core_is_remote_recovering,
.in_sync = core_in_sync,
.flush = core_flush,
.mark_region = core_mark_region,
@@ -767,12 +774,14 @@
static struct dirty_log_type _disk_type = {
.name = "disk",
.module = THIS_MODULE,
+ .multi_node = 0,
.ctr = disk_ctr,
.dtr = disk_dtr,
.suspend = disk_flush,
.resume = disk_resume,
.get_region_size = core_get_region_size, .is_clean = core_is_clean,
+ .is_remote_recovering = core_is_remote_recovering,
.in_sync = core_in_sync,
.flush = disk_flush,
.mark_region = core_mark_region,

drivers/md/dm-log.h +11 -0
diff -urN linux-2.6.12-00003/drivers/md/dm-log.h linux-2.6.12-00004/drivers/md/dm-log.h
@@ -23,6 +23,7 @@
 	const char *name;
 	struct module *module;
 	unsigned int use_count;
+	unsigned int multi_node;
 
 	int (*ctr)(struct dirty_log *log, struct dm_target *ti,
 		   unsigned int argc, char **argv);
@@ -48,6 +49,16 @@
 	int (*is_clean)(struct dirty_log *log, region_t region);
 
 	/*
+	 * Returns: 0, 1
+	 *
+	 * This is necessary for cluster mirroring. It provides
+	 * a way to detect recovery on another node, so we
+	 * aren't writing concurrently.  This function is likely
+	 * to block (when a cluster log is used).
+	 */
+	int (*is_remote_recovering)(struct dirty_log *log, region_t region);
+
+	/*
 	 *  Returns: 0, 1, -EWOULDBLOCK, < 0
 	 *
 	 * A predicate function to check the area given by
drivers/md/dm-raid1.c +37 -4

103 lines not on this page · raw message