[PATCH 3/3]: region based notifications for dm-io

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch removes the old interface definitions and implementations for dm-io.

Signed-off-by: Stefan Bader <shbader@xxxxxxxxxx>

---
drivers/md/dm-exception-store.c |    8 +-
drivers/md/dm-io.c              |  149 ++++++++++------------------------------
drivers/md/dm-io.h              |   40 ++--------
drivers/md/dm-log.c             |    6 -
drivers/md/dm-raid1.c           |    6 -
drivers/md/kcopyd.c             |    6 -
6 files changed, 61 insertions(+), 154 deletions(-)
This patch removes the old interface definitions and implementations for
dm-io.

Signed-off-by: Stefan Bader <shbader@xxxxxxxxxx>

---
 drivers/md/dm-exception-store.c |    8 +-
 drivers/md/dm-io.c              |  149 ++++++++++------------------------------
 drivers/md/dm-io.h              |   40 ++--------
 drivers/md/dm-log.c             |    6 -
 drivers/md/dm-raid1.c           |    6 -
 drivers/md/kcopyd.c             |    6 -
 6 files changed, 61 insertions(+), 154 deletions(-)

Index: linux-2.6.22-rc2/drivers/md/dm-exception-store.c
===================================================================
--- linux-2.6.22-rc2.orig/drivers/md/dm-exception-store.c
+++ linux-2.6.22-rc2/drivers/md/dm-exception-store.c
@@ -166,7 +166,7 @@ static int chunk_io(struct pstore *ps, u
 		.sector = ps->snap->chunk_size * chunk,
 		.count = ps->snap->chunk_size,
 	};
-	struct dm_io_request_new *io_req;
+	struct dm_io_request *io_req;
 	int rc;
 
 	io_req = dm_io_request_create(ps->io_client, GFP_NOIO);
@@ -174,7 +174,7 @@ static int chunk_io(struct pstore *ps, u
 		return -ENOMEM;
 
 
-	*io_req = (struct dm_io_request_new) {
+	*io_req = (struct dm_io_request) {
 		.rw = rw | BIO_RW_SYNC,
 		.mem.type = DM_IO_VMA,
 		.mem.ptr.vma = ps->area,
@@ -232,7 +232,7 @@ static int read_header(struct pstore *ps
 		chunk_size_supplied = 0;
 	}
 
-	ps->io_client = dm_io_client_create_new(
+	ps->io_client = dm_io_client_create(
 				sectors_to_pages(ps->snap->chunk_size)*4, 1);
 	if (IS_ERR(ps->io_client))
 		return PTR_ERR(ps->io_client);
@@ -278,7 +278,7 @@ static int read_header(struct pstore *ps
 	ps->snap->chunk_mask = chunk_size - 1;
 	ps->snap->chunk_shift = ffs(chunk_size) - 1;
 
-	r = dm_io_client_resize_new(ps->io_client,
+	r = dm_io_client_resize(ps->io_client,
 			sectors_to_pages(ps->snap->chunk_size)*4, 1);
 	if (r)
 		return r;
Index: linux-2.6.22-rc2/drivers/md/dm-io.h
===================================================================
--- linux-2.6.22-rc2.orig/drivers/md/dm-io.h
+++ linux-2.6.22-rc2/drivers/md/dm-io.h
@@ -15,9 +15,6 @@ struct dm_io_region {
 	sector_t count;		/* If this is zero the region is ignored. */
 };
 
-/* Will go */
-#define io_region dm_io_region
-
 struct page_list {
 	struct page_list *next;
 	struct page *page;
@@ -56,8 +53,6 @@ struct dm_io_notify_data {
 };
 typedef void (*dm_io_notify_fn)(struct dm_io_notify_data *data);
 
-/* Will go */
-typedef void (*io_notify_fn)(unsigned long error, void *context);
 
 /*
  * IO request structure to pass in arguments to dm_io()
@@ -86,10 +81,6 @@ struct dm_io_memory {
 };
 
 struct dm_io_notify {
-	io_notify_fn			fn;	 /* Callback for async req */
-	void *				context; /* Passed to callback     */
-};
-struct dm_io_notify_new {
 	enum dm_io_notification_type	type;	 /* Requested notification */
 	dm_io_notify_fn			fn;	 /* Callback for async req */
 	void *				context; /* Passed to callback     */
@@ -97,15 +88,9 @@ struct dm_io_notify_new {
 
 struct dm_io_client;
 struct dm_io_request {
-	int			bi_rw;	/* READ|WRITE + bio flags */
-	struct dm_io_memory	mem;	/* Memory to use for io */
-	struct dm_io_notify	notify;	/* Synchronous if notify.fn is NULL */
-	struct dm_io_client *	client;	/* Client memory handler */
-};
-struct dm_io_request_new {
 	int			rw;		/* READ|WRITE + bio flags */
 	struct dm_io_memory	mem;		/* Memory to use for io   */
-	struct dm_io_notify_new	notify;		/* Notification handler   */
+	struct dm_io_notify	notify;		/* Notification handler   */
 	unsigned		flags;		/* Future use...          */
 };
 
@@ -118,16 +103,12 @@ struct dm_io_request_new {
  * handle in low-mem situations and how many regions will be used
  * alltogether. This can be changed by the resize call.
  */
-struct dm_io_client *dm_io_client_create_new(unsigned min_ios,
+struct dm_io_client *dm_io_client_create(unsigned min_ios,
 	unsigned max_regions);
-int dm_io_client_resize_new(struct dm_io_client *client, unsigned min_ios,
+int dm_io_client_resize(struct dm_io_client *client, unsigned min_ios,
 	unsigned max_regions);
 void dm_io_client_destroy(struct dm_io_client *client);
 
-/* Old client functions */
-struct dm_io_client * __deprecated dm_io_client_create(unsigned num_pages);
-int __deprecated dm_io_client_resize(unsigned num_pages,
-	struct dm_io_client *client);
 
 /*
  * To start I/O the caller must first create a new request structure by
@@ -140,19 +121,14 @@ int __deprecated dm_io_client_resize(uns
  *           b) wait until the request has been completed
  *        2. The calls to dm_io_create and dm_io_submit might block.
  */
-struct dm_io_request_new *dm_io_request_create(struct dm_io_client *client,
+struct dm_io_request *dm_io_request_create(struct dm_io_client *client,
 	gfp_t gfp_mask);
 
-int dm_io_request_submit(struct dm_io_request_new *io_req,
+int dm_io_request_submit(struct dm_io_request *io_req,
 	unsigned num_regions, struct dm_io_region *regions);
-unsigned long dm_io_request_wait_for_completion(
-	struct dm_io_request_new *io_req);
-
-struct dm_io_request_new *dm_io_request_get(struct dm_io_request_new *io_req);
-void dm_io_request_put(struct dm_io_request_new *io_req);
+unsigned long dm_io_request_wait_for_completion(struct dm_io_request *io_req);
 
-/* Old I/O interface */
-int __deprecated dm_io(struct dm_io_request *io_req, unsigned num_regions,
-	struct dm_io_region *region, unsigned long *sync_error_bits);
+struct dm_io_request *dm_io_request_get(struct dm_io_request *io_req);
+void dm_io_request_put(struct dm_io_request *io_req);
 
 #endif
Index: linux-2.6.22-rc2/drivers/md/dm-log.c
===================================================================
--- linux-2.6.22-rc2.orig/drivers/md/dm-log.c
+++ linux-2.6.22-rc2/drivers/md/dm-log.c
@@ -204,14 +204,14 @@ static void header_from_disk(struct log_
 
 static int rw_header(struct log_c *lc, int rw)
 {
-	struct dm_io_request_new *io_req;
+	struct dm_io_request *io_req;
 	int rc;
 
 	io_req = dm_io_request_create(lc->client, GFP_NOIO);
 	if (!io_req)
 		return -ENOMEM;
 
-	*io_req = (struct dm_io_request_new) {
+	*io_req = (struct dm_io_request) {
 		.rw = rw | BIO_RW_SYNC,
 		.mem.type = DM_IO_VMA,
 		.mem.ptr.vma = lc->disk_header,
@@ -350,7 +350,7 @@ static int create_log_context(struct dir
 				       bitset_size, ti->limits.hardsect_size);
 		lc->header_location.count = buf_size >> SECTOR_SHIFT;
 
-		lc->client = dm_io_client_create_new(2, 1);
+		lc->client = dm_io_client_create(2, 1);
 		if (IS_ERR(lc->client)) {
 			r = PTR_ERR(lc->client);
 			DMWARN("couldn't allocate disk io client");
Index: linux-2.6.22-rc2/drivers/md/dm-raid1.c
===================================================================
--- linux-2.6.22-rc2.orig/drivers/md/dm-raid1.c
+++ linux-2.6.22-rc2/drivers/md/dm-raid1.c
@@ -798,13 +798,13 @@ static void do_write(struct mirror_set *
 	unsigned int i;
 	struct dm_io_region io[KCOPYD_MAX_REGIONS+1];
 	struct mirror *m;
-	struct dm_io_request_new *io_req;
+	struct dm_io_request *io_req;
 
 	io_req = dm_io_request_create(ms->io_client, GFP_NOIO);
 	if (!io_req)
 		return;
 
-	*io_req = (struct dm_io_request_new) {
+	*io_req = (struct dm_io_request) {
 		.rw = WRITE,
 		.mem.type = DM_IO_BVEC,
 		.mem.ptr.bvec = bio->bi_io_vec + bio->bi_idx,
@@ -940,7 +940,7 @@ static struct mirror_set *alloc_context(
 	ms->in_sync = 0;
 	ms->default_mirror = &ms->mirror[DEFAULT_MIRROR];
 
-	ms->io_client = dm_io_client_create_new(256, nr_mirrors);
+	ms->io_client = dm_io_client_create(256, nr_mirrors);
 	if (IS_ERR(ms->io_client)) {
 		ti->error = "Error creating dm_io client";
 		kfree(ms);
Index: linux-2.6.22-rc2/drivers/md/kcopyd.c
===================================================================
--- linux-2.6.22-rc2.orig/drivers/md/kcopyd.c
+++ linux-2.6.22-rc2/drivers/md/kcopyd.c
@@ -345,13 +345,13 @@ static void complete_io(struct dm_io_not
 static int run_io_job(struct kcopyd_job *job)
 {
 	int r;
-	struct dm_io_request_new *io_req;
+	struct dm_io_request *io_req;
 
 	io_req = dm_io_request_create(job->kc->io_client, GFP_NOIO);
 	if (!io_req)
 		return -ENOMEM;
 
-	*io_req = (struct dm_io_request_new) {
+	*io_req = (struct dm_io_request) {
 		.rw = job->rw,
 		.mem.type = DM_IO_PAGE_LIST,
 		.mem.ptr.pl = job->pages,
@@ -685,7 +685,7 @@ int kcopyd_client_create(unsigned int nr
 		return r;
 	}
 
-	kc->io_client = dm_io_client_create_new(nr_pages*4, KCOPYD_MAX_REGIONS);
+	kc->io_client = dm_io_client_create(nr_pages*4, KCOPYD_MAX_REGIONS);
 	if (IS_ERR(kc->io_client)) {
 		r = PTR_ERR(kc->io_client);
 		client_free_pages(kc);
Index: linux-2.6.22-rc2/drivers/md/dm-io.c
===================================================================
--- linux-2.6.22-rc2.orig/drivers/md/dm-io.c
+++ linux-2.6.22-rc2/drivers/md/dm-io.c
@@ -44,7 +44,7 @@ struct dm_io_client {
  * requests.
  */
 struct io {
-	struct dm_io_request_new	req;		/* Must be first */
+	struct dm_io_request		req;		/* Must be first */
 
 	struct dm_io_client *		client;
 	atomic_t			ref_count;
@@ -53,9 +53,6 @@ struct io {
 	struct sub_io *			sub_ios;
 	atomic_t			io_count;
 
-	io_notify_fn			old_fn;		/* Will go */
-	void *				old_context;	/* Will go */
-
 	/* FIXME: This might me unnecessary. */
 	unsigned			num_regions;
 };
@@ -119,8 +116,7 @@ static struct sub_io *notify_list_pop(st
  * Create a client with mempool and bioset.
  */
 static void io_notification_handler(unsigned long data);
-struct dm_io_client *dm_io_client_create_new(unsigned min_ios,
-	unsigned max_regions)
+struct dm_io_client *dm_io_client_create(unsigned min_ios, unsigned max_regions)
 {
 	struct dm_io_client *	client;
 	unsigned		min_sios = min_ios * max_regions;
@@ -161,13 +157,9 @@ struct dm_io_client *dm_io_client_create
 	kfree(client);
 	return ERR_PTR(-ENOMEM);
 }
-EXPORT_SYMBOL_GPL(dm_io_client_create_new);
-struct dm_io_client *dm_io_client_create(unsigned num_pages) {
-	return dm_io_client_create_new(num_pages * 4, 16);
-}
-EXPORT_SYMBOL(dm_io_client_create);
+EXPORT_SYMBOL_GPL(dm_io_client_create);
 
-int dm_io_client_resize_new(struct dm_io_client *client, unsigned min_ios,
+int dm_io_client_resize(struct dm_io_client *client, unsigned min_ios,
 	unsigned max_regions)
 {
 	unsigned	min_sios = min_ios * max_regions;
@@ -185,12 +177,7 @@ int dm_io_client_resize_new(struct dm_io
 
 	return rc;
 }
-EXPORT_SYMBOL_GPL(dm_io_client_resize_new);
-int dm_io_client_resize(unsigned num_pages, struct dm_io_client *client)
-{
-	return dm_io_client_resize_new(client, num_pages * 4, 16);
-}
-EXPORT_SYMBOL(dm_io_client_resize);
+EXPORT_SYMBOL_GPL(dm_io_client_resize);
 
 static struct dm_io_client *dm_io_client_get(struct dm_io_client *client)
 {
@@ -225,7 +212,7 @@ static void dm_io_client_put(struct dm_i
 	dm_io_client_destroy(client);
 }
 
-struct dm_io_request_new *dm_io_request_create(struct dm_io_client *client,
+struct dm_io_request *dm_io_request_create(struct dm_io_client *client,
 	gfp_t gfp_mask)
 {
 	struct io *	io;
@@ -240,7 +227,7 @@ struct dm_io_request_new *dm_io_request_
 
 	io->sub_ios = NULL;
 
-	return (struct dm_io_request_new *) io;
+	return (struct dm_io_request *) io;
 }
 EXPORT_SYMBOL_GPL(dm_io_request_create);
 
@@ -250,9 +237,9 @@ static struct io *io_get(struct io *io)
 
 	return io;
 }
-struct dm_io_request_new *dm_io_request_get(struct dm_io_request_new *io_req)
+struct dm_io_request *dm_io_request_get(struct dm_io_request *io_req)
 {
-	return (struct dm_io_request_new *) io_get((struct io *) io_req);
+	return (struct dm_io_request *) io_get((struct io *) io_req);
 }
 EXPORT_SYMBOL(dm_io_request_get);
 
@@ -277,7 +264,7 @@ static void io_put(struct io *io)
 		dm_io_client_put(client);
 	}
 }
-void dm_io_request_put(struct dm_io_request_new *io_req)
+void dm_io_request_put(struct dm_io_request *io_req)
 {
 	io_put((struct io *) io_req);
 }
@@ -531,7 +518,34 @@ static void km_dp_init(struct dpages *dp
 	dp->context_ptr = data;
 }
 
-static int dp_init(struct dm_io_memory *mem, struct dpages *dp);
+static int dp_init(struct dm_io_memory *mem, struct dpages *dp)
+{
+	/* Set up dpages based on memory type */
+	switch (mem->type) {
+	case DM_IO_PAGE_LIST:
+		list_dp_init(dp, mem->ptr.pl, mem->offset);
+		break;
+
+	case DM_IO_BVEC:
+		bvec_dp_init(dp, mem->ptr.bvec);
+		break;
+
+	case DM_IO_VMA:
+		vm_dp_init(dp, mem->ptr.vma);
+		break;
+
+	case DM_IO_KMEM:
+		km_dp_init(dp, mem->ptr.addr);
+		break;
+
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+
 static void sub_io_submit(struct sub_io *sio, struct dm_io_region *region)
 {
 	struct io *	io		= sio->io;
@@ -573,7 +587,7 @@ static void sub_io_submit(struct sub_io 
 	}
 }
 
-int dm_io_request_submit(struct dm_io_request_new *io_req,
+int dm_io_request_submit(struct dm_io_request *io_req,
 	unsigned num_regions, struct dm_io_region *regions)
 {
 	struct io *	io	= (struct io *) io_req;
@@ -608,8 +622,7 @@ int dm_io_request_submit(struct dm_io_re
 }
 EXPORT_SYMBOL_GPL(dm_io_request_submit);
 
-unsigned long dm_io_request_wait_for_completion(
-	struct dm_io_request_new *io_req)
+unsigned long dm_io_request_wait_for_completion(struct dm_io_request *io_req)
 {
 	struct io *io = (struct io *) io_req;
 
@@ -620,85 +633,3 @@ unsigned long dm_io_request_wait_for_com
 }
 EXPORT_SYMBOL_GPL(dm_io_request_wait_for_completion);
 
-
-/*
- * I/O routine that provides the old style call.
- */
-static void compat_notify_fn(struct dm_io_notify_data *nd)
-{
-	struct io *	io	= (struct io *) nd->context;
-
-	if (io && io->old_fn) {
-		io->old_fn(nd->error_bits, io->old_context);
-		io->req.notify.context = NULL;
-		io_put(io);
-	}
-}
-
-static int dp_init(struct dm_io_memory *mem, struct dpages *dp)
-{
-	/* Set up dpages based on memory type */
-	switch (mem->type) {
-	case DM_IO_PAGE_LIST:
-		list_dp_init(dp, mem->ptr.pl, mem->offset);
-		break;
-
-	case DM_IO_BVEC:
-		bvec_dp_init(dp, mem->ptr.bvec);
-		break;
-
-	case DM_IO_VMA:
-		vm_dp_init(dp, mem->ptr.vma);
-		break;
-
-	case DM_IO_KMEM:
-		km_dp_init(dp, mem->ptr.addr);
-		break;
-
-	default:
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
-int dm_io(struct dm_io_request *io_req, unsigned num_regions,
-	  struct io_region *where, unsigned long *sync_error_bits)
-{
-	struct dm_io_request_new *	req;
-	int				r;
-
-	if (!io_req->client)
-		return -EINVAL;
-
-	req = dm_io_request_create(io_req->client, GFP_NOIO);
-	if (!req)
-		return -ENOMEM;
-
-	req->rw = io_req->bi_rw;
-	req->mem = io_req->mem;
-
-	if (!io_req->notify.fn) {
-		req->rw |= BIO_RW_SYNC;
-	} else {
-		struct io *	io = (struct io *) req;
-
-		io->old_fn          = io_req->notify.fn;
-		io->old_context     = io_req->notify.context;
-		req->notify.type    = DM_IO_NOTIFY_REQUEST;
-		req->notify.fn      = compat_notify_fn;
-		req->notify.context = io_get(io);
-	}
-
-	r = dm_io_request_submit(req, num_regions, where);
-
-	if (!io_req->notify.fn && !r) {
-		*sync_error_bits = dm_io_request_wait_for_completion(req);
-		r = *sync_error_bits ? -EIO : 0;
-	}
-
-	dm_io_request_put(req);
-
-	return r;
-}
-EXPORT_SYMBOL(dm_io);
--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux