Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp525447pxb; Thu, 21 Oct 2021 04:31:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuSOZnEe2uzMQw359ef2gGkhmq/5ztbw1gA4WA3HfrBw+aM1Re54teOXdyMtmneJRx3dom X-Received: by 2002:aa7:c501:: with SMTP id o1mr6975234edq.99.1634815890835; Thu, 21 Oct 2021 04:31:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634815890; cv=none; d=google.com; s=arc-20160816; b=Ir7iAhwWyckxbIG6DDBL0DBZrtZgidWzmh7ds8SBRRW6MW3hYPhvIzek33uS3JvYA7 jPEh+rkjddUvCe1c92ZMZ/zqza3P3iPXXDOPP/NY0ezKzD2QhXY40fdztLvomzAHt8lB 4PDgHQ6PC+UoZyAy1PfqDKug6eyXCnk7pgEHmphkcfWLWaq0FrzErqw5E/oR7nRP2HR2 sCGBtkR7KD/Wz5bqMUbk6oQ1aOMC+sm+DKUw2JbNQJ3eILRtJNiJjE0MtvDhdqqyot7H B9tj0lzllqIKM4HEaTNrGXL6UO/gCoMx3ZjhfYjd8ajVnen2I29vVkP8XpjsKV5b8TvQ NHTQ== 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=/qf9x5zobmso29yEG7gFdwTwQzI2ArNVYsHjq8xdPdM=; b=e3fei629/2rqqPGXmh8iMxFE9sGU3bW8ydNxQ5W9StZjoAfVnZbbXzhcB6sGz97/8v CqvixMwE7CebaAfxme+PTG4P4dLFH6mFJ+XiXviaXZH5bWpYXc8Ih3QZ6lHctkm4EpIl ETKHTUxrAx/Z4Qak9Cxs2QbfHxpC2Ixeeqqsw6pXcuctlpHydd76dgR3GEQhXWi9Y19k aW66tEURPplFDXcoRQZjnnPqF/HfvihsGvqoHpIloTCMSTowP8agcmXXoo44YSdussiy RrIP/9C2XW4cF4MzGzoiMqRBtiHNKxar/yIpSsmrWROqv+i/8+yaptE9LYebcEhBvHp7 ZUaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=QEUb546e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oz44si9003113ejc.470.2021.10.21.04.31.06; Thu, 21 Oct 2021 04:31:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=QEUb546e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230407AbhJULbU (ORCPT + 99 others); Thu, 21 Oct 2021 07:31:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230359AbhJULbQ (ORCPT ); Thu, 21 Oct 2021 07:31:16 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50B1FC061749; Thu, 21 Oct 2021 04:29:00 -0700 (PDT) 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=/qf9x5zobmso29yEG7gFdwTwQzI2ArNVYsHjq8xdPdM=; b=QEUb546e9a6j/h8xSaw5S+nPTM clDEVIF+Obeqijj3acOBmpGzHzgbnC/MuFS2rJjaB5oa0zPCX0xNqHmyas6Mr/McBnx1aO5CXrNDp nTN1mY9QIkkr8rPcmWRVltUZX45nupW1prRUAjGSkouoWLMvfxL1JvwbgqtVb/kk3xcaRAKTgyMEF ou0plgdinyMhbp60EjG3WK2/BVD9ahRP/cKVFutEnXlqHZMAmjjntkj9vLYlS5SHz6MLAICwS7XZM 6YLmN94o+TNWA529d87QXqv6gssX8XzCu8fV4DsLFTuPtiN1KUL/+qqY9awRIPucYbI+EmI/MoeV9 ydmJsYWg==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdWFe-007Lv7-EG; Thu, 21 Oct 2021 11:28:50 +0000 Date: Thu, 21 Oct 2021 04:28:50 -0700 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 5/6] dax,pmem: Add data recovery feature to pmem_copy_to/from_iter() Message-ID: References: <20211021001059.438843-1-jane.chu@oracle.com> <20211021001059.438843-6-jane.chu@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211021001059.438843-6-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 > + if (flags & DAXDEV_F_RECOVERY) { > + lead_off = (unsigned long)addr & ~PAGE_MASK; > + len = PFN_PHYS(PFN_UP(lead_off + bytes)); > + if (is_bad_pmem(&pmem->bb, PFN_PHYS(pgoff) / 512, len)) { > + if (lead_off || !(PAGE_ALIGNED(bytes))) { > + dev_warn(dev, "Found poison, but addr(%p) and/or bytes(%#lx) not page aligned\n", > + addr, bytes); > + return (size_t) -EIO; > + } > + pmem_off = PFN_PHYS(pgoff) + pmem->data_offset; > + if (pmem_clear_poison(pmem, pmem_off, bytes) != > + BLK_STS_OK) > + return (size_t) -EIO; > + } Shouldn't this just go down in a separe ->clear_poison operation to make the whole thing a little easier to follow?