[Devel] [PATCH rh7 2/3] ploop: factor out add preq to fsync_queue
Maxim Patlasov
mpatlasov at virtuozzo.com
Wed Jul 20 19:01:35 PDT 2016
Simple re-work. No logic changed. Will be useful for the next patch.
Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
drivers/block/ploop/dev.c | 19 ++++++++++++++-----
include/linux/ploop/ploop.h | 1 +
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 3dc94ca..df3eec9 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -2028,6 +2028,19 @@ 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);
+ 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)
{
@@ -2053,11 +2066,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);
- 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 3d52f28..d8e01b6 100644
--- a/include/linux/ploop/ploop.h
+++ b/include/linux/ploop/ploop.h
@@ -809,6 +809,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