[Devel] [PATCH RHEL8 COMMIT] ploop: Use local piwb in resize
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Jun 24 14:25:06 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.49
------>
commit d90e3f828cb32892e1ae022ba5d15edf942c04e6
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Thu Jun 24 14:25:06 2021 +0300
ploop: Use local piwb in resize
Preparation for https://jira.sw.ru/browse/PSBM-124550
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/md/dm-ploop-cmd.c | 17 ++++++++---------
drivers/md/dm-ploop-map.c | 4 ++--
drivers/md/dm-ploop.h | 4 ++--
3 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 3b80de0fd3be..44ecdb167857 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -405,12 +405,14 @@ static void ploop_add_md_pages(struct ploop *ploop, struct rb_root *from)
* This is called from deferred work -- the only place we alloc clusters.
* So, nobody can reallocate clusters updated in ploop_grow_relocate_cluster().
*/
-static void process_resize_cmd(struct ploop *ploop, struct ploop_index_wb *piwb,
- struct ploop_cmd *cmd)
+static void process_resize_cmd(struct ploop *ploop, struct ploop_cmd *cmd)
{
+ struct ploop_index_wb piwb;
unsigned int dst_cluster;
int ret = 0;
+ ploop_index_wb_init(&piwb, ploop);
+
/*
* Update memory arrays and hb_nr, but do not update nr_bat_entries.
* This is noop except first enter to this function.
@@ -418,7 +420,7 @@ static void process_resize_cmd(struct ploop *ploop, struct ploop_index_wb *piwb,
ploop_advance_holes_bitmap(ploop, cmd);
if (cmd->resize.dst_cluster <= cmd->resize.end_dst_cluster) {
- ret = ploop_grow_relocate_cluster(ploop, piwb, cmd);
+ ret = ploop_grow_relocate_cluster(ploop, &piwb, cmd);
if (ret)
goto out;
@@ -427,7 +429,7 @@ static void process_resize_cmd(struct ploop *ploop, struct ploop_index_wb *piwb,
return;
} else {
/* Update header metadata */
- ret = ploop_grow_update_header(ploop, piwb, cmd);
+ ret = ploop_grow_update_header(ploop, &piwb, cmd);
}
out:
@@ -1178,7 +1180,7 @@ static int ploop_flip_upper_deltas(struct ploop *ploop)
}
/* Handle user commands requested via "message" interface */
-void process_deferred_cmd(struct ploop *ploop, struct ploop_index_wb *piwb)
+void process_deferred_cmd(struct ploop *ploop)
__releases(&ploop->deferred_lock)
__acquires(&ploop->deferred_lock)
{
@@ -1190,11 +1192,8 @@ void process_deferred_cmd(struct ploop *ploop, struct ploop_index_wb *piwb)
ploop->deferred_cmd = NULL;
spin_unlock_irq(&ploop->deferred_lock);
- /* There must not be a pending index wb */
- WARN_ON(piwb->page_nr != PAGE_NR_NONE);
-
if (cmd->type == PLOOP_CMD_RESIZE) {
- process_resize_cmd(ploop, piwb, cmd);
+ process_resize_cmd(ploop, cmd);
} else if (cmd->type == PLOOP_CMD_MERGE_SNAPSHOT) {
process_merge_latest_snapshot_cmd(ploop, cmd);
} else {
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index f91177ac619a..6777e51810ac 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -55,7 +55,7 @@ static unsigned int pio_nr_segs(struct pio *pio)
return nr_segs;
}
-static void ploop_index_wb_init(struct ploop_index_wb *piwb, struct ploop *ploop)
+void ploop_index_wb_init(struct ploop_index_wb *piwb, struct ploop *ploop)
{
piwb->ploop = ploop;
init_completion(&piwb->comp);
@@ -1553,7 +1553,7 @@ void do_ploop_work(struct work_struct *ws)
ploop_index_wb_init(&piwb, ploop);
spin_lock_irq(&ploop->deferred_lock);
- process_deferred_cmd(ploop, &piwb);
+ process_deferred_cmd(ploop);
process_delta_wb(ploop, &piwb);
list_splice_init(&ploop->deferred_pios, &deferred_pios);
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index fde16007d342..ea743cc064ca 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -507,8 +507,7 @@ extern void defer_pios(struct ploop *ploop, struct pio *pio, struct list_head *p
extern void do_ploop_work(struct work_struct *ws);
extern void do_ploop_fsync_work(struct work_struct *ws);
extern void ploop_event_work(struct work_struct *work);
-extern void process_deferred_cmd(struct ploop *ploop,
- struct ploop_index_wb *piwb);
+extern void process_deferred_cmd(struct ploop *ploop);
extern int ploop_clone_and_map(struct dm_target *ti, struct request *rq,
union map_info *map_context, struct request **clone);
extern struct pio *find_lk_of_cluster(struct ploop *ploop, u32 cluster);
@@ -534,6 +533,7 @@ extern void pio_prepare_offsets(struct ploop *, struct pio *, unsigned int);
extern int ploop_setup_metadata(struct ploop *ploop, struct page *page);
extern int ploop_read_delta_metadata(struct ploop *ploop, struct file *file,
void **d_hdr);
+extern void ploop_index_wb_init(struct ploop_index_wb *piwb, struct ploop *ploop);
extern void ploop_call_rw_iter(struct file *file, loff_t pos, unsigned rw,
struct iov_iter *iter, struct pio *pio);
extern void ploop_enospc_timer(struct timer_list *timer);
More information about the Devel
mailing list