[Devel] [PATCH rh7 14/38] ploop: fix check_zero optimization v2

Andrey Smetanin asmetanin at virtuozzo.com
Fri May 15 09:48:15 PDT 2015


We can skip zero writes  only if all lower deltas has no mapping for given cluser.
Let's use map_index_fault() as we do it for unaligned requests.

https://jira.sw.ru/browse/PSBM-23452

Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
Acked-by: Maxim V. Patlasov <mpatlasov at parallels.com>
---
 drivers/block/ploop/dev.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index e3422d8..0124349 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -2148,24 +2148,28 @@ delta_io:
 						      &sbl, iblk, 1<<plo->cluster_log);
 			}
 		} else {
-			if (!whole_block(plo, preq)) {
-				if (map_index_fault(preq) == 0) {
+			if (!whole_block(plo, preq) && map_index_fault(preq) == 0) {
 					__TRACE("f %p %u\n", preq, preq->req_cluster);
 					return;
-				}
-			} else {
-				plo->st.bio_alloc_whole++;
 			}
 
 			if (plo->tune.check_zeros && check_zeros(&preq->bl)) {
+				if (map_index_fault(preq) == 0) {
+					__TRACE("f %p %u\n", preq, preq->req_cluster);
+					return;
+				}
 				preq->eng_state = PLOOP_E_COMPLETE;
 				/* Not ploop_complete_request().
 				 * This can be TRANS request.
 				 */
 				ploop_complete_io_state(preq);
+				if(whole_block(plo, preq))
+					plo->st.bio_alloc_whole++;
 				plo->st.bio_wzero++;
 				return;
 			}
+			if(whole_block(plo, preq))
+				plo->st.bio_alloc_whole++;
 
 			spin_lock_irq(&plo->lock);
 			ploop_add_lockout(preq, 0);
-- 
1.9.3




More information about the Devel mailing list