Skip to contentSkip to conversation

dm headers(2nd): change names of kcopyd_client, kcopyd_copy, etc. in kcopyd.h to have "dm_" prefix in order to prepare for move of the header to include/linux and adjust callers.

RFC PATCH New Heinz Mauelshagen 1 participant 1 message Mar 6, 2008 Device mapper

lore
Share & tools
lore
#0 lore raw

RFC PATCH 2/6 dm headers(2nd): change names of kcopyd_client, kcopyd_copy, etc. in kcopyd.h to have "dm_" prefix in order to prepare for move of the header to include/linux and adjust callers.

---
 drivers/md/dm-raid1.c |   16 ++++++++--------
 drivers/md/dm-snap.c  |    8 ++++----
 drivers/md/dm-snap.h  |    2 +-
 drivers/md/kcopyd.c   |   47 ++++++++++++++++++++++++-----------------------
 drivers/md/kcopyd.h   |   37 ++++++++++++++++++++-----------------
 5 files changed, 57 insertions(+), 53 deletions(-)
drivers/md/dm-raid1.c +8 -8
index b594dee..fdb9f5f 100644
@@ -133,7 +133,7 @@ struct mirror_set {
 	struct dm_target *ti;
 	struct list_head list;
 	struct region_hash rh;
-	struct kcopyd_client *kcopyd_client;
+	struct dm_kcopyd_client *kcopyd_client;
 	uint64_t features;
 
 	spinlock_t lock;	/* protects the lists */
@@ -790,7 +790,7 @@ static int recover(struct mirror_set *ms, struct region *reg)
 {
 	int r;
 	unsigned int i;
-	struct dm_io_region from, to[KCOPYD_MAX_REGIONS], *dest;
+	struct dm_io_region from, to[DM_KCOPYD_MAX_REGIONS], *dest;
 	struct mirror *m;
 	unsigned long flags = 0;
 
@@ -822,9 +822,9 @@ static int recover(struct mirror_set *ms, struct region *reg)
 	}
 
 	/* hand to kcopyd */
-	set_bit(KCOPYD_IGNORE_ERROR, &flags);
-	r = kcopyd_copy(ms->kcopyd_client, &from, ms->nr_mirrors - 1, to, flags,
-			recovery_complete, reg);
+	set_bit(DM_KCOPYD_IGNORE_ERROR, &flags);
+	r = dm_kcopyd_copy(ms->kcopyd_client, &from, ms->nr_mirrors - 1, to,
+			   flags, recovery_complete, reg);
 
 	return r;
 }
@@ -1506,7 +1506,7 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 	argc -= args_used;
 
 	if (!argc || sscanf(argv[0], "%u", &nr_mirrors) != 1 ||
-	    nr_mirrors < 2 || nr_mirrors > KCOPYD_MAX_REGIONS + 1) {
+	    nr_mirrors < 2 || nr_mirrors > DM_KCOPYD_MAX_REGIONS + 1) {
 		ti->error = "Invalid number of mirrors";
 		dm_destroy_dirty_log(dl);
 		return -EINVAL;
@@ -1571,7 +1571,7 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		goto err_destroy_wq;
 	}
 
-	r = kcopyd_client_create(DM_IO_PAGES, &ms->kcopyd_client);
+	r = dm_kcopyd_client_create(DM_IO_PAGES, &ms->kcopyd_client);
 	if (r)
 		goto err_destroy_wq;
 
@@ -1590,7 +1590,7 @@ static void mirror_dtr(struct dm_target *ti)
 	struct mirror_set *ms = (struct mirror_set *) ti->private;
 
 	flush_workqueue(ms->kmirrord_wq);
-	kcopyd_client_destroy(ms->kcopyd_client);
+	dm_kcopyd_client_destroy(ms->kcopyd_client);
 	destroy_workqueue(ms->kmirrord_wq);
 	free_context(ms, ti, ms->nr_mirrors);
 }
drivers/md/dm-snap.c +4 -4
index 7133ecf..3bd62db 100644
@@ -558,7 +558,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		goto bad4;
 	}
 
-	r = kcopyd_client_create(SNAPSHOT_PAGES, &s->kcopyd_client);
+	r = dm_kcopyd_client_create(SNAPSHOT_PAGES, &s->kcopyd_client);
 	if (r) {
 		ti->error = "Could not create kcopyd client";
 		goto bad5;
@@ -591,7 +591,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 	return 0;
 
  bad6:
-	kcopyd_client_destroy(s->kcopyd_client);
+	dm_kcopyd_client_destroy(s->kcopyd_client);
 
  bad5:
 	s->store.destroy(&s->store);
@@ -613,7 +613,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 
 static void __free_exceptions(struct dm_snapshot *s)
 {
-	kcopyd_client_destroy(s->kcopyd_client);
+	dm_kcopyd_client_destroy(s->kcopyd_client);
 	s->kcopyd_client = NULL;
 
 	exit_exception_table(&s->pending, pending_cache);
@@ -839,7 +839,7 @@ static void start_copy(struct dm_snap_pending_exception *pe)
 	dest.count = src.count;
 
 	/* Hand over to kcopyd */
-	kcopyd_copy(s->kcopyd_client,
+	dm_kcopyd_copy(s->kcopyd_client,
 		    &src, 1, &dest, 0, copy_callback, pe);
 }
 
drivers/md/dm-snap.h +1 -1
index 93bce5d..214548e 100644
@@ -169,7 +169,7 @@ struct dm_snapshot {
 	/* The on disk metadata handler */
 	struct exception_store store;
 
-	struct kcopyd_client *kcopyd_client;
+	struct dm_kcopyd_client *kcopyd_client;
 
 	/* Queue of snapshot writes for ksnapd to flush */
 	struct bio_list queued_bios;
drivers/md/kcopyd.c +24 -23

148 lines not on this page · raw message

drivers/md/kcopyd.h +20 -17
index d30a893..eb998c0 100644
@@ -1,11 +1,13 @@
 /*
- * Copyright (C) 2001 Sistina Software
+ * Copyright (C) 2001-2003 Sistina Software
+ * Copyright (C) 2004-2008 Red Hat GmbH
+ *
+ * dm-kcopyd provides a simple interface for copying an area of one
+ * block-device to one or more other block-devices, either synchronous
+ * or with an asynchronous completion notification.
  *
  * This file is released under the GPL.
  *
- * Kcopyd provides a simple interface for copying an area of one
- * block-device to one or more other block-devices, with an asynchronous
- * completion notification.
  */
 
 #ifndef DM_KCOPYD_H
@@ -14,29 +16,30 @@
 #include "dm-io.h"
 
 /* FIXME: make this configurable */
-#define KCOPYD_MAX_REGIONS 8
+#define DM_KCOPYD_MAX_REGIONS 8
 
-#define KCOPYD_IGNORE_ERROR 1
+#define DM_KCOPYD_IGNORE_ERROR 1
 
 /*
- * To use kcopyd you must first create a kcopyd client object.
+ * To use dm-kcopyd you must first create a kcopyd client object.
  */
-struct kcopyd_client;
-int kcopyd_client_create(unsigned int num_pages, struct kcopyd_client **result);
-void kcopyd_client_destroy(struct kcopyd_client *kc);
+struct dm_kcopyd_client;
+int dm_kcopyd_client_create(unsigned int num_pages,
+			    struct dm_kcopyd_client **result);
+void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc);
 
 /*
- * Submit a copy job to kcopyd.  This is built on top of the
+ * Submit a copy job to dm-kcopyd.  This is built on top of the
  * previous three fns.
  *
  * read_err is a boolean,
- * write_err is a bitset, with 1 bit for each destination region
+ * write_err is a bitset, with 1 bit for each destination region.
  */
-typedef void (*kcopyd_notify_fn)(int read_err,
-				 unsigned int write_err, void *context);
+typedef void (*dm_kcopyd_notify_fn)(int read_err,
+				    unsigned int write_err, void *context);
 
-int kcopyd_copy(struct kcopyd_client *kc, struct dm_io_region *from,
-		unsigned int num_dests, struct dm_io_region *dests,
-		unsigned int flags, kcopyd_notify_fn fn, void *context);
+int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
+		   unsigned int num_dests, struct dm_io_region *dests,
+		   unsigned int flags, dm_kcopyd_notify_fn fn, void *context);
 
 #endif
Signature · 1 line
1.5.4.1