Skip to contentSkip to conversation

Remove BIOSET_NEED_RESCUER from some DM biosets

PATCH New NeilBrown 1 participant 3 messages Aug 29, 2017 Device mapper

lore
Share & tools
lore

NeilBrown

author
#0 lore raw

cover Remove BIOSET_NEED_RESCUER from some DM biosets

hi,
I'm working towards the bioset rescuer threads completely. Part of that is understanding where they are actually needed, and removing them where they are not.

bioset rescuer threads are only needed on a bioset where
a make_request_fn will
allocate from the bioset
submit that bio with generic_make_request
allocate again from the bioset, other then non-blocking allocation

Neither of the biosets in dm-crypt or dm-io are used with this pattern so the flag can be removed.

The bioset allocated in dm.c *is* used with this pattern, so some restructuring will be needed there before the flag can be removed.

Thanks,
NeilBrown

---

NeilBrown (2):
dm-crypt: remove BIOSET_NEED_RESCUER flag.
dm-io: remove BIOSET_NEED_RESCUER flag from bios bioset

 drivers/md/dm-crypt.c |    3 +--
 drivers/md/dm-io.c    |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

--
Signature

author
#1 lore raw

PATCH 1/2 dm-crypt: remove BIOSET_NEED_RESCUER flag.

The BIOSET_NEED_RESCUER flag is only needed when a make_request_fn might do two allocations from the one bioset, and the second one could block until the first bio completes.

dm-crypt does allocate from this bioset inside the dm make_request_fn, but does so using GFP_NOWAIT so that the allocation will not block.

So BIOSET_NEED_RESCUER is not needed.

---
 drivers/md/dm-crypt.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/md/dm-crypt.c +1 -2
index cdf6b1e12460..e7dc1a6b5a9d 100644
@@ -2696,8 +2696,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		goto bad;
 	}
 
-	cc->bs = bioset_create(MIN_IOS, 0, (BIOSET_NEED_BVECS |
-					    BIOSET_NEED_RESCUER));
+	cc->bs = bioset_create(MIN_IOS, 0, BIOSET_NEED_BVECS);
 	if (!cc->bs) {
 		ti->error = "Cannot allocate crypt bioset";
 		goto bad;
author
#2 lore raw

PATCH 2/2 dm-io: remove BIOSET_NEED_RESCUER flag from bios bioset

In reply to NeilBrown

BIOSET_NEED_RESCUER is only need on a bioset is allocations will be made inside a make_request_fn() call.

dm_io() is called from make_request_fn() context. The closest it comes is in chunk_io() in dm-snap-persistent. Here the code uses a separate thread to avoid problems.

So BIOSET_NEED_RESCUER is not needed.

---
 drivers/md/dm-io.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/md/dm-io.c +1 -2
index 25039607f3cb..bafd9f79aa3b 100644
@@ -58,8 +58,7 @@ struct dm_io_client *dm_io_client_create(void)
 	if (!client->pool)
 		goto bad;
 
-	client->bios = bioset_create(min_ios, 0, (BIOSET_NEED_BVECS |
-						  BIOSET_NEED_RESCUER));
+	client->bios = bioset_create(min_ios, 0, BIOSET_NEED_BVECS);
 	if (!client->bios)
 		goto bad;