[dm-devel] [PATCH] dm-io: reserve just one bioset structure

Mikulas Patocka mpatocka at redhat.com
Thu May 19 16:57:41 UTC 2011


dm-io: reserve just one bioset structure

The number 16 was "magic" and meaningless. This patch changes it to reserve just
one "struct bio", which is the minimum required.

If there is no memory pressure, the code can allocate arbitrary number of bios.

If there is memory pressure, the code can allocate just one bio. The code in
"do_region" contains a loop, it allocates a bio, fills it and submits it. If we
have just one bio available, the code wouldn't deadlock, it would just wait
with the allocation of next bio until the previous bio finished.

Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>

---
 drivers/md/dm-io.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.39-rc7-fast/drivers/md/dm-io.c
===================================================================
--- linux-2.6.39-rc7-fast.orig/drivers/md/dm-io.c	2011-05-18 20:51:32.000000000 +0200
+++ linux-2.6.39-rc7-fast/drivers/md/dm-io.c	2011-05-18 20:51:37.000000000 +0200
@@ -57,7 +57,7 @@ struct dm_io_client *dm_io_client_create
 	if (!client->pool)
 		goto bad;
 
-	client->bios = bioset_create(16, 0);
+	client->bios = bioset_create(1, 0);
 	if (!client->bios)
 		goto bad;
 




More information about the dm-devel mailing list