[Devel] [PATCH RHEL8 COMMIT] ploop: Fix prealloc_md_pages() defaults
Konstantin Khorenko
khorenko at virtuozzo.com
Tue May 11 18:30:58 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.27
------>
commit 8518a5c9140bf4d0d4af2534aa9bbf6196783a29
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Tue May 11 18:30:58 2021 +0300
ploop: Fix prealloc_md_pages() defaults
Here should be BAT_ENTRY_NONE
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
=====================
Patchset description:
ploop: Preparation to kill-loop from dm-ploop (series 4)
Currently, ploop requires underlining loop for top delta. This is overkill,
since we may submit bios directly to fs, without using it.
Initially there was a possibility, we may use device-mapper format snapshots
instead of ploop-based. But we don't do that, so we have to use loop for top
delta and directly submit bios to the rest of deltas. So, these two ways to do
the same actions are wrong.
This is preparations #3 for further series.
Let's this goes to testing earlier.
Kirill Tkhai (8):
ploop: Fix prealloc_md_pages() defaults
ploop: Move alloc wq up
ploop: Pass nr_deltas to parse_bat_entries()
ploop: Pass @ploop to md_page_cluster_is_in_top_delta()
ploop: Kill "message snapshot" interface
ploop: Introduce top_level()
ploop: Do not try to track bios on resize
ploop: Make fields in dm_ploop_endio_hook separate
https://jira.sw.ru/browse/PSBM-123654
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/md/dm-ploop-bat.c | 2 +-
drivers/md/dm-ploop-map.c | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-ploop-bat.c b/drivers/md/dm-ploop-bat.c
index 5ebb05438e2a..1c2357a21673 100644
--- a/drivers/md/dm-ploop-bat.c
+++ b/drivers/md/dm-ploop-bat.c
@@ -107,7 +107,7 @@ int prealloc_md_pages(struct rb_root *root, unsigned int nr_bat_entries,
if (!md)
return -ENOMEM;
addr = kmap_atomic(md->page);
- memset(addr, 0, PAGE_SIZE);
+ memset32(addr, BAT_ENTRY_NONE, PAGE_SIZE / 4);
kunmap_atomic(addr);
__md_page_insert(root, md);
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 9dcfe138dc54..bba578e8c219 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -709,6 +709,7 @@ static int ploop_prepare_bat_update(struct ploop *ploop, unsigned int page_nr,
struct ploop_index_wb *piwb)
{
unsigned int i, off, last, *bat_entries;
+ bool is_last_page = true;
struct md_page *md;
struct page *page;
struct bio *bio;
@@ -739,8 +740,10 @@ static int ploop_prepare_bat_update(struct ploop *ploop, unsigned int page_nr,
/* Last and first index in copied page */
last = ploop->nr_bat_entries - off;
- if (last > PAGE_SIZE / sizeof(map_index_t))
+ if (last > PAGE_SIZE / sizeof(map_index_t)) {
last = PAGE_SIZE / sizeof(map_index_t);
+ is_last_page = false;
+ }
i = 0;
if (!page_nr)
i = PLOOP_MAP_OFFSET;
@@ -751,6 +754,11 @@ static int ploop_prepare_bat_update(struct ploop *ploop, unsigned int page_nr,
continue;
to[i] = 0;
}
+ if (is_last_page) {
+ /* Fill tail of page with 0 */
+ for (i = last; i < PAGE_SIZE / sizeof(map_index_t); i++)
+ to[i] = 0;
+ }
kunmap_atomic(to);
kunmap_atomic(bat_entries);
More information about the Devel
mailing list