[Devel] [PATCH RH8 12/22] ploop: Change arguments and rename ploop_reset_bat_update()

Kirill Tkhai ktkhai at virtuozzo.com
Wed Jun 30 13:33:55 MSK 2021


Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-cmd.c |    6 +++---
 drivers/md/dm-ploop-map.c |   17 +++++++++--------
 drivers/md/dm-ploop.h     |    2 +-
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 96a214f373db..ea0273d558b9 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -312,7 +312,7 @@ static int ploop_grow_relocate_cluster(struct ploop *ploop,
 	/* Write clu to new destination */
 	ret = ploop_write_cluster_sync(ploop, pio, new_dst);
 	if (ret) {
-		ploop_reset_bat_update(piwb);
+		ploop_break_bat_update(ploop, md);
 		goto out;
 	}
 
@@ -320,7 +320,7 @@ static int ploop_grow_relocate_cluster(struct ploop *ploop,
 	/* Write new index on disk */
 	ploop_submit_index_wb_sync(ploop, piwb);
 	ret = blk_status_to_errno(piwb->bi_status);
-	ploop_reset_bat_update(piwb);
+	ploop_break_bat_update(ploop, md);
 	if (ret)
 		goto out;
 
@@ -382,7 +382,7 @@ static int ploop_grow_update_header(struct ploop *ploop,
 		kunmap_atomic(hdr);
 	}
 
-	ploop_reset_bat_update(piwb);
+	ploop_break_bat_update(ploop, md);
 	return ret;
 }
 
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index c2c5a10138d0..8eb725d0b3ef 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -844,14 +844,15 @@ static int ploop_prepare_bat_update(struct ploop *ploop, struct md_page *md,
 	return 0;
 }
 
-void ploop_reset_bat_update(struct ploop_index_wb *piwb)
+void ploop_break_bat_update(struct ploop *ploop, struct md_page *md)
 {
-	struct ploop *ploop = piwb->ploop;
+	struct ploop_index_wb *piwb;
 	unsigned long flags;
 
 	write_lock_irqsave(&ploop->bat_rwlock, flags);
-	piwb->md->piwb = NULL;
-	piwb->md = NULL;
+	piwb = md->piwb;
+	md->piwb->md = NULL;
+	md->piwb = NULL;
 	write_unlock_irqrestore(&ploop->bat_rwlock, flags);
 
 	put_page(piwb->bat_page);
@@ -1387,7 +1388,7 @@ static bool locate_new_cluster_and_attach_pio(struct ploop *ploop,
 error:
 	/* Uninit piwb */
 	if (bat_update_prepared)
-		ploop_reset_bat_update(piwb);
+		ploop_break_bat_update(ploop, md);
 	pio_endio(pio);
 	return false;
 }
@@ -1533,7 +1534,7 @@ static void process_one_discard_pio(struct ploop *ploop, struct pio *pio,
 	return;
 err:
 	if (bat_update_prepared)
-		ploop_reset_bat_update(piwb);
+		ploop_break_bat_update(ploop, md);
 	pio_endio(pio);
 }
 
@@ -1577,7 +1578,7 @@ static void submit_metadata_writeback(struct ploop *ploop)
 		write_unlock_irq(&ploop->bat_rwlock);
 
 		ploop_submit_index_wb_sync(ploop, md->piwb);
-		ploop_reset_bat_update(md->piwb);
+		ploop_break_bat_update(ploop, md);
 	}
 }
 
@@ -1841,7 +1842,7 @@ int ploop_prepare_reloc_index_wb(struct ploop *ploop,
 	return 0;
 
 out_reset:
-	ploop_reset_bat_update(piwb);
+	ploop_break_bat_update(ploop, md);
 out_eio:
 	return -EIO;
 }
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 5cadffba881e..7817c52c7ec2 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -540,7 +540,7 @@ extern void map_and_submit_rw(struct ploop *ploop, u32 dst_clu, struct pio *pio,
 
 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_break_bat_update(struct ploop *ploop, struct md_page *);
 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,
 			 char *result, unsigned int maxlen);




More information about the Devel mailing list