[Devel] [PATCH RHEL7 COMMIT] ploop: Never merge discard requests
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Mar 6 14:22:50 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 c47bf5c881565da951c7d3b1cca0da9406457e18
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Wed Mar 6 14:22:48 2019 +0300
ploop: Never merge discard requests
The further architecture of discard for ploop1 format
looks for me as following.
blkdev_issue_discard() splits big region into requests
of one block size ((preq->req_size == 1<<plo->cluster_log).
Then requests each other completes in a separate, so we
continue existing data ---> index_writeback scheme.
Another approach, when we try to merge writing of indexes,
which are related to one index page, does not look for me
good, since all the existing code was never written in
an assumption, that a request may iterate on different
index writing, and this will introduce more corner cases,
when we already have in ploop.
For raw format this won't introduce any changes in case
of fstrim, since fstrim sends a request of maximum free
space it sees at a moment. This will touch only online
discard option for ext4, when freed block is not big enough,
but it still will be discardable via fstrim.
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 | 8 +++-----
include/linux/ploop/ploop.h | 2 +-
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 060aa8bcdfde..9ac436201b1b 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -288,9 +288,7 @@ static void preq_set_sync_bit(struct ploop_request * preq)
static struct rb_root *req_entry_tree(struct ploop_device *plo, unsigned rw)
{
- if (rw & REQ_DISCARD)
- return plo->entry_tree + 2;
- else if (rw & REQ_WRITE)
+ if (rw & REQ_WRITE)
return plo->entry_tree + 1;
return plo->entry_tree + 0;
}
@@ -597,7 +595,7 @@ ploop_bio_queue(struct ploop_device * plo, struct bio * bio,
plo->bio_qlen--;
ploop_entry_add(plo, preq);
- if (bio->bi_size && !(preq->state & (1 << PLOOP_REQ_DISCARD)))
+ if (bio->bi_size && !(bio->bi_rw & REQ_DISCARD))
insert_entry_tree(plo, preq, drop_list);
trace_bio_queue(preq);
@@ -5325,7 +5323,7 @@ static struct ploop_device *__ploop_dev_alloc(int index)
plo->freeze_timer.function = freeze_timeout;
plo->freeze_timer.data = (unsigned long)plo;
INIT_LIST_HEAD(&plo->entry_queue);
- plo->entry_tree[0] = plo->entry_tree[1] = plo->entry_tree[2] = RB_ROOT;
+ plo->entry_tree[0] = plo->entry_tree[1] = RB_ROOT;
plo->lockout_tree = RB_ROOT;
plo->lockout_pb_tree = RB_ROOT;
INIT_LIST_HEAD(&plo->ready_queue);
diff --git a/include/linux/ploop/ploop.h b/include/linux/ploop/ploop.h
index 58154219d7cb..71a55573bdf6 100644
--- a/include/linux/ploop/ploop.h
+++ b/include/linux/ploop/ploop.h
@@ -382,7 +382,7 @@ struct ploop_device
int bio_qlen;
int bio_total;
- struct rb_root entry_tree[3];
+ struct rb_root entry_tree[2];
struct list_head ready_queue;
More information about the Devel
mailing list