Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp222378pxb; Mon, 11 Apr 2022 23:44:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzf/5Xn6O/w3BuTTE92xnvkGtXzfVoynR7SWaFpfv+0Qx7yrT9bgYCamzWCFlTsLNkKj2+T X-Received: by 2002:a17:90b:384a:b0:1cb:254d:9446 with SMTP id nl10-20020a17090b384a00b001cb254d9446mr3310862pjb.26.1649745848743; Mon, 11 Apr 2022 23:44:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649745848; cv=none; d=google.com; s=arc-20160816; b=EbCSpSOkPeL7tH2Vo+zyhn07y7bMZaE3/v011faN2FLdEN1hKQSLiabTvXlzZo0mbf rJ3xNsXbeIcjs+DHN9oOwPe09LidovF7gY2OJ6/AqvyYPmcNgGp3ixv3JuPvs9N9kcBN RGGf5r81l/aeFq6do23Ih9cWs56N+Ou9aw/jA2c8iiZ7tnFfEmiDOwZO8HINuvB4tfo6 /Gbcardd8Qz1Vi4wkDxmt24raD8Q4ClS8lF3lclnHYVU9O2Ju7C7giu7jIWAbI86XQEo otiklBS9fAVWI4Bj0pW3Wc2msJCs6t0PfR4R3mWIOx9GXvVfK7ZPpIrGO+asfxSEoKmf d/KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8TleCaBIhpvoj6MzJmrMyC3ucMSm6WO1y+eL8xleJY4=; b=zAtxheAN1Twywt4mMLLx5oj2XM3l7Lu3aun2+jYBCRmCVpCbJTibJ1JlVdAHnPzAdm BthHBR0jN5ZihbRXPbNJol+Y61N29keZi35sKhBaEjldVtQZz6hhtI4nJ6zh0pNoZ/e7 3SnMaT0VdSFQQ0S8SlzJzb3GBqfMhKxNbUsVC7EnZnjxwkhkaL+U2Oq4bbTwErT8kVvG Oq8UqqE2Wt/IswIKTLjxMiwKAwYvLz1wshAuvlPxHpBFCDRxOyzwD7iCD1AYn5F7lqH2 pjTJ+VHAAWwSzcICt4dG6VKx5802lzFV/sR/6GzbZ0BlbCTEckvlKZR+cur7kku6LvD3 kg/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20210112.gappssmtp.com header.s=20210112 header.b=fkN36mDp; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k1-20020a17090a404100b001bf756ef81csi10669433pjg.139.2022.04.11.23.43.55; Mon, 11 Apr 2022 23:44:08 -0700 (PDT) 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=@intel-com.20210112.gappssmtp.com header.s=20210112 header.b=fkN36mDp; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347201AbiDLFAJ (ORCPT + 99 others); Tue, 12 Apr 2022 01:00:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241228AbiDLFAE (ORCPT ); Tue, 12 Apr 2022 01:00:04 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E25D42E9C1 for ; Mon, 11 Apr 2022 21:57:47 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id bx5so17242012pjb.3 for ; Mon, 11 Apr 2022 21:57:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8TleCaBIhpvoj6MzJmrMyC3ucMSm6WO1y+eL8xleJY4=; b=fkN36mDpM4Pd1sCv3rNuy9oyYD/gLOwueus4xphJV1YDbeNRSQ8IyujzwsptiZfgYe QUQIV9qghorMpdWWz6Mmsr/1DpHVZ96zqos/O3uhBAyz4TBRkDPpFJ5YoWKm0lCFZweQ RoEFhL/uQjowL2aggfNFdXl2Ztg3A9451oiIjvEilBdbF+7t1islEN8KsPhMNJASWFOK SUVweWmAjr6bfH/tyV4dylbfizqkoRZTCLZaofjld5K7oDzCT9ORDsz4TyjMGKUqQ8M4 Qet/LWoJSVXRFpDjGoHVJDsMMopWIZP4HzpS68RD9q73tLwybQtTxPuEsqT+1brdIvEZ etIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8TleCaBIhpvoj6MzJmrMyC3ucMSm6WO1y+eL8xleJY4=; b=FGbbuYototdvsNPkfEjZDKDoaiy8o7vXATwS98VA4I4fjcI4gp83b9dEJIazGn6PG1 xNEMMHfmc4h3Ow1YP64kZ28iZpaiCGHVCg3EH8DKTb0hROoLzE7LOmNbAWn4qVUAvZgg fnAPs+juuJSg2yWJF0wmPplZD4lOGf+ztWv9cz+W5sbcWEwkfC2rjOSW/PR8hc0086l8 8uHvcr4IHSi500DF+A6vm2fVF7b1U2SrhcpfM/LR1LlGaw8nF6r/SNGuKI8UGmgKstIT m6IIhIdUMIafMYkRGA8PZIIyx4gl501Oz8rcdnKzauECWPoT00NaP8dxlES0gUgsemsH 5Xfg== X-Gm-Message-State: AOAM533lfvDdOyTCb5KuJzbz1lTIutcoQ+TcbQxPGAvOqmqmZ1+KcvS6 nBBArjJwW7TdJj41dGv9t2GkodZ/GgmnWRRzq9GnNA== X-Received: by 2002:a17:902:eb92:b0:158:4cc9:698e with SMTP id q18-20020a170902eb9200b001584cc9698emr12430897plg.147.1649739467468; Mon, 11 Apr 2022 21:57:47 -0700 (PDT) MIME-Version: 1.0 References: <20220405194747.2386619-1-jane.chu@oracle.com> <20220405194747.2386619-5-jane.chu@oracle.com> In-Reply-To: <20220405194747.2386619-5-jane.chu@oracle.com> From: Dan Williams Date: Mon, 11 Apr 2022 21:57:36 -0700 Message-ID: Subject: Re: [PATCH v7 4/6] dax: add DAX_RECOVERY flag and .recovery_write dev_pgmap_ops To: Jane Chu Cc: david , "Darrick J. Wong" , Christoph Hellwig , Vishal L Verma , Dave Jiang , Alasdair Kergon , Mike Snitzer , device-mapper development , "Weiny, Ira" , Matthew Wilcox , Vivek Goyal , linux-fsdevel , Linux NVDIMM , Linux Kernel Mailing List , linux-xfs , X86 ML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 5, 2022 at 12:48 PM Jane Chu wrote: > > Introduce DAX_RECOVERY flag to dax_direct_access(). The flag is > not set by default in dax_direct_access() such that the helper > does not translate a pmem range to kernel virtual address if the > range contains uncorrectable errors. When the flag is set, > the helper ignores the UEs and return kernel virtual adderss so > that the caller may get on with data recovery via write. It strikes me that there is likely never going to be any other flags to dax_direct_access() and what this option really is an access type. I also find code changes like this error prone to read: - rc = dax_direct_access(iter->iomap.dax_dev, pgoff, 1, &kaddr, NULL); + rc = dax_direct_access(iter->iomap.dax_dev, pgoff, 1, 0, &kaddr, NULL); ...i.e. without looking at the prototype, which option is the nr_pages and which is the flags? So how about change 'int flags' to 'enum dax_access_mode mode' where dax_access_mode is: /** * enum dax_access_mode - operational mode for dax_direct_access() * @DAX_ACCESS: nominal access, fail / trim access on encountering poison * @DAX_RECOVERY_WRITE: ignore poison and provide a pointer suitable for use with dax_recovery_write() */ enum dax_access_mode { DAX_ACCESS, DAX_RECOVERY_WRITE, }; Then the conversions look like this: - rc = dax_direct_access(iter->iomap.dax_dev, pgoff, 1, &kaddr, NULL); + rc = dax_direct_access(iter->iomap.dax_dev, pgoff, 1, DAX_ACCESS, &kaddr, NULL); ...and there's less chance of confusion with the @nr_pages argument.