[Devel] [PATCH RHEL7 COMMIT] ploop: factor out add preq to fsync_queue

Konstantin Khorenko khorenko at virtuozzo.com
Tue Aug 9 01:40:41 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.22.2.vz7.16.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.22.2.vz7.16.3
------>
commit 7ad91548fcd48668ec9ae6a5028790a18c9211ab
Author: Maxim Patlasov <mpatlasov at virtuozzo.com>
Date:   Tue Aug 9 12:40:40 2016 +0400

    ploop: factor out add preq to fsync_queue
    
    Simple re-work. No logic changed. Will be useful for the next patch.
    
    Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
    Acked-by: Dmitry Monakhov <dmonakhov at openvz.org>
    
    Changes khorenko@: moved
    	top_io->fsync_qlen++;
    to ploop_add_req_to_fsync_queue() as well.
---
 drivers/block/ploop/dev.c   | 21 +++++++++++++++------
 include/linux/ploop/ploop.h |  1 +
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 98fae18..5775c16 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -2081,6 +2081,20 @@ static inline bool preq_is_special(struct ploop_request * preq)
 			PLOOP_REQ_ZERO_FL);
 }
 
+void ploop_add_req_to_fsync_queue(struct ploop_request * preq)
+{
+	struct ploop_device * plo       = preq->plo;
+	struct ploop_delta  * top_delta = ploop_top_delta(plo);
+	struct ploop_io     * top_io    = &top_delta->io;
+
+	spin_lock_irq(&plo->lock);
+	list_add_tail(&preq->list, &top_io->fsync_queue);
+	top_io->fsync_qlen++;
+	if (waitqueue_active(&top_io->fsync_waitq))
+		wake_up_interruptible(&top_io->fsync_waitq);
+	spin_unlock_irq(&plo->lock);
+}
+
 static void
 ploop_entry_request(struct ploop_request * preq)
 {
@@ -2106,12 +2120,7 @@ ploop_entry_request(struct ploop_request * preq)
 		if ((preq->req_rw & REQ_FLUSH) &&
 		    test_bit(PLOOP_IO_FSYNC_DELAYED, &top_io->io_state) &&
 		    !test_bit(PLOOP_REQ_FSYNC_DONE, &preq->state)) {
-			spin_lock_irq(&plo->lock);
-			list_add_tail(&preq->list, &top_io->fsync_queue);
-			top_io->fsync_qlen++;
-			if (waitqueue_active(&top_io->fsync_waitq))
-				wake_up_interruptible(&top_io->fsync_waitq);
-			spin_unlock_irq(&plo->lock);
+			ploop_add_req_to_fsync_queue(preq);
 			return;
 		}
 
diff --git a/include/linux/ploop/ploop.h b/include/linux/ploop/ploop.h
index f9cd4a1..be7d9f7 100644
--- a/include/linux/ploop/ploop.h
+++ b/include/linux/ploop/ploop.h
@@ -820,6 +820,7 @@ void ploop_index_update(struct ploop_request * preq);
 void ploop_index_wb_complete(struct ploop_request * preq);
 int __init ploop_map_init(void);
 void ploop_map_exit(void);
+void ploop_add_req_to_fsync_queue(struct ploop_request * preq);
 
 
 void ploop_quiesce(struct ploop_device * plo);


More information about the Devel mailing list