[Devel] [PATCH RH8 56/61] ploop: Rename pio::action

Kirill Tkhai ktkhai at virtuozzo.com
Fri May 14 18:59:36 MSK 2021


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

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index c471b621e1b5..36d7b5a5643d 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -90,7 +90,7 @@ static void init_pio(struct ploop *ploop, unsigned int bi_op, struct pio *pio)
 {
 	pio->ploop = ploop;
 	pio->bi_op = bi_op;
-	pio->action = PLOOP_END_IO_NONE;
+	pio->wants_discard_index_cleanup = false;
 	pio->is_data_alloc = false;
 	pio->ref_index = PLOOP_REF_INDEX_INVALID;
 	pio->bi_status = BLK_STS_OK;
@@ -521,7 +521,7 @@ static void handle_discard_pio(struct ploop *ploop, struct pio *pio,
 	ret = punch_hole(top_delta(ploop)->file, pos, pio->bi_iter.bi_size);
 	if (ret) {
 		pio->bi_status = errno_to_blk_status(ret);
-		pio->action = PLOOP_END_IO_DISCARD_INDEX_BIO;
+		pio->wants_discard_index_cleanup = true;
 		pio_endio(pio);
 		return;
 	}
@@ -883,11 +883,6 @@ static bool ploop_data_pio_end(struct pio *pio)
 
 static bool ploop_attach_end_action(struct pio *h, struct ploop_index_wb *piwb)
 {
-	if (WARN_ON_ONCE(h->action != PLOOP_END_IO_NONE)) {
-		h->action = PLOOP_END_IO_NONE;
-		return false;
-	}
-
 	/* Currently this can't fail. */
 	if (!atomic_inc_not_zero(&piwb->count))
 		return false;
@@ -1461,7 +1456,7 @@ static int process_one_discard_pio(struct ploop *ploop, struct pio *pio,
 		goto out;
 	}
 
-	pio->action = PLOOP_END_IO_DISCARD_INDEX_BIO;
+	pio->wants_discard_index_cleanup = true;
 
 	/* Cluster index related to the page[page_nr] start */
 	cluster -= piwb->page_nr * PAGE_SIZE / sizeof(map_index_t) - PLOOP_MAP_OFFSET;
@@ -1497,10 +1492,7 @@ static void do_discard_cleanup(struct ploop *ploop)
 }
 
 /*
- * This processes discard bios waiting index writeback after REQ_DISCARD
- * to backing device has finished (PLOOP_END_IO_DISCARD_INDEX_BIO stage).
- *
- * Also this switches the device back in !force_link_inflight_bios mode
+ * This switches the device back in !force_link_inflight_bios mode
  * after cleanup timeout has expired.
  */
 static void process_discard_pios(struct ploop *ploop, struct list_head *pios,
@@ -1761,7 +1753,7 @@ static void ploop_endio(struct ploop *ploop, struct pio *pio)
 	 * processing, and that we are going to call bi_end_io
 	 * directly later again.
 	 */
-	if (pio->action == PLOOP_END_IO_DISCARD_INDEX_BIO)
+	if (pio->wants_discard_index_cleanup)
 		ploop_discard_index_pio_end(ploop, pio);
 
 	maybe_unlink_completed_pio(ploop, pio);
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 0b28fa8b453e..e1924744757a 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -256,10 +256,8 @@ struct pio {
 
 	unsigned int cluster;
 
-#define PLOOP_END_IO_NONE		0
-#define PLOOP_END_IO_DISCARD_INDEX_BIO	3
-	unsigned int action:2;
 	bool is_data_alloc:1;
+	bool wants_discard_index_cleanup:1;
 	/*
 	 * 0 and 1 are related to inflight_bios_ref[],
 	 * 2 means index is not assigned.




More information about the Devel mailing list