[Devel] [PATCH RHEL7 COMMIT] ploop: Introduce ploop_can_issue_discard() helper

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

    ploop: Introduce ploop_can_issue_discard() helper
    
    Logical neighbouring blocks usually are not physically
    neighbours, so we can issue discard only for a single
    block.
    
    This is the basis. Later we may introduce some performance
    improvements for corner cases on top of this.
    
    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 | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index bf508a9b1bc8..518b52e8f0d0 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -2525,6 +2525,18 @@ ploop_entry_request(struct ploop_request * preq)
 	PLOOP_REQ_FAIL_IMMEDIATE(preq, err);
 }
 
+static bool ploop_can_issue_discard(struct ploop_device *plo,
+				    struct ploop_request *preq)
+{
+	if (test_bit(PLOOP_REQ_DISCARD, &preq->state))
+		return true;
+
+	if (test_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state))
+		return false;
+
+	return whole_block(plo, preq);
+}
+
 static void ploop_req_state_process(struct ploop_request * preq)
 {
 	struct ploop_device * plo = preq->plo;
@@ -2604,8 +2616,7 @@ static void ploop_req_state_process(struct ploop_request * preq)
 		}
 
 		if ((preq->req_rw & REQ_DISCARD) &&
-		    !test_bit(PLOOP_REQ_DISCARD, &preq->state) &&
-		    test_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state)) {
+		    !ploop_can_issue_discard(plo, preq)) {
 			preq->eng_state = PLOOP_E_COMPLETE;
 			preq->error = -EOPNOTSUPP;
 			ploop_complete_io_state(preq);



More information about the Devel mailing list