[Devel] [PATCH RHEL7 COMMIT] ploop: Introduce local variable in ploop_start()

Konstantin Khorenko khorenko at virtuozzo.com
Wed Mar 6 14:22:50 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 255fd9a03bcda29cca263963e1090c5342fd44db
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Wed Mar 6 14:22:47 2019 +0300

    ploop: Introduce local variable in ploop_start()
    
    It is so easy not to hate a reader and to introduce
    a local variable for repeating patterns.
    
    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/dev.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index df35c4d011ec..060aa8bcdfde 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -3978,9 +3978,9 @@ static int ploop_bd_full(struct backing_dev_info *bdi, long long nr, int root)
 
 static int ploop_start(struct ploop_device * plo, struct block_device *bdev)
 {
-	int err;
 	struct ploop_delta * top_delta, * delta;
-	int i;
+	struct request_queue *q = plo->queue;
+	int i, err;
 
 	if (test_bit(PLOOP_S_RUNNING, &plo->state))
 		return -EBUSY;
@@ -4018,22 +4018,22 @@ static int ploop_start(struct ploop_device * plo, struct block_device *bdev)
 	/* Deltas are ready. Enable block device. */
 	set_device_ro(bdev, (top_delta->flags & PLOOP_FMT_RDONLY) != 0);
 
-	blk_queue_make_request(plo->queue, ploop_make_request);
-	plo->queue->queuedata = plo;
-	plo->queue->backing_dev_info.congested_fn = ploop_congested;
-	plo->queue->backing_dev_info.congested_fn2 = ploop_congested2;
-	plo->queue->backing_dev_info.bd_full_fn = ploop_bd_full;
-	plo->queue->backing_dev_info.congested_data = plo;
+	blk_queue_make_request(q, ploop_make_request);
+	q->queuedata = plo;
+	q->backing_dev_info.congested_fn = ploop_congested;
+	q->backing_dev_info.congested_fn2 = ploop_congested2;
+	q->backing_dev_info.bd_full_fn = ploop_bd_full;
+	q->backing_dev_info.congested_data = plo;
 
-	blk_queue_merge_bvec(plo->queue, ploop_merge_bvec);
-	blk_queue_flush(plo->queue, REQ_FLUSH);
+	blk_queue_merge_bvec(q, ploop_merge_bvec);
+	blk_queue_flush(q, REQ_FLUSH);
 
 	if (top_delta->io.ops->queue_settings)
-		top_delta->io.ops->queue_settings(&top_delta->io, plo->queue);
+		top_delta->io.ops->queue_settings(&top_delta->io, q);
 
-	blk_queue_max_discard_sectors(plo->queue, INT_MAX);
-	queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, plo->queue);
-	queue_flag_clear_unlocked(QUEUE_FLAG_STANDBY, plo->queue);
+	blk_queue_max_discard_sectors(q, INT_MAX);
+	queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q);
+	queue_flag_clear_unlocked(QUEUE_FLAG_STANDBY, q);
 
 	set_capacity(plo->disk, plo->bd_size);
 	bd_set_size(bdev, (loff_t)plo->bd_size << 9);



More information about the Devel mailing list