On 6/22/21 6:54 PM, Hannes Reinecke wrote: > On 6/15/21 7:49 AM, Coly Li wrote: >> From: Jianpeng Ma <jianpeng.ma@xxxxxxxxx> >> >> This patch implements bch_get_allocated_pages() of the buddy to be used to > buddy allocator > Copied. Will be updated in next post. >> get allocated pages from specific owner. >> >> Signed-off-by: Jianpeng Ma <jianpeng.ma@xxxxxxxxx> >> Co-developed-by: Qiaowei Ren <qiaowei.ren@xxxxxxxxx> >> Signed-off-by: Qiaowei Ren <qiaowei.ren@xxxxxxxxx> >> Signed-off-by: Coly Li <colyli@xxxxxxx> >> --- >> drivers/md/bcache/nvm-pages.c | 6 ++++++ >> drivers/md/bcache/nvm-pages.h | 5 +++++ >> 2 files changed, 11 insertions(+) >> >> diff --git a/drivers/md/bcache/nvm-pages.c b/drivers/md/bcache/nvm-pages.c >> index 74d08950c67c..42b0504d9564 100644 >> --- a/drivers/md/bcache/nvm-pages.c >> +++ b/drivers/md/bcache/nvm-pages.c >> @@ -397,6 +397,12 @@ void *bch_nvm_alloc_pages(int order, const char *owner_uuid) >> } >> EXPORT_SYMBOL_GPL(bch_nvm_alloc_pages); >> >> +struct bch_nvm_pages_owner_head *bch_get_allocated_pages(const char *owner_uuid) >> +{ >> + return find_owner_head(owner_uuid, false); >> +} >> +EXPORT_SYMBOL_GPL(bch_get_allocated_pages); >> + >> #define BCH_PGOFF_TO_KVADDR(pgoff) ((void *)((unsigned long)pgoff << PAGE_SHIFT)) >> >> static int init_owner_info(struct bch_nvm_namespace *ns) >> diff --git a/drivers/md/bcache/nvm-pages.h b/drivers/md/bcache/nvm-pages.h >> index 0ca699166855..c763bf2e2721 100644 >> --- a/drivers/md/bcache/nvm-pages.h >> +++ b/drivers/md/bcache/nvm-pages.h >> @@ -64,6 +64,7 @@ int bch_nvm_init(void); >> void bch_nvm_exit(void); >> void *bch_nvm_alloc_pages(int order, const char *owner_uuid); >> void bch_nvm_free_pages(void *addr, int order, const char *owner_uuid); >> +struct bch_nvm_pages_owner_head *bch_get_allocated_pages(const char *owner_uuid); >> >> #else >> >> @@ -81,6 +82,10 @@ static inline void *bch_nvm_alloc_pages(int order, const char *owner_uuid) >> return NULL; >> } >> static inline void bch_nvm_free_pages(void *addr, int order, const char *owner_uuid) { } >> +static inline struct bch_nvm_pages_owner_head *bch_get_allocated_pages(const char *owner_uuid) >> +{ >> + return NULL; >> +} >> >> #endif /* CONFIG_BCACHE_NVM_PAGES */ >> >> > Reviewed-by: Hannes Reinecke <hare@xxxxxxx> Thanks for your review. Coly Li