[dm-devel] Re: [PATCH] dm-rwlock.patch (Re: 2.6.4-rc1-mm1: queue-congestion-dm-implementation patch)

Joe Thornber thornber at redhat.com
Tue Mar 9 04:41:00 UTC 2004


On Tue, Mar 09, 2004 at 12:31:39AM +0100, Miquel van Smoorenburg wrote:
> I didn't test for DMF_SUSPENDED since it is only set when DMF_BLOCK_IO
> is set too. And "r = bdi_bits" is the return value for "congested".
> So I think that FIXME can be removed ?

Yep, I thought bdi_bits meant that it wasn't congested.

I also noticed that I'm not protecting the if(!md->map) in
__dm_request properly, so this patch pushes that check down into
__split_bio(), and removes __dm_request() completely.

- Joe


dm.c: remove __dm_request (merge with previous patch).
--- diff/drivers/md/dm.c	2004-03-08 15:48:05.000000000 +0000
+++ source/drivers/md/dm.c	2004-03-09 09:40:37.000000000 +0000
@@ -506,8 +506,13 @@ static void __split_bio(struct mapped_de
 {
 	struct clone_info ci;
 
-	ci.md = md;
 	ci.map = dm_get_table(md);
+	if (!ci.map) {
+		bio_io_error(bio, bio->bi_size);
+		return;
+	}
+
+	ci.md = md;
 	ci.bio = bio;
 	ci.io = alloc_io(md);
 	ci.io->error = 0;
@@ -530,17 +535,6 @@ static void __split_bio(struct mapped_de
  * CRUD END
  *---------------------------------------------------------------*/
 
-
-static inline void __dm_request(struct mapped_device *md, struct bio *bio)
-{
-	if (!md->map) {
-		bio_io_error(bio, bio->bi_size);
-		return;
-	}
-
-	__split_bio(md, bio);
-}
-
 /*
  * The request function that just remaps the bio built up by
  * dm_merge_bvec.
@@ -579,7 +573,7 @@ static int dm_request(request_queue_t *q
 		down_read(&md->lock);
 	}
 
-	__dm_request(md, bio);
+	__split_bio(md, bio);
 	up_read(&md->lock);
 	return 0;
 }
@@ -591,7 +585,6 @@ static int dm_any_congested(void *conges
 	struct dm_table *map = dm_get_table(md);
 
 	if (!map || test_bit(DMF_BLOCK_IO, &md->flags))
-		/* FIXME: shouldn't suspended count a congested ? */
 		r = bdi_bits;
 	else
 		r = dm_table_any_congested(map, bdi_bits);
@@ -850,7 +843,7 @@ static void __flush_deferred_io(struct m
 	while (c) {
 		n = c->bi_next;
 		c->bi_next = NULL;
-		__dm_request(md, c);
+		__split_bio(md, c);
 		c = n;
 	}
 }




More information about the dm-devel mailing list