[Devel] [PATCH rh7 2/9] ploop: minor rework of ploop_req_delay_fua_possible
Maxim Patlasov
mpatlasov at virtuozzo.com
Thu Jun 23 22:39:07 PDT 2016
No functional changes. The patch simplifies ploop_req_delay_fua_possible
to make it more suitable for next patch. As was recently discussed,
"eng_state == E_DATA_WBI" is lesser prone to errors than
"eng_state != E_COMPLETE".
Note, how the patch makes a bug in kaio_complete_io_state() obvious:
if !(preq->req_rw & REQ_FUA), it must not matter what
ploop_req_delay_fua_possible() returns! I.e., eng_state==E_COMPLETE is
not sufficient ground for post_fsync=1 if no REQ_FUA set.
Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
drivers/block/ploop/io_direct.c | 2 +-
drivers/block/ploop/io_kaio.c | 3 +--
include/linux/ploop/ploop.h | 15 ++-------------
3 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 3acae79..0907540 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -103,7 +103,7 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq,
if (test_and_clear_bit(PLOOP_REQ_FORCE_FUA, &preq->state))
postfua = 1;
- if (!postfua && ploop_req_delay_fua_possible(rw, preq)) {
+ if (!postfua && ploop_req_delay_fua_possible(preq) && (rw & REQ_FUA)) {
/* Mark req that delayed flush required */
set_bit(PLOOP_REQ_FORCE_FLUSH, &preq->state);
diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 81da1c5..69df456 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -84,8 +84,7 @@ static void kaio_complete_io_state(struct ploop_request * preq)
post_fsync = 1;
if (!post_fsync &&
- !ploop_req_delay_fua_possible(preq->req_rw, preq) &&
- (preq->req_rw & REQ_FUA))
+ !(ploop_req_delay_fua_possible(preq) && (preq->req_rw & REQ_FUA)))
post_fsync = 1;
preq->req_rw &= ~REQ_FUA;
diff --git a/include/linux/ploop/ploop.h b/include/linux/ploop/ploop.h
index 3441e7e..e1d8686 100644
--- a/include/linux/ploop/ploop.h
+++ b/include/linux/ploop/ploop.h
@@ -613,20 +613,9 @@ void ploop_preq_drop(struct ploop_device * plo, struct list_head *drop_list,
int keep_locked);
-static inline int ploop_req_delay_fua_possible(unsigned long rw,
- struct ploop_request *preq)
+static inline int ploop_req_delay_fua_possible(struct ploop_request *preq)
{
- int delay_fua = 0;
-
- /* In case of eng_state != COMPLETE, we'll do FUA in
- * ploop_index_update(). Otherwise, we should post
- * fua.
- */
- if (rw & REQ_FUA) {
- if (preq->eng_state != PLOOP_E_COMPLETE)
- delay_fua = 1;
- }
- return delay_fua;
+ return preq->eng_state == PLOOP_E_DATA_WBI;
}
static inline void ploop_req_set_error(struct ploop_request * preq, int err)
More information about the Devel
mailing list