[Devel] [PATCH RH8 5/8] ploop: Introduce md helpers

Kirill Tkhai ktkhai at virtuozzo.com
Thu Jul 1 18:14:41 MSK 2021


Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop.h |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 972f91b97c62..c26641ce4e2b 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -400,6 +400,17 @@ static inline u32 page_clu_idx_to_bat_clu(u32 page_id, u32 cluster_rel)
 	return off + cluster_rel;
 }
 
+static inline struct md_page *md_first_entry(struct rb_root *md_root)
+{
+	struct rb_node *node = rb_first(md_root);
+	return rb_entry(node, struct md_page, node);
+}
+static inline struct md_page *md_next_entry(struct md_page *md)
+{
+	return rb_entry(rb_next(&md->node), struct md_page, node);
+}
+
+
 extern struct md_page * md_page_find(struct ploop *ploop, u32 id);
 
 /*




More information about the Devel mailing list