[Devel] [PATCH RHEL8 COMMIT] ploop: Do not iterate excess clusters in notify_delta_merged()
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Jul 2 22:43:32 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.6.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.el8
------>
commit bd47d2d281205c6ae95697f91a4286b3201de22b
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Fri Jul 2 22:43:32 2021 +0300
ploop: Do not iterate excess clusters in notify_delta_merged()
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
==========================
Parallel async BAT pages submission and improvements
[1-15]:
https://jira.sw.ru/browse/PSBM-124550
[16-22]:
following improvements
Kirill Tkhai (22):
ploop: Remove absolet comment
ploop: Add md and piwb cross pointers
ploop: Add @md argument to locate_new_cluster_and_attach_pio()
ploop: Refactoring in process_one_discard_pio()
ploop: Pass type argument to ploop_prepare_bat_update()
ploop: Move md is busy check to delay_if_md_busy()
ploop: Introduce batch list for md pages writeback
ploop: Check for md dirty instead of md piwb
ploop: Reread piwb after ploop_prepare_bat_update()
ploop: Change argument in ploop_prepare_bat_update()
ploop: Return md from ploop_prepare_reloc_index_wb()
ploop: Change arguments and rename ploop_reset_bat_update()
ploop: Allow parallel wb of md pages
ploop: Async md writeback
ploop: Rename ploop_submit_index_wb_sync()
ploop: Resubmit pios from main kwork
ploop: Rename process_delta_wb()
ploop: Do fsync after bat page write
ploop: Do not iterate excess clusters in notify_delta_merged()
ploop: Use kvec in ploop_delta_check_header()
ploop: Add argument to ploop_read_delta_metadata()
ploop: Underline clu and page is u32
---
drivers/md/dm-ploop-cmd.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 00cb83345853..0bfd759347a8 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -684,13 +684,15 @@ static int ploop_merge_latest_snapshot(struct ploop *ploop)
return ret;
}
-static void notify_delta_merged(struct ploop *ploop, u8 level,
- void *hdr, bool forward)
+static void notify_delta_merged(struct ploop *ploop, u8 level, void *hdr,
+ bool forward, u32 size_in_clus)
{
unsigned int i, end, *bat_entries, *delta_bat_entries;
struct rb_node *node;
struct md_page *md;
struct file *file;
+ bool stop = false;
+ u32 clu;
/* Points to hdr since md_page[0] also contains hdr. */
delta_bat_entries = (map_index_t *)hdr;
@@ -700,6 +702,12 @@ static void notify_delta_merged(struct ploop *ploop, u8 level,
init_bat_entries_iter(ploop, md->id, &i, &end);
bat_entries = kmap_atomic(md->page);
for (; i <= end; i++) {
+ clu = page_clu_idx_to_bat_clu(md->id, i);
+ if (clu >= size_in_clus) {
+ stop = true;
+ goto unmap;
+ }
+
if (md_page_cluster_is_in_top_delta(ploop, md, i) ||
delta_bat_entries[i] == BAT_ENTRY_NONE ||
md->bat_levels[i] < level)
@@ -721,7 +729,10 @@ static void notify_delta_merged(struct ploop *ploop, u8 level,
if (!forward)
md->bat_levels[i]--;
}
+unmap:
kunmap_atomic(bat_entries);
+ if (stop)
+ break;
delta_bat_entries += PAGE_SIZE / sizeof(map_index_t);
}
@@ -767,22 +778,25 @@ static int process_update_delta_index(struct ploop *ploop, u8 level,
static int ploop_delta_clusters_merged(struct ploop *ploop, u8 level,
bool forward)
{
- void *d_hdr = NULL;
+ struct ploop_pvd_header *d_hdr = NULL;
struct file *file;
+ u32 size_in_clus;
int ret;
/* Reread BAT of deltas[@level + 1] (or [@level - 1]) */
file = ploop->deltas[level + forward ? 1 : -1].file;
- ret = ploop_read_delta_metadata(ploop, file, &d_hdr);
+ ret = ploop_read_delta_metadata(ploop, file, (void *)&d_hdr);
if (ret)
goto out;
+ size_in_clus = le32_to_cpu(d_hdr->m_Size);
+
ret = ploop_suspend_submitting_pios(ploop);
if (ret)
goto out;
- notify_delta_merged(ploop, level, d_hdr, forward);
+ notify_delta_merged(ploop, level, d_hdr, forward, size_in_clus);
ploop_resume_submitting_pios(ploop);
ret = 0;
More information about the Devel
mailing list