Skip to contentSkip to conversation

: region based notifications for dm-io

PATCH In review Stefan Bader 1 participant 1 message Jun 5, 2007 Device mapper

lore
Share & tools
lore
#0 lore raw

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

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

---

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.

---
 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(-)
drivers/md/dm-exception-store.c +4 -4
Index: 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;
drivers/md/dm-io.h +8 -32
Index: 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
drivers/md/dm-log.c +3 -3
Index: 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");
drivers/md/dm-raid1.c +3 -3
Index: 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);
drivers/md/kcopyd.c +3 -3
Index: 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);
drivers/md/dm-io.c +40 -109

226 lines not on this page · raw message