Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2576516pxb; Thu, 3 Feb 2022 09:25:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJyszQKgRS62BFewZaI9ocTo7jflcMBVN5lfiQR7wBoNiIdB+44Bb72K1Ap8TKrWzEdLIx78 X-Received: by 2002:a63:10c:: with SMTP id 12mr28493413pgb.512.1643909125276; Thu, 03 Feb 2022 09:25:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643909125; cv=none; d=google.com; s=arc-20160816; b=tlcZgZrWEPlxxVADEZldPNZGGBGrjrzjFYFRRrohv5CQFBFy9vHIWCGhc84J9ioNOR kme67sv3s6P/opgH4GTe/DHMdF/raOs9VfZ76QYkkuzCoQ0xIaN+J9JGI3ECngSbVaz+ uP4GF5SrN3akt/h7H2kD44okTujAFsizRmJ2dz9KOaZGJCJdorlT83njMpBTi5EWPYb2 Mkdi2qb3nnxZ0pEt857NNrpTUcsgI3VTTWHNX6iHoq4h4nBzvkYlJNDGMP26oWyUnPfT AbgH1VS1Jx7Q7yNFb2x1DAn8ZfI0RSFmBls0bdUr7gENwVgB3ddkV05Rtdal96j0iFVP ZZ/A== 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=az6kboJE3mFyY36gmE38vP7/KWYCb2+HOse48wBjN30=; b=cJOrWkzgZiUBWTjG76eoF5hqbrOpaXFSorah0nlqN5nH4UKZxNtfxYL/VEEq8y756M dZbumk5Aygt49ky+ZME8yjwVzHpzYMQcuQYNw8kCSFAcbcDplNle+drXJz92k+nabMmi rx+O2D/ARGJhatCnXg0u+TFOdMMb7j81jK4pibv0w+klRISD3Qey4Vodw50P9D6k//Xt akVVI1l4QbMB/phCqq5UnV7qJ7llq/GwxRcfLe1OBnrjnZpdeUmb8YnQPvA0WxV4PZvc XAt8oqYHKiHRQjAnd8TKarn3ULiReQ6b+S1uuKQwB/xN9Mxk/oEWhMU0XOdHywgoi8cN Vtyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="kJ/lrRzj"; 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 ik9si20250654plb.190.2022.02.03.09.25.11; Thu, 03 Feb 2022 09:25:25 -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="kJ/lrRzj"; 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 S1344312AbiBBNXN (ORCPT + 99 others); Wed, 2 Feb 2022 08:23:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232991AbiBBNXL (ORCPT ); Wed, 2 Feb 2022 08:23:11 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEB0AC061714; Wed, 2 Feb 2022 05:23:11 -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=az6kboJE3mFyY36gmE38vP7/KWYCb2+HOse48wBjN30=; b=kJ/lrRzjPlsjblsRRL2zqRYXJB +oU2VHVwqN3s2KJH9a4X4NkDQjetDteWEZXyAslmjd90P8P4LYaFstb8kKiMToioWHNtNZ9eqUaD7 l7ArUEF8GoI8guGIGipA/UBL74ymUHgzKQnnfTHqGz0Jq6F9n6cB+QJ7h96vlMItODbuAlej2wUIv R8pSsqGLZYwb7h225s7k3bYekjlD2Daf0fwexVewXd2RhTU+1zlXChBTNJa7ydZ39h7shA2wpSINL Lk4zIQkP0fSBw3S4uXEe2cCPWnyiSyq2ZjAE5YJUOsdoBTTxyxNVdDg3tUaQP4iYF7uSblobm0FED 6KTciqLw==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFFbF-00FLX5-Ie; Wed, 02 Feb 2022 13:23:05 +0000 Date: Wed, 2 Feb 2022 05:23:05 -0800 From: Christoph Hellwig To: Jane Chu Cc: david@fromorbit.com, djwong@kernel.org, dan.j.williams@intel.com, hch@infradead.org, vishal.l.verma@intel.com, dave.jiang@intel.com, agk@redhat.com, snitzer@redhat.com, dm-devel@redhat.com, ira.weiny@intel.com, willy@infradead.org, vgoyal@redhat.com, linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH v5 2/7] dax: introduce dax device flag DAXDEV_RECOVERY Message-ID: References: <20220128213150.1333552-1-jane.chu@oracle.com> <20220128213150.1333552-3-jane.chu@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220128213150.1333552-3-jane.chu@oracle.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 Fri, Jan 28, 2022 at 02:31:45PM -0700, Jane Chu wrote: > +int dax_prep_recovery(struct dax_device *dax_dev, void **kaddr) > +{ > + if (dax_recovery_capable(dax_dev)) { > + set_bit(DAXDEV_RECOVERY, (unsigned long *)kaddr); > + return 0; > + } > + return -EINVAL; Setting a random bit on a passed in memory address looks a little dangerous to me. Also I'd return early for the EINVAL case to make the flow a little more clear.