From patchwork Tue Jun 15 05:49:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Coly Li X-Patchwork-Id: 12320631 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB53DC49361 for ; Tue, 15 Jun 2021 05:49:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A85B76141E for ; Tue, 15 Jun 2021 05:49:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230286AbhFOFvy (ORCPT ); Tue, 15 Jun 2021 01:51:54 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:45658 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbhFOFvx (ORCPT ); Tue, 15 Jun 2021 01:51:53 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 992801FD2A; Tue, 15 Jun 2021 05:49:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1623736188; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3kgOGOtFbni91YpCkPSMNm/9rRn/zSB0E64MCYStyWY=; b=i712REx7WkUcQW3TZgNHhk2VpxKX4CPfzDpcTuBG4fkEZnmWKQ4mGWtoZT64Wua5s2urO/ fYMByJp3jUG5Rv0kJPiZLJ3aqn2hj3IScbYqFxtIXIhR9j1iM9JC1k4l9096roAdNV4wyf HejunKPeWVOmvTHLwicBcIKsmlNXck4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1623736188; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3kgOGOtFbni91YpCkPSMNm/9rRn/zSB0E64MCYStyWY=; b=lzWdyabIDiFZK2NaaF9j5TyKN2SSV+c/QrX8h2nhtZEhpMSimmerADJXUj4LQLicm4r5H8 /Q4M1g7gB6UCm+BA== Received: from localhost.localdomain (unknown [10.163.16.22]) by relay2.suse.de (Postfix) with ESMTP id C3172A3BC3; Tue, 15 Jun 2021 05:49:46 +0000 (UTC) From: Coly Li To: axboe@kernel.dk Cc: linux-bcache@vger.kernel.org, linux-block@vger.kernel.org, Jianpeng Ma , Qiaowei Ren , Coly Li Subject: [PATCH 08/14] bcache: get allocated pages from specific owner Date: Tue, 15 Jun 2021 13:49:15 +0800 Message-Id: <20210615054921.101421-9-colyli@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210615054921.101421-1-colyli@suse.de> References: <20210615054921.101421-1-colyli@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Jianpeng Ma This patch implements bch_get_allocated_pages() of the buddy to be used to get allocated pages from specific owner. Signed-off-by: Jianpeng Ma Co-developed-by: Qiaowei Ren Signed-off-by: Qiaowei Ren Signed-off-by: Coly Li Reviewed-by: Hannes Reinecke --- 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 */