[Devel] [PATCH RHEL7 COMMIT] ploop: Add local variable into dio_submit()

Konstantin Khorenko khorenko at virtuozzo.com
Wed Mar 6 14:22:46 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.1.3.vz7.93.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.1.3.vz7.83.17
------>
commit 08f900bf00c6aeefb026ff2cee314519d93aee19
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Wed Mar 6 14:22:44 2019 +0300

    ploop: Add local variable into dio_submit()
    
    This reduces amount of code.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    =====================
    Patchset description:
    
    ploop: Add online discard support for dio engine
    
    The first part of patchset is preparations to make code
    a bit readable.
    
    The second part adds online discard support for dio engine.
    DIO engine tracks entents, so discard code will use that
    for its needs.
    
    https://pmc.acronis.com/browse/VSTOR-19972
    
    Kirill Tkhai (12):
          ploop: introduce dio_may_fallocate() helper
          ploop: Export whole_block()
          ploop: Add cluster_size_in_bytes() helper
          ploop: Add cluster_size_in_sec() helper
          ploop: Add local variable into dio_submit()
          ploop: Add cluster_log local variable
          ploop: Add trim_extent_mappings_tail() helper
          ploop: Introduce local variable in ploop_start()
          ploop: Never merge discard requests
          ploop: Set up discard limits
          ploop: Introduce ploop_can_issue_discard() helper
          ploop: Online discard support for dio engine
---
 drivers/block/ploop/io_direct.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 775ab7f64c03..3e207a7b9ff5 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -85,10 +85,11 @@ static int cached_submit(struct ploop_io *io, iblock_t iblk,
 	      struct bio_list * sbl, unsigned int size, bool use_prealloc);
 
 static void
-dio_submit(struct ploop_io *io, struct ploop_request * preq,
+dio_submit(struct ploop_io *io, struct ploop_request *preq,
 	   unsigned long rw,
 	   struct bio_list *sbl, iblock_t iblk, unsigned int size)
 {
+	struct ploop_device *plo = io->plo;
 	struct bio_list bl;
 	struct bio * bio = NULL;
 	struct extent_map * em;
@@ -121,15 +122,15 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq,
 	}
 
 	sec = sbl->head->bi_sector;
-	sec = ((sector_t)iblk << preq->plo->cluster_log) | (sec & ((1<<preq->plo->cluster_log) - 1));
+	sec = ((sector_t)iblk << plo->cluster_log) | (sec & ((1<<plo->cluster_log) - 1));
 
 	em = extent_lookup_create(io, sec, size);
 	if (IS_ERR(em))
 		goto out_em_err;
 
 	if (write && em->uninit) {
-		sector_t end = (sector_t)(iblk + 1) << preq->plo->cluster_log;
-		sec = (sector_t)iblk << preq->plo->cluster_log;
+		sector_t end = (sector_t)(iblk + 1) << plo->cluster_log;
+		sec = (sector_t)iblk << plo->cluster_log;
 
 		if (em->start <= sec)
 			sec = em->end;
@@ -236,7 +237,7 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq,
 		b->bi_private = preq;
 		b->bi_end_io = dio_endio_async;
 
-		ploop_acc_ff_out(preq->plo, rw2 | b->bi_rw);
+		ploop_acc_ff_out(plo, rw2 | b->bi_rw);
 		submit_bio(rw2, b);
 	}
 
@@ -249,9 +250,9 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq,
 	goto out;
 
 write_unint:
-	spin_lock_irq(&preq->plo->lock);
+	spin_lock_irq(&plo->lock);
 	ploop_add_lockout(preq, 0);
-	spin_unlock_irq(&preq->plo->lock);
+	spin_unlock_irq(&plo->lock);
 
 	err = cached_submit(io, iblk, preq, sbl, size, false);
 	goto out;
@@ -259,7 +260,7 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq,
 write_unint_fail:
 	ploop_extent_put(em);
 	err = -EIO;
-	ploop_msg_once(io->plo, "A part of cluster is in uninitialized extent.");
+	ploop_msg_once(plo, "A part of cluster is in uninitialized extent.");
 	goto out;
 
 out_em_err:



More information about the Devel mailing list