aboutsummaryrefslogtreecommitdiffstats
path: root/for-test/nvdimm-support/meta-dev-20230303/0006-bcache-get-recs-list-head-for-allocated-pages-by-specific-uuid.patch
diff options
context:
space:
mode:
Diffstat (limited to 'for-test/nvdimm-support/meta-dev-20230303/0006-bcache-get-recs-list-head-for-allocated-pages-by-specific-uuid.patch')
-rw-r--r--for-test/nvdimm-support/meta-dev-20230303/0006-bcache-get-recs-list-head-for-allocated-pages-by-specific-uuid.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/for-test/nvdimm-support/meta-dev-20230303/0006-bcache-get-recs-list-head-for-allocated-pages-by-specific-uuid.patch b/for-test/nvdimm-support/meta-dev-20230303/0006-bcache-get-recs-list-head-for-allocated-pages-by-specific-uuid.patch
new file mode 100644
index 0000000..fb312f3
--- /dev/null
+++ b/for-test/nvdimm-support/meta-dev-20230303/0006-bcache-get-recs-list-head-for-allocated-pages-by-specific-uuid.patch
@@ -0,0 +1,67 @@
+From 5f3c1d461205e4baebfa952650827477d4d988cd Mon Sep 17 00:00:00 2001
+From: Jianpeng Ma <jianpeng.ma@intel.com>
+Date: Thu, 21 Oct 2021 21:06:03 +0800
+Subject: [PATCH 06/16] bcache: get recs list head for allocated pages by
+ specific uuid
+
+This patch implements bch_get_nvmpg_head() of the buddy allocator
+to be used to get recs list head for allocated pages by specific
+uuid. Then the requester (owner) can find all previous allocated
+nvdimm pages by iterating the recs list.
+
+Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
+Co-developed-by: Qiaowei Ren <qiaowei.ren@intel.com>
+Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
+Reviewed-by: Hannes Reinecke <hare@suse.de>
+Cc: Christoph Hellwig <hch@lst.de>
+Cc: Dan Williams <dan.j.williams@intel.com>
+Cc: Jens Axboe <axboe@kernel.dk>
+---
+ drivers/md/bcache/nvmpg.c | 6 ++++++
+ drivers/md/bcache/nvmpg.h | 6 ++++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/drivers/md/bcache/nvmpg.c b/drivers/md/bcache/nvmpg.c
+index 129938603bc7..87e2f5c3f734 100644
+--- a/drivers/md/bcache/nvmpg.c
++++ b/drivers/md/bcache/nvmpg.c
+@@ -539,6 +539,12 @@ unsigned long bch_nvmpg_alloc_pages(int order, const char *uuid)
+ }
+ EXPORT_SYMBOL_GPL(bch_nvmpg_alloc_pages);
+
++struct bch_nvmpg_head *bch_get_nvmpg_head(const char *uuid)
++{
++ return find_nvmpg_head(uuid, false);
++}
++EXPORT_SYMBOL_GPL(bch_get_nvmpg_head);
++
+ static inline void *nvm_end_addr(struct bch_nvmpg_ns *ns)
+ {
+ return ns->base_addr + (ns->pages_total << PAGE_SHIFT);
+diff --git a/drivers/md/bcache/nvmpg.h b/drivers/md/bcache/nvmpg.h
+index 009582b5771b..a2621c201fa6 100644
+--- a/drivers/md/bcache/nvmpg.h
++++ b/drivers/md/bcache/nvmpg.h
+@@ -94,6 +94,7 @@ int bch_nvmpg_init(void);
+ void bch_nvmpg_exit(void);
+ unsigned long bch_nvmpg_alloc_pages(int order, const char *uuid);
+ void bch_nvmpg_free_pages(unsigned long nvmpg_offset, int order, const char *uuid);
++struct bch_nvmpg_head *bch_get_nvmpg_head(const char *uuid);
+
+ #else
+
+@@ -116,6 +117,11 @@ static inline unsigned long bch_nvmpg_alloc_pages(int order, const char *uuid)
+
+ static inline void bch_nvmpg_free_pages(unsigned long nvmpg_offset, int order, const char *uuid) { }
+
++static inline struct bch_nvmpg_head *bch_get_nvmpg_head(const char *uuid)
++{
++ return NULL;
++}
++
+ #endif /* CONFIG_BCACHE_NVM_PAGES */
+
+ #endif /* _BCACHE_NVM_PAGES_H */
+--
+2.39.2
+