From patchwork Wed Dec 6 21:03:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Groves X-Patchwork-Id: 13482273 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=jagalactic.com header.i=@jagalactic.com header.b="tFkQxUJb"; dkim=pass (1024-bit key) header.d=amazonses.com header.i=@amazonses.com header.b="bSSicDJf" Received: from a10-70.smtp-out.amazonses.com (a10-70.smtp-out.amazonses.com [54.240.10.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0B6CD46; Wed, 6 Dec 2023 13:03:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=rjayupzefgi7e6fmzxcxe4cv4arrjs35; d=jagalactic.com; t=1701896580; h=Subject:From:To:Cc:Date:Mime-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:References:Message-Id; bh=2XArwbjiyn8c4sOmfJ9h02yrv193lZYzJiMl45UR4yc=; b=tFkQxUJbXhIgZmPvbp9ANbcHJzJn10zhgBudO61dc8WKKb99lX89VTWM37UWAC2X 8+gclvqyP3A4/XmBPSRoU9D6RfDr12AkE7rMc4t9BM4wVIkmdjC0J62G0EvXQiNEfFA iuBVYRxKp0uwMSUZKVYR5VvGYKMNZWDPACPwt87E= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=224i4yxa5dv7c2xz3womw6peuasteono; d=amazonses.com; t=1701896580; h=Subject:From:To:Cc:Date:Mime-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:References:Message-Id:Feedback-ID; bh=2XArwbjiyn8c4sOmfJ9h02yrv193lZYzJiMl45UR4yc=; b=bSSicDJfYgnFNeiWDYLaRf3Ka/mlxzQoclr0D1diRr+7KMhGGkV5UkKaSt94iOKa HqyfhSog2bD0zeBoxOM8FM5p57fGjv71oTYTccYYKg/UxrLOdZCCHE2Wu+BOc6hJlw/ wTYbsYuGCwNtnEfagNTmtpnSR3QXT2OkC0jU0nzY= Subject: [PATCH RFC 1/4] dev_dax_iomap: Add add_dax_ops() func for fs-dax to provide dax holder_ops From: =?utf-8?q?John_Groves?= To: =?utf-8?q?Dan_Williams?= , =?utf-8?q?John_Grov?= =?utf-8?q?es?= , =?utf-8?q?John_Groves?= Cc: =?utf-8?q?Vishal_Verma?= , =?utf-8?q?Dave_Jian?= =?utf-8?q?g?= , =?utf-8?q?nvdimm=40lists=2Elinux=2Ede?= =?utf-8?q?v?= , =?utf-8?q?linux-cxl=40vger=2Ekernel?= =?utf-8?q?=2Eorg?= , =?utf-8?q?linux-kernel=40vg?= =?utf-8?q?er=2Ekernel=2Eorg?= , =?utf-8?q?lin?= =?utf-8?q?ux-fsdevel=40vger=2Ekernel=2Eorg?= , =?utf-8?q?John_Groves?= Date: Wed, 6 Dec 2023 21:03:00 +0000 Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 In-Reply-To: <20231206210252.52107-1-john@jagalactic.com> References: <20231206210252.52107-1-john@jagalactic.com> <20231206210252.52107-2-john@jagalactic.com> X-Mailer: Amazon WorkMail Thread-Index: AQHaKIeW9Nsmb4x1TnOasHllAnJBRAAAAFz1 Thread-Topic: [PATCH RFC 1/4] dev_dax_iomap: Add add_dax_ops() func for fs-dax to provide dax holder_ops X-Wm-Sent-Timestamp: 1701896579 X-Original-Mailer: git-send-email 2.39.3 (Apple Git-145) Message-ID: <0100018c40f0ed86-72d9b4a3-07c3-41c5-b495-190d21cad33c-000000@email.amazonses.com> Feedback-ID: 1.us-east-1.LF00NED762KFuBsfzrtoqw+Brn/qlF9OYdxWukAhsl8=:AmazonSES X-SES-Outgoing: 2023.12.06-54.240.10.70 From: John Groves This is clearly not the right way to set the holder_ops; where & how should this be done? --- drivers/dax/super.c | 16 ++++++++++++++++ include/linux/dax.h | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 0da9232ea175..3d4e205c1854 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -467,6 +467,22 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops) } EXPORT_SYMBOL_GPL(alloc_dax); +#if IS_ENABLED(CONFIG_DEV_DAX_IOMAP) +/* famfs calls this to add the holder_ops. There is probably a more elegant approach */ +int add_dax_ops( + struct dax_device *dax_dev, + const struct dax_holder_operations *hops) +{ + /* dax_dev->ops should have been populated by devm_create_dev_dax() */ + WARN_ON(!dax_dev->ops); + + /* Use cmpxchg? */ + dax_dev->holder_ops = hops; + return 0; +} +EXPORT_SYMBOL_GPL(add_dax_ops); +#endif /* DEV_DAX_IOMAP */ + void put_dax(struct dax_device *dax_dev) { if (!dax_dev) diff --git a/include/linux/dax.h b/include/linux/dax.h index b463502b16e1..31b68667b3cb 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -57,6 +57,11 @@ struct dax_holder_operations { #if IS_ENABLED(CONFIG_DAX) struct dax_device *alloc_dax(void *private, const struct dax_operations *ops); + +#if IS_ENABLED(CONFIG_DEV_DAX_IOMAP) +int add_dax_ops(struct dax_device *dax_dev, + const struct dax_holder_operations *hops); +#endif void *dax_holder(struct dax_device *dax_dev); void put_dax(struct dax_device *dax_dev); void kill_dax(struct dax_device *dax_dev);