public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* RHEL5 - dm-log-clustered/clogd: Adapt to changes in kernel API
@ 2008-09-16 14:36 Jonathan Brassow
  0 siblings, 0 replies; only message in thread
From: Jonathan Brassow @ 2008-09-16 14:36 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=4b33d439abef45a120c1a4f471fadea9978ef086
Commit:        4b33d439abef45a120c1a4f471fadea9978ef086
Parent:        29e706dc8f469f3cdac13b39dbcedba604d336d9
Author:        Jonathan Brassow <jbrassow@redhat.com>
AuthorDate:    Tue Sep 16 09:05:56 2008 -0500
Committer:     Jonathan Brassow <jbrassow@redhat.com>
CommitterDate: Tue Sep 16 09:06:53 2008 -0500

dm-log-clustered/clogd: Adapt to changes in kernel API

The device-mapper logging APIs have now been exposed.  The
names of the structures and functions changed a bit when
this happpened.  This check-in simply adapts to that.
---
 cmirror-kernel/src/Makefile  |    3 --
 cmirror-kernel/src/dm-clog.c |   56 +++++++++++++++++++++--------------------
 cmirror/src/cluster.c        |   22 ++++++++--------
 3 files changed, 40 insertions(+), 41 deletions(-)

diff --git a/cmirror-kernel/src/Makefile b/cmirror-kernel/src/Makefile
index dc7b6dc..c6bc6b0 100644
--- a/cmirror-kernel/src/Makefile
+++ b/cmirror-kernel/src/Makefile
@@ -26,9 +26,6 @@ dm-log-clustered-objs := dm-clog.o \
 EXTRA_CFLAGS += -I$(obj) -Idrivers/md
 
 all:
-	rm -f dm.h dm-log.h
-	if [ ! -e ${KERNEL_SRC}/drivers/md/dm.h ]; then ln -s dm.h-copy dm.h; fi
-	if [ ! -e ${KERNEL_SRC}/drivers/md/dm-log.h ]; then ln -s dm-log.h-copy dm-log.h; fi	
 	${MAKE} -C ${KERNEL_SRC} M=${PWD} modules USING_KBUILD=yes
 
 install: all
diff --git a/cmirror-kernel/src/dm-clog.c b/cmirror-kernel/src/dm-clog.c
index 62ad414..fe14894 100644
--- a/cmirror-kernel/src/dm-clog.c
+++ b/cmirror-kernel/src/dm-clog.c
@@ -4,8 +4,10 @@
  * This file is released under the LGPL.
  */
 
+#include <linux/bio.h>
+#include <linux/dm-dirty-log.h>
+
 #include "dm.h"
-#include "dm-log.h"
 #include "dm-clog-tfr.h"
 
 struct flush_entry {
@@ -88,7 +90,7 @@ retry:
 	return -ESRCH;
 }
 
-static int cluster_ctr(struct dirty_log *log, struct dm_target *ti,
+static int cluster_ctr(struct dm_dirty_log *log, struct dm_target *ti,
 		       unsigned int argc, char **argv,
 		       struct dm_dev *disk_log)
 {
@@ -173,7 +175,7 @@ static int cluster_ctr(struct dirty_log *log, struct dm_target *ti,
  *
  * Returns: 0 on success, -XXX on failure
  */
-static int cluster_core_ctr(struct dirty_log *log, struct dm_target *ti,
+static int cluster_core_ctr(struct dm_dirty_log *log, struct dm_target *ti,
 			    unsigned int argc, char **argv)
 {
 	int i, r;
@@ -204,7 +206,7 @@ static int cluster_core_ctr(struct dirty_log *log, struct dm_target *ti,
  *
  * Returns: 0 on success, -XXX on failure
  */
-static int cluster_disk_ctr(struct dirty_log *log, struct dm_target *ti,
+static int cluster_disk_ctr(struct dm_dirty_log *log, struct dm_target *ti,
 			    unsigned int argc, char **argv)
 {
 	int r, i;
@@ -234,7 +236,7 @@ static int cluster_disk_ctr(struct dirty_log *log, struct dm_target *ti,
  * cluster_dtr
  * @log
  */
-static void cluster_dtr(struct dirty_log *log)
+static void cluster_dtr(struct dm_dirty_log *log)
 {
 	int r;
 	struct log_c *lc = (struct log_c *)log->context;
@@ -256,7 +258,7 @@ static void cluster_dtr(struct dirty_log *log)
  * cluster_presuspend
  * @log
  */
-static int cluster_presuspend(struct dirty_log *log)
+static int cluster_presuspend(struct dm_dirty_log *log)
 {
 	int r;
 	struct log_c *lc = (struct log_c *)log->context;
@@ -272,7 +274,7 @@ static int cluster_presuspend(struct dirty_log *log)
  * cluster_postsuspend
  * @log
  */
-static int cluster_postsuspend(struct dirty_log *log)
+static int cluster_postsuspend(struct dm_dirty_log *log)
 {
 	int r;
 	struct log_c *lc = (struct log_c *)log->context;
@@ -288,7 +290,7 @@ static int cluster_postsuspend(struct dirty_log *log)
  * cluster_resume
  * @log
  */
-static int cluster_resume(struct dirty_log *log)
+static int cluster_resume(struct dm_dirty_log *log)
 {
 	int r;
 	struct log_c *lc = (struct log_c *)log->context;
@@ -309,7 +311,7 @@ static int cluster_resume(struct dirty_log *log)
  *
  * Returns: region size (doesn't fail)
  */
-static uint32_t cluster_get_region_size(struct dirty_log *log)
+static uint32_t cluster_get_region_size(struct dm_dirty_log *log)
 {
 	struct log_c *lc = (struct log_c *)log->context;
 
@@ -326,7 +328,7 @@ static uint32_t cluster_get_region_size(struct dirty_log *log)
  *
  * Returns: 1 if clean, 0 otherwise
  */
-static int cluster_is_clean(struct dirty_log *log, region_t region)
+static int cluster_is_clean(struct dm_dirty_log *log, region_t region)
 {
 	int r;
 	int is_clean;
@@ -353,7 +355,7 @@ static int cluster_is_clean(struct dirty_log *log, region_t region)
  *
  * Returns: 1 if in-sync, 0 if not-in-sync, -EWOULDBLOCK
  */
-static int cluster_in_sync(struct dirty_log *log, region_t region, int can_block)
+static int cluster_in_sync(struct dm_dirty_log *log, region_t region, int can_block)
 {
 	int r;
 	int in_sync;
@@ -401,7 +403,7 @@ static int cluster_in_sync(struct dirty_log *log, region_t region, int can_block
  *
  * Returns: 0 on success, < 0 on failure
  */
-static int cluster_flush(struct dirty_log *log)
+static int cluster_flush(struct dm_dirty_log *log)
 {
 	int r = 0;
 	int flags;
@@ -460,7 +462,7 @@ fail:
  * This function should avoid blocking unless absolutely required.
  * (Memory allocation is valid for blocking.)
  */
-static void cluster_mark_region(struct dirty_log *log, region_t region)
+static void cluster_mark_region(struct dm_dirty_log *log, region_t region)
 {
 	int flags;
 	struct log_c *lc = (struct log_c *)log->context;
@@ -491,7 +493,7 @@ static void cluster_mark_region(struct dirty_log *log, region_t region)
  * the region will be re-sync'ed on a reload of the mirror
  * even though it is in-sync.
  */
-static void cluster_clear_region(struct dirty_log *log, region_t region)
+static void cluster_clear_region(struct dm_dirty_log *log, region_t region)
 {
 	int flags;
 	struct log_c *lc = (struct log_c *)log->context;
@@ -528,7 +530,7 @@ static void cluster_clear_region(struct dirty_log *log, region_t region)
  *
  * Returns: 1 if region filled, 0 if no work, <0 on error
  */
-static int cluster_get_resync_work(struct dirty_log *log, region_t *region)
+static int cluster_get_resync_work(struct dm_dirty_log *log, region_t *region)
 {
 	int r;
 	int rdata_size;
@@ -556,7 +558,7 @@ static int cluster_get_resync_work(struct dirty_log *log, region_t *region)
  * Set the sync status of a given region.  This function
  * must not fail.
  */
-static void cluster_set_region_sync(struct dirty_log *log,
+static void cluster_set_region_sync(struct dm_dirty_log *log,
 				    region_t region, int in_sync)
 {
 	int r;
@@ -583,7 +585,7 @@ static void cluster_set_region_sync(struct dirty_log *log,
  *
  * Returns: sync count on success, 0 on failure
  */
-static region_t cluster_get_sync_count(struct dirty_log *log)
+static region_t cluster_get_sync_count(struct dm_dirty_log *log)
 {
 	int r;
 	int rdata_size;
@@ -619,7 +621,7 @@ static region_t cluster_get_sync_count(struct dirty_log *log)
  *
  * Returns: amount of space consumed
  */
-static int cluster_status(struct dirty_log *log, status_type_t status_type,
+static int cluster_status(struct dm_dirty_log *log, status_type_t status_type,
 			  char *result, unsigned int maxlen)
 {
 	int r = 0;
@@ -645,13 +647,13 @@ static int cluster_status(struct dirty_log *log, status_type_t status_type,
 	return (r) ? 0: sz;
 }
 
-static int cluster_get_failure_response(struct dirty_log *log)
+static int cluster_get_failure_response(struct dm_dirty_log *log)
 {
 	/* This type of return is not an option */
 	return DMLOG_IOERR_BLOCK;
 }
 
-static int cluster_is_remote_recovering(struct dirty_log *log, region_t region)
+static int cluster_is_remote_recovering(struct dm_dirty_log *log, region_t region)
 {
 	int r;
 	struct log_c *lc = (struct log_c *)log->context;
@@ -683,7 +685,7 @@ static int cluster_is_remote_recovering(struct dirty_log *log, region_t region)
 	return pkg.is_recovering;
 }
 
-static struct dirty_log_type _clustered_core_type = {
+static struct dm_dirty_log_type _clustered_core_type = {
 	.name = "clustered-core",
 	.module = THIS_MODULE,
 	.ctr = cluster_core_ctr,
@@ -705,7 +707,7 @@ static struct dirty_log_type _clustered_core_type = {
 	.is_remote_recovering = cluster_is_remote_recovering,
 };
 
-static struct dirty_log_type _clustered_disk_type = {
+static struct dm_dirty_log_type _clustered_disk_type = {
 	.name = "clustered-disk",
 	.module = THIS_MODULE,
 	.ctr = cluster_disk_ctr,
@@ -746,7 +748,7 @@ static int __init cluster_dirty_log_init(void)
 		return r;
 	}
 
-	r = dm_register_dirty_log_type(&_clustered_core_type);
+	r = dm_dirty_log_type_register(&_clustered_core_type);
 	if (r) {
 		DMWARN("Couldn't register clustered-core dirty log type");
 		dm_clog_tfr_exit();
@@ -754,10 +756,10 @@ static int __init cluster_dirty_log_init(void)
 		return r;
 	}
 
-	r = dm_register_dirty_log_type(&_clustered_disk_type);
+	r = dm_dirty_log_type_register(&_clustered_disk_type);
 	if (r) {
 		DMWARN("Couldn't register clustered-disk dirty log type");
-		dm_unregister_dirty_log_type(&_clustered_core_type);
+		dm_dirty_log_type_unregister(&_clustered_core_type);
 		dm_clog_tfr_exit();
 		mempool_destroy(flush_entry_pool);
 		return r;
@@ -769,8 +771,8 @@ static int __init cluster_dirty_log_init(void)
 
 static void __exit cluster_dirty_log_exit(void)
 {
-	dm_unregister_dirty_log_type(&_clustered_disk_type);
-	dm_unregister_dirty_log_type(&_clustered_core_type);
+	dm_dirty_log_type_unregister(&_clustered_disk_type);
+	dm_dirty_log_type_unregister(&_clustered_core_type);
 	dm_clog_tfr_exit();
 	mempool_destroy(flush_entry_pool);
 	DMINFO("(built %s %s) removed", __DATE__, __TIME__);
diff --git a/cmirror/src/cluster.c b/cmirror/src/cluster.c
index be8a5b9..3ac4f87 100644
--- a/cmirror/src/cluster.c
+++ b/cmirror/src/cluster.c
@@ -139,7 +139,7 @@ int cluster_send(struct clog_tfr *tfr)
 		r = cpg_mcast_joined(entry->handle, CPG_TYPE_AGREED, &iov, 1);
 		if ((r != SA_AIS_ERR_TRY_AGAIN) || (count++ > 5))
 			break;
-		sleep(1);
+		usleep(1000);
 	} while (1);
 
 	if (r == CPG_OK)
@@ -380,7 +380,7 @@ open_retry:
 	rv = saCkptCheckpointOpen(ckpt_handle, &name, &attr, flags, 0, &h);
 	if (rv == SA_AIS_ERR_TRY_AGAIN) {
 		LOG_ERROR("export_checkpoint: ckpt open retry");
-		sleep(1);
+		usleep(1000);
 		goto open_retry;
 	}
 
@@ -409,7 +409,7 @@ sync_create_retry:
 				 cp->sync_bits, cp->bitmap_size);
 	if (rv == SA_AIS_ERR_TRY_AGAIN) {
 		LOG_ERROR("Sync checkpoint section create retry");
-		sleep(1);
+		usleep(1000);
 		goto sync_create_retry;
 	}
 
@@ -438,7 +438,7 @@ clean_create_retry:
 	rv = saCkptSectionCreate(h, &section_attr, cp->clean_bits, cp->bitmap_size);
 	if (rv == SA_AIS_ERR_TRY_AGAIN) {
 		LOG_ERROR("Clean checkpoint section create retry");
-		sleep(1);
+		usleep(1000);
 		goto clean_create_retry;
 	}
 
@@ -468,7 +468,7 @@ rr_create_retry:
 				 strlen(cp->recovering_region) + 1);
 	if (rv == SA_AIS_ERR_TRY_AGAIN) {
 		LOG_ERROR("RR checkpoint section create retry");
-		sleep(1);
+		usleep(1000);
 		goto rr_create_retry;
 	}
 
@@ -541,7 +541,7 @@ open_retry:
 				  SA_CKPT_CHECKPOINT_READ, 0, &h);
 	if (rv == SA_AIS_ERR_TRY_AGAIN) {
 		LOG_ERROR("import_checkpoint: ckpt open retry");
-		sleep(1);
+		usleep(1000);
 		goto open_retry;
 	}
 
@@ -555,7 +555,7 @@ unlink_retry:
 	rv = saCkptCheckpointUnlink(ckpt_handle, &name);
 	if (rv == SA_AIS_ERR_TRY_AGAIN) {
 		LOG_ERROR("import_checkpoint: ckpt unlink retry");
-		sleep(1);
+		usleep(1000);
 		goto unlink_retry;
 	}
 
@@ -569,7 +569,7 @@ init_retry:
 					      SA_TIME_END, &itr);
 	if (rv == SA_AIS_ERR_TRY_AGAIN) {
 		LOG_ERROR("import_checkpoint: sync create retry");
-		sleep(1);
+		usleep(1000);
 		goto init_retry;
 	}
 
@@ -595,7 +595,7 @@ init_retry:
 	if (len != 3) {
 		LOG_ERROR("import_checkpoint: %d checkpoint sections found",
 			  len);
-		sleep(1);
+		usleep(1000);
 		goto init_retry;
 	}
 	saCkptSectionIterationInitialize(h, SA_CKPT_SECTIONS_ANY,
@@ -608,7 +608,7 @@ init_retry:
 
 		if (rv == SA_AIS_ERR_TRY_AGAIN) {
 			LOG_ERROR("import_checkpoint: ckpt iternext retry");
-			sleep(1);
+			usleep(1000);
 			continue;
 		}
 
@@ -634,7 +634,7 @@ init_retry:
 		rv = saCkptCheckpointRead(h, &iov, 1, NULL);
 		if (rv == SA_AIS_ERR_TRY_AGAIN) {
 			LOG_ERROR("ckpt read retry");
-			sleep(1);
+			usleep(1000);
 			goto read_retry;
 		}
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-09-16 14:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-16 14:36 RHEL5 - dm-log-clustered/clogd: Adapt to changes in kernel API Jonathan Brassow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).