[Devel] [PATCH RHEL7 COMMIT] ploop: zero blocks on reuse
Konstantin Khorenko
khorenko at odin.com
Mon May 18 21:27:08 PDT 2015
The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.1
------>
commit 0bcaae57a549bf27c085db4bba6e10bce9fd4c55
Author: Andrey Smetanin <asmetanin at virtuozzo.com>
Date: Tue May 19 08:27:08 2015 +0400
ploop: zero blocks on reuse
There is a check_zero feature allowing to skip zero writes if image-block
is not allocated yet for given preq->req_cluster. But this means that inner-fs
will hope to read zero from that range afterwards. Hence, while allocating
the image-block we *must* zero it. We always do so in submit_alloc, but the
implementation of free-block-reuse ended up in submit, not submit_alloc.
https://jira.sw.ru/browse/PSBM-25391
Signed-off-by: Maxim Patlasov <MPatlasov at parallels.com>
---
drivers/block/ploop/dev.c | 33 ++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 2e6302f..9aaab4a 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -2335,9 +2335,36 @@ restart:
preq->eng_state = PLOOP_E_DATA_WBI;
top_delta = ploop_top_delta(plo);
plo->st.bio_out++;
- top_delta->io.ops->submit(&top_delta->io, preq, preq->req_rw,
- &preq->bl, preq->iblock,
- preq->req_size);
+ if (whole_block(plo, preq)) {
+ top_delta->io.ops->submit(&top_delta->io, preq, preq->req_rw,
+ &preq->bl, preq->iblock,
+ preq->req_size);
+ } else {
+ struct bio_list sbl;
+ struct bio * b;
+ int i;
+
+ if (!preq->aux_bio)
+ preq->aux_bio = bio_alloc(GFP_NOFS, block_vecs(plo));
+
+ if (!preq->aux_bio ||
+ fill_bio(plo, preq->aux_bio, preq->req_cluster)) {
+ ploop_fail_immediate(preq, -ENOMEM);
+ break;
+ }
+
+ for (i = 0; i < preq->aux_bio->bi_vcnt; i++)
+ memset(page_address(preq->aux_bio->bi_io_vec[i].bv_page),
+ 0, PAGE_SIZE);
+
+ bio_list_for_each(b, &preq->bl) {
+ bio_bcopy(preq->aux_bio, b, plo);
+ }
+
+ sbl.head = sbl.tail = preq->aux_bio;
+ top_delta->io.ops->submit(&top_delta->io, preq, preq->req_rw,
+ &sbl, preq->iblock, 1<<plo->cluster_log);
+ }
break;
}
case PLOOP_E_DELTA_ZERO_INDEX:
More information about the Devel
mailing list