[Devel] [PATCH RHEL8 COMMIT] ploop: Refactor ploop_ctr()

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jun 17 19:01:03 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.44
------>
commit c5bed97356c6fd53ab2b68639317ea7ac514c044
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Jun 17 19:01:03 2021 +0300

    ploop: Refactor ploop_ctr()
    
    Remove useless ti->error for ENOMEM. ENOMEM is ENOMEM
    and it's enought. Group allocations together.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    =====================
    Patchset description:
    
    ploop: Allow to resubmit partially completed request
    
    This allows to continue submitting partially completed requests.
    
    https://jira.sw.ru/browse/PSBM-127225
    
    Kirill Tkhai (18):
          ploop: Simplify ploop_write_cluster_sync()
          ploop: Rename hook->pio, h->pio, ploop_cow::hook->aux_pio
          ploop: Rename force_link_inflight_bios
          ploop: Introduce separate lock for inflight pios
          ploop: Use hlist instead of rbtree
          ploop: Always link submitted pios
          ploop: Unexport ploop_inflight_bios_ref_switch()
          ploop: Refactor submit_pio()
          ploop: Introduce ploop_suspend_submitting_pios
          ploop: Refactor ploop_ctr()
          ploop: Use ploop_call_rw_iter() in submit_delta_read()
          ploop: Generalize submit_rw_mapped()
          ploop: Kill submit_delta_read()
          ploop: Rename submit_rw_mapped()
          ploop: Extract submit_rw_mapped() to separate function
          ploop: Save level before submitting pio
          ploop: Make fsync work be able to run in parallel with main work
          ploop: Introduce resubmitting partially completed pios
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-target.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index 5af682dc2ea4..71bda7026482 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -286,10 +286,8 @@ static int ploop_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		return -EINVAL;
 
 	ploop = kzalloc(sizeof(*ploop), GFP_KERNEL);
-	if (!ploop) {
-		ti->error = "Error allocating ploop structure";
+	if (!ploop)
 		return -ENOMEM;
-	}
 
 	ploop->exclusive_pios = kcalloc(PLOOP_HASH_TABLE_SIZE,
 					sizeof(struct hlist_head),
@@ -324,11 +322,16 @@ static int ploop_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		if (percpu_ref_init(&ploop->inflight_bios_ref[i], release,
 				    PERCPU_REF_ALLOW_REINIT, GFP_KERNEL)) {
 			ret = -ENOMEM;
-			ti->error = "could not alloc percpu_ref";
 			goto err;
 		}
 	}
 
+	ploop->wq = alloc_ordered_workqueue("dm-" DM_MSG_PREFIX, WQ_MEM_RECLAIM);
+	if (!ploop->wq) {
+		ret = -ENOMEM;
+		goto err;
+	}
+
 	ti->private = ploop;
 	ploop->ti = ti;
 
@@ -343,13 +346,6 @@ static int ploop_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		goto err;
 	}
 
-	ploop->wq = alloc_ordered_workqueue("dm-" DM_MSG_PREFIX, WQ_MEM_RECLAIM);
-	if (!ploop->wq) {
-		ti->error = "could not create workqueue for metadata object";
-		ret = -ENOMEM;
-		goto err;
-	}
-
 	ret = ploop_add_deltas_stack(ploop, &argv[1], argc - 1);
 	if (ret)
 		goto err;


More information about the Devel mailing list