Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3511922pxb; Fri, 4 Feb 2022 10:02:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJwNww0KdsCReiT3reDlgSiIsO2qKvMLaFmw+eT6PG35zsEkbfq/npJj0scfGnVRviLXYN9f X-Received: by 2002:a17:90a:d157:: with SMTP id t23mr300949pjw.93.1643997773413; Fri, 04 Feb 2022 10:02:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643997773; cv=none; d=google.com; s=arc-20160816; b=DlLhsGuHb6fnGblYPdYvZ2EfCFyZhGOMeRnzETTzf1lEHH2BnlgQnxkwmwwLzshD6Q S7zvyL1sF4xWEmrZBza2fYr4EwSFlp93QV8mTbxBRmamlOnrlkpBndCnr7AYLdzz9tI7 KtzHImD4H3pJ1PmlwaCUFbzKgbb87dVtQZv0u8bUTqvPIxO8IyoWfzazib/yOsugpBb9 BeGrgOe2PMAOsgrAkgeRNZBlpGFEYJGsdWXN3kBNbpaaXYUG4SS0t5fIrtntHAB+6W10 oghwWBTzrkpv4uVtf32qpYewbVjUO/IEX1DYiF2NpbCd5ApX50wy73V30nLjEwkbaQVB xuSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=uNf3Kf4hoy55VBNw3wt44AdzBNehHt9KaUoihC4mBrw=; b=KbYQ3YGBgDd8QKTN/h8q0v+ZRwAPwHrjEcB0ij66LKDVOXMAxlASx8d3Lf5D2bUPEO 0tUqTeCeWlE9Lh7bXDAAq8HbzrUCcoj79sdJx24hj4g4VcZ+dzQ0RdK7mNG3Tv57C8oI Lj111D9QirbzVhpu8+yOAu/jFb1zQSCKhcQwURki8aG3gHx23wV9gGXCC1TanjtX44h4 vU0mB5FmeATJXyQDgSAcOYWqy60FmBLBXlpY469wp0aLmDUcVYjiJpeSVr1g2Mu26OiX qNm7FRg+cDtglEvANImMsckHGEEga3OHfcmwQJbgUhooIiLN7JzH46JCBNLRWGEnue4P N8ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=W8q5WAMD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w186si2439996pgd.525.2022.02.04.10.02.38; Fri, 04 Feb 2022 10:02:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=W8q5WAMD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241263AbiBBNDq (ORCPT + 99 others); Wed, 2 Feb 2022 08:03:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbiBBNDo (ORCPT ); Wed, 2 Feb 2022 08:03:44 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E4FFC061714; Wed, 2 Feb 2022 05:03:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=uNf3Kf4hoy55VBNw3wt44AdzBNehHt9KaUoihC4mBrw=; b=W8q5WAMDiFJsaQjVwzcQNYhbFB TUhEzkTsfxRSEKGdxNARH2VlcVdcDdmFCApVXE9/uC4L1PKTd/4fDCVqDlGkYFs7klpelGPcvudIJ NEgSsM8r4n/YaIyXsDAGkOHaZ7tQwwjKTOvOR47fupgUC8GEiYmGWhp8TGEZeE1FNXpEMCCAMpnbN N2XuOsGW3/8gzyPMEyQ+qS/aLLq0rg7FtFaei4DUI040ACtXkXQbyPXYvgaC6aYcHjsue/OEJjwkc ie50CMyIAVekefGX5lBW/LEbynfRsGGMK7nXRLjyC6DZYwKaY2N50/9G4sf9VdU2OSOCoPYUH+Iao F+JpOpdg==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFFIV-00FIEL-Kt; Wed, 02 Feb 2022 13:03:43 +0000 Date: Wed, 2 Feb 2022 05:03:43 -0800 From: Christoph Hellwig To: Shiyang Ruan Cc: linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, nvdimm@lists.linux.dev, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, djwong@kernel.org, dan.j.williams@intel.com, david@fromorbit.com, hch@infradead.org, jane.chu@oracle.com Subject: Re: [PATCH v10 1/9] dax: Introduce holder for dax_device Message-ID: References: <20220127124058.1172422-1-ruansy.fnst@fujitsu.com> <20220127124058.1172422-2-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220127124058.1172422-2-ruansy.fnst@fujitsu.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 27, 2022 at 08:40:50PM +0800, Shiyang Ruan wrote: > +void dax_register_holder(struct dax_device *dax_dev, void *holder, > + const struct dax_holder_operations *ops) > +{ > + if (!dax_alive(dax_dev)) > + return; > + > + dax_dev->holder_data = holder; > + dax_dev->holder_ops = ops; This needs to return an error if there is another holder already. And some kind of locking to prevent concurrent registrations. Also please add kerneldoc comments for the new exported functions. > +void *dax_get_holder(struct dax_device *dax_dev) > +{ > + if (!dax_alive(dax_dev)) > + return NULL; > + > + return dax_dev->holder_data; > +} > +EXPORT_SYMBOL_GPL(dax_get_holder); get tends to imply getting a reference. Maybe just dax_holder()? That being said I can't see where we'd even want to use the holder outside of this file.