[Devel] [PATCH RH8 8/8] ploop: Make fields in dm_ploop_endio_hook separate

Kirill Tkhai ktkhai at virtuozzo.com
Tue May 11 11:46:28 MSK 2021


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

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 4ad950afdda3..b643a4380fab 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -77,7 +77,7 @@ static void __ploop_init_end_io(struct ploop *ploop,
 	h->action = PLOOP_END_IO_NONE;
 	h->ref_index = PLOOP_REF_INDEX_INVALID;
 	h->piwb = NULL;
-	memset(&h->list, 0, sizeof(h->list));
+	INIT_LIST_HEAD(&h->list);
 	h->endio_bio_list = NULL;
 	/* FIXME: assign real cluster? */
 	h->cluster = UINT_MAX;
@@ -1499,9 +1499,7 @@ void unlink_postponed_backup_endio(struct ploop *ploop,
 	unlink_endio_hook(ploop, &pb->rb_root, h, bio_list);
 
 	/* Unlink from pb->pending */
-	list_del(&h->list);
-	/* Zero {list,piwb} union as it may be used later in further */
-	memset(&h->list, 0, sizeof(h->list));
+	list_del_init(&h->list);
 
 	/* Queue relared bio itself */
 	bio = dm_bio_from_per_bio_data(h, sizeof(*h));
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 6644ef391791..93a902d66acf 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -229,10 +229,8 @@ struct ploop {
 };
 
 struct dm_ploop_endio_hook {
-	union {
-		struct ploop_index_wb *piwb;
-		struct list_head list;
-	};
+	struct list_head list;
+
 	struct rb_node node;
 	/* List of bios, which will be queued from this bio end */
 	struct bio *endio_bio_list;
@@ -250,6 +248,8 @@ struct dm_ploop_endio_hook {
 	 */
 #define PLOOP_REF_INDEX_INVALID	2
 	unsigned int ref_index:2;
+
+	struct ploop_index_wb *piwb;
 };
 
 struct ploop_iocb {




More information about the Devel mailing list