[Devel] [PATCH RHEL8 COMMIT] ploop: Introduce ploop_init_be_iter()
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Jul 2 22:51:52 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.51
------>
commit d225d83e7c1b00a8c08b8fcdfa5d836e756e0375
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Fri Jul 2 22:51:52 2021 +0300
ploop: Introduce ploop_init_be_iter()
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
==========================
ploop: Stop using kvec
We can't read using kvec from file open with O_DIRECT.
This makes ploop to stop use it.
Kirill Tkhai (8):
ploop: Read metadata page-aligned
ploop: RAW image does not have header
ploop: Introduce ploop_init_be_iter()
ploop: Introduce rb_root_for_each_md_page()
ploop: Introduce md helpers
ploop: Stop using kvec
ploop: Kill dead check
ploop: Shorten delta_bat_entries
---
drivers/md/dm-ploop-bat.c | 2 +-
drivers/md/dm-ploop-cmd.c | 12 ++++++------
drivers/md/dm-ploop.h | 14 ++++++++++----
3 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/drivers/md/dm-ploop-bat.c b/drivers/md/dm-ploop-bat.c
index 6fb5cdc5c749..a3abf1f509ef 100644
--- a/drivers/md/dm-ploop-bat.c
+++ b/drivers/md/dm-ploop-bat.c
@@ -442,7 +442,7 @@ static void apply_delta_mappings(struct ploop *ploop, struct ploop_delta *deltas
memcpy(bat_entries, hdr, sizeof(struct ploop_pvd_header));
}
- init_bat_entries_iter(ploop, md->id, &i, &end);
+ ploop_init_be_iter(ploop, md->id, &i, &end);
for (; i <= end; i++) {
clu = page_clu_idx_to_bat_clu(md->id, i);
diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 64e46d1b39f0..9406a1d61000 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -40,7 +40,7 @@ static void ploop_advance_holes_bitmap(struct ploop *ploop,
set_bit(i, ploop->holes_bitmap);
swap(cmd->resize.hb_nr, ploop->hb_nr);
ploop_for_each_md_page(ploop, md, node) {
- init_bat_entries_iter(ploop, md->id, &i, &end);
+ ploop_init_be_iter(ploop, md->id, &i, &end);
bat_entries = kmap_atomic(md->page);
for (; i <= end; i++) {
if (!md_page_cluster_is_in_top_delta(ploop, md, i))
@@ -151,7 +151,7 @@ static u32 ploop_find_bat_entry(struct ploop *ploop, u32 dst_clu, bool *is_locke
read_lock_irq(&ploop->bat_rwlock);
ploop_for_each_md_page(ploop, md, node) {
- init_bat_entries_iter(ploop, md->id, &i, &end);
+ ploop_init_be_iter(ploop, md->id, &i, &end);
bat_entries = kmap_atomic(md->page);
for (; i <= end; i++) {
if (bat_entries[i] != dst_clu)
@@ -695,7 +695,7 @@ static void notify_delta_merged(struct ploop *ploop, u8 level, void *hdr,
write_lock_irq(&ploop->bat_rwlock);
ploop_for_each_md_page(ploop, md, node) {
- init_bat_entries_iter(ploop, md->id, &i, &end);
+ ploop_init_be_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);
@@ -918,7 +918,7 @@ static int process_flip_upper_deltas(struct ploop *ploop)
/* Flip bat entries */
ploop_for_each_md_page(ploop, md, node) {
- init_bat_entries_iter(ploop, md->id, &i, &end);
+ ploop_init_be_iter(ploop, md->id, &i, &end);
bat_entries = kmap_atomic(md->page);
for (; i <= end; i++) {
if (bat_entries[i] == BAT_ENTRY_NONE)
@@ -957,7 +957,7 @@ static int process_tracking_start(struct ploop *ploop, void *tracking_bitmap,
nr = 0;
ploop_for_each_md_page(ploop, md, node) {
- init_bat_entries_iter(ploop, md->id, &i, &end);
+ ploop_init_be_iter(ploop, md->id, &i, &end);
bat_entries = kmap_atomic(md->page);
for (; i <= end; i++) {
dst_clu = bat_entries[i];
@@ -1019,7 +1019,7 @@ static u32 max_dst_clu_in_top_delta(struct ploop *ploop)
read_lock_irq(&ploop->bat_rwlock);
ploop_for_each_md_page(ploop, md, node) {
- init_bat_entries_iter(ploop, md->id, &i, &end);
+ ploop_init_be_iter(ploop, md->id, &i, &end);
bat_entries = kmap_atomic(md->page);
for (; i <= end; i++) {
if (dst_clu < bat_entries[i] &&
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 3746443c3325..48ad2be49468 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -463,10 +463,10 @@ static inline bool md_page_cluster_is_in_top_delta(struct ploop *ploop,
return ret;
}
-static inline void init_bat_entries_iter(struct ploop *ploop, u32 page_id,
- u32 *start, u32 *end)
+static inline void init_be_iter(u32 nr_be, u32 page_id,
+ u32 *start, u32 *end)
{
- u32 last_page = bat_clu_to_page_nr(ploop->nr_bat_entries - 1);
+ u32 last_page = bat_clu_to_page_nr(nr_be - 1);
unsigned int count = PAGE_SIZE / sizeof(map_index_t);
*start = 0;
@@ -475,7 +475,13 @@ static inline void init_bat_entries_iter(struct ploop *ploop, u32 page_id,
*end = count - 1;
if (page_id == last_page)
- *end = ((ploop->nr_bat_entries + PLOOP_MAP_OFFSET) % count) - 1;
+ *end = ((nr_be + PLOOP_MAP_OFFSET) % count) - 1;
+}
+
+static inline void ploop_init_be_iter(struct ploop *ploop, u32 page_id,
+ u32 *start, u32 *end)
+{
+ init_be_iter(ploop->nr_bat_entries, page_id, start, end);
}
extern void __track_pio(struct ploop *ploop, struct pio *pio);
More information about the Devel
mailing list