[Devel] [PATCH RH8 11/22] ploop: Return md from ploop_prepare_reloc_index_wb()
Kirill Tkhai
ktkhai at virtuozzo.com
Wed Jun 30 13:33:49 MSK 2021
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/md/dm-ploop-cmd.c | 10 ++++++----
drivers/md/dm-ploop-map.c | 2 ++
drivers/md/dm-ploop.h | 4 ++--
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 183524f61243..96a214f373db 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -279,6 +279,7 @@ static int ploop_grow_relocate_cluster(struct ploop *ploop,
{
unsigned int new_dst, clu, dst_clu;
struct pio *pio = cmd->resize.pio;
+ struct md_page *md;
bool is_locked;
int ret = 0;
@@ -303,7 +304,7 @@ static int ploop_grow_relocate_cluster(struct ploop *ploop,
if (ret < 0)
goto out;
- ret = ploop_prepare_reloc_index_wb(ploop, piwb, clu,
+ ret = ploop_prepare_reloc_index_wb(ploop, &md, piwb, clu,
&new_dst);
if (ret < 0)
goto out;
@@ -315,7 +316,7 @@ static int ploop_grow_relocate_cluster(struct ploop *ploop,
goto out;
}
- ploop_make_md_wb(ploop, piwb->md);
+ ploop_make_md_wb(ploop, md);
/* Write new index on disk */
ploop_submit_index_wb_sync(ploop, piwb);
ret = blk_status_to_errno(piwb->bi_status);
@@ -348,11 +349,12 @@ static int ploop_grow_update_header(struct ploop *ploop,
unsigned int size, first_block_off;
struct ploop_pvd_header *hdr;
u32 nr_be, offset, clus;
+ struct md_page *md;
u64 sectors;
int ret;
/* hdr is in the same page as bat_entries[0] index */
- ret = ploop_prepare_reloc_index_wb(ploop, piwb, 0, NULL);
+ ret = ploop_prepare_reloc_index_wb(ploop, &md, piwb, 0, NULL);
if (ret)
return ret;
@@ -368,7 +370,7 @@ static int ploop_grow_update_header(struct ploop *ploop,
offset = hdr->m_FirstBlockOffset = cpu_to_le32(first_block_off);
kunmap_atomic(hdr);
- ploop_make_md_wb(ploop, piwb->md);
+ ploop_make_md_wb(ploop, md);
ploop_submit_index_wb_sync(ploop, piwb);
ret = blk_status_to_errno(piwb->bi_status);
if (!ret) {
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index a937f3638b35..c2c5a10138d0 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1807,6 +1807,7 @@ static void handle_cleanup(struct ploop *ploop, struct pio *pio)
* is caller duty.
*/
int ploop_prepare_reloc_index_wb(struct ploop *ploop,
+ struct md_page **ret_md,
struct ploop_index_wb *piwb,
unsigned int clu,
unsigned int *dst_clu)
@@ -1836,6 +1837,7 @@ int ploop_prepare_reloc_index_wb(struct ploop *ploop,
goto out_reset;
}
+ *ret_md = md;
return 0;
out_reset:
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index babdfdb7f672..5cadffba881e 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -538,8 +538,8 @@ extern int ploop_rw_page_sync(unsigned rw, struct file *file,
u64 index, struct page *page);
extern void map_and_submit_rw(struct ploop *ploop, u32 dst_clu, struct pio *pio, u8 level);
-extern int ploop_prepare_reloc_index_wb(struct ploop *, struct ploop_index_wb *,
- unsigned int, unsigned int *);
+extern int ploop_prepare_reloc_index_wb(struct ploop *, struct md_page **,
+ struct ploop_index_wb *, unsigned int, unsigned int *);
extern void ploop_reset_bat_update(struct ploop_index_wb *);
extern void ploop_submit_index_wb_sync(struct ploop *, struct ploop_index_wb *);
extern int ploop_message(struct dm_target *ti, unsigned int argc, char **argv,
More information about the Devel
mailing list