[dm-devel] [Patch] dm-io: stop using page->list

Joe Thornber thornber at redhat.com
Thu Mar 11 06:16:02 UTC 2004


The latest -mm removes the page->list field, so we're going to have to
make changes to dm-io and kcopyd.

- Joe


dm-io: stop using page->list
--- diff/drivers/md/dm-io.c	2004-03-11 11:15:07.000000000 +0000
+++ source/drivers/md/dm-io.c	2004-03-11 11:15:58.000000000 +0000
@@ -373,25 +373,26 @@ void list_get_page(struct dpages *dp,
 		  struct page **p, unsigned long *len, unsigned *offset)
 {
 	unsigned o = dp->context_u;
+	struct page_list *pl = (struct page_list *) dp->context_ptr;
 
-	*p = (struct page *) dp->context_ptr;
+	*p = pl->page;
 	*len = PAGE_SIZE - o;
 	*offset = o;
 }
 
 void list_next_page(struct dpages *dp)
 {
-	struct page *page = (struct page *) dp->context_ptr;
-	dp->context_ptr = list_entry(page->list.next, struct page, list);
+	struct page_list *pl = (struct page_list *) dp->context_ptr;
+	dp->context_ptr = pl->next;
 	dp->context_u = 0;
 }
 
-void list_dp_init(struct dpages *dp, struct page *page, unsigned offset)
+void list_dp_init(struct dpages *dp, struct page_list *pl, unsigned offset)
 {
 	dp->get_page = list_get_page;
 	dp->next_page = list_next_page;
 	dp->context_u = offset;
-	dp->context_ptr = page;
+	dp->context_ptr = pl;
 }
 
 /*
@@ -537,11 +538,11 @@ int async_io(unsigned int num_regions, s
 }
 
 int dm_io_sync(unsigned int num_regions, struct io_region *where, int rw,
-	       struct page *pages, unsigned int offset,
+	       struct page_list *pl, unsigned int offset,
 	       unsigned long *error_bits)
 {
 	struct dpages dp;
-	list_dp_init(&dp, pages, offset);
+	list_dp_init(&dp, pl, offset);
 	return sync_io(num_regions, where, rw, &dp, error_bits);
 }
 
@@ -554,11 +555,11 @@ int dm_io_sync_bvec(unsigned int num_reg
 }
 
 int dm_io_async(unsigned int num_regions, struct io_region *where, int rw,
-		struct page *pages, unsigned int offset,
+		struct page_list *pl, unsigned int offset,
 		io_notify_fn fn, void *context)
 {
 	struct dpages dp;
-	list_dp_init(&dp, pages, offset);
+	list_dp_init(&dp, pl, offset);
 	return async_io(num_regions, where, rw, &dp, fn, context);
 }
 
--- diff/drivers/md/dm-io.h	2004-03-11 11:15:07.000000000 +0000
+++ source/drivers/md/dm-io.h	2004-03-11 11:15:58.000000000 +0000
@@ -18,6 +18,11 @@ struct io_region {
 	sector_t count;
 };
 
+struct page_list {
+	struct page_list *next;
+	struct page *page;
+};
+
 
 /*
  * 'error' is a bitset, with each bit indicating whether an error
@@ -36,7 +41,6 @@ typedef void (*io_notify_fn)(unsigned lo
 int dm_io_get(unsigned int num_pages);
 void dm_io_put(unsigned int num_pages);
 
-
 /*
  * Synchronous IO.
  *
@@ -45,7 +49,7 @@ void dm_io_put(unsigned int num_pages);
  * regions with a zero count field will be ignored.
  */
 int dm_io_sync(unsigned int num_regions, struct io_region *where, int rw,
-	       struct page *pages, unsigned int offset,
+	       struct page_list *pl, unsigned int offset,
 	       unsigned long *error_bits);
 
 int dm_io_sync_bvec(unsigned int num_regions, struct io_region *where, int rw,
@@ -59,7 +63,7 @@ int dm_io_sync_bvec(unsigned int num_reg
  * the function takes a copy.
  */
 int dm_io_async(unsigned int num_regions, struct io_region *where, int rw,
-		struct page *pages, unsigned int offset,
+		struct page_list *pl, unsigned int offset,
 		io_notify_fn fn, void *context);
 
 int dm_io_async_bvec(unsigned int num_regions, struct io_region *where, int rw,




More information about the dm-devel mailing list