[Devel] [PATCH 08/10] ploop: Zero indexes on discard
Kirill Tkhai
ktkhai at virtuozzo.com
Tue Mar 26 18:19:18 MSK 2019
Shitch preq into PLOOP_E_DATA_WBI state
to continue execution after discard's write
is finished.
Zero index in that stage.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/block/ploop/dev.c | 5 ++++-
drivers/block/ploop/fmt_ploop1.c | 5 +++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 618d22bf02ec..3ada41f91867 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -2461,7 +2461,10 @@ ploop_entry_request(struct ploop_request * preq)
spin_unlock_irq(&plo->lock);
}
preq->iblock = iblk;
- preq->eng_state = PLOOP_E_COMPLETE;
+ if (!(preq->req_rw & REQ_DISCARD))
+ preq->eng_state = PLOOP_E_COMPLETE;
+ else
+ preq->eng_state = PLOOP_E_DATA_WBI;
__TRACE("T %p %u\n", preq, preq->req_cluster);
plo->st.bio_out++;
delta->io.ops->submit(&delta->io, preq, preq->req_rw,
diff --git a/drivers/block/ploop/fmt_ploop1.c b/drivers/block/ploop/fmt_ploop1.c
index 370aa6369a8a..9cfc56296e5e 100644
--- a/drivers/block/ploop/fmt_ploop1.c
+++ b/drivers/block/ploop/fmt_ploop1.c
@@ -250,6 +250,11 @@ ploop1_allocate(struct ploop_delta * delta, struct ploop_request * preq,
static void
ploop1_allocate_complete(struct ploop_delta * delta, struct ploop_request * preq)
{
+ if ((preq->req_rw & REQ_DISCARD) &&
+ !test_bit(PLOOP_REQ_DISCARD, &preq->state)) {
+ preq->iblock = 0;
+ }
+
ploop_index_update(preq);
}
More information about the Devel
mailing list