Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp104213pxh; Tue, 9 Nov 2021 07:58:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJyRBcsSr1uGYOeBBZIZyN4cvGWSyb436NDkKen9+hX4w27q+W1WwQojOKTCJV9DSfanDyUG X-Received: by 2002:a05:6402:270e:: with SMTP id y14mr11575506edd.140.1636473503224; Tue, 09 Nov 2021 07:58:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636473503; cv=none; d=google.com; s=arc-20160816; b=X/ec1AVzfc45m3mpselJOrmH33Pu2D8VDoc1bTuq2hAQDSwO2ZEQco/orvIqa3l+3x fx5utG2+iZrQobYmJ91kwWEMM62NH/aDntqhxiAtkEN13A58JU68OTDeyCqv8qr+KPt5 QhB1WiYOviZOz64ywHBLFlkSX+U/+mzu+7SY+7Fa3j3IWXQ4qU0f6pMjeaDjQmKsJVTX TJ8TeaghkBP6GRKYdWX7T+ZBntv12+vyNr1VTNW94vbog5iHPJ3S/38GOqRaw/lu40UZ +1PqPC3i5SBiNbYh0+W9BNwXrpRdg8R0a4QddeN8roVDGM2Dm1PNXm7Lib+rs2WdDEbU Aqew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YI5KXoTh/4gwEroExLHzFhWVvpPDf4+n7V/Xox3B544=; b=uWD68mboQVBmN1WiMVDzdFQ2hpT/rh4b7Rgk8/1yTCJAL4YZDoSs7byn83rsAP0f28 MyQ+h8EQ3i9/GrSc52tilQNNpmeUkHXMjs8V6A5O/l/kT1dfeckexMEXmFRJLRKZy5Mh qvHcwoMaAlzFHZsQjUZo1l3Zwedl50Gxn1LKTX2lUzncRu/coXUFcknEqaRIWx59Xo26 frlXt07lpCNG7vg2iNt1vanP8JiwhoXKW3W3v+PVOReMdmjQrSJJ32TEjZmgNjnV2wh7 Roa1DKL95jLbPHB46AYfVVU/HiDYXPcDH31BmuvIc6YaGCtUMdJfk86Fl0B4NVUS4KUA ExSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=AwTyippi; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 k10si12503231ejx.113.2021.11.09.07.57.57; Tue, 09 Nov 2021 07:58:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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=casper.20170209 header.b=AwTyippi; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244254AbhKIIgr (ORCPT + 99 others); Tue, 9 Nov 2021 03:36:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244183AbhKIIgl (ORCPT ); Tue, 9 Nov 2021 03:36:41 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E8C2C061766; Tue, 9 Nov 2021 00:33:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=YI5KXoTh/4gwEroExLHzFhWVvpPDf4+n7V/Xox3B544=; b=AwTyippiAZmoz/Kfz0zWZ1oNbr 14RYnWC4s144kGri6OGi6exkkFBSqXwsho6c5f58x7DkOWCziZlBcyrUBi0QtIxOaDq2vKDf1d8YP QIs1cRsfc41v4e2hm2QP8vJ8qUMo2N7E0VFZyqxdRM1HDHGVuG9ysNhgE/yQ2HVlrziFbBvbO07yG IEkg0Krp6lFZS8nvD3l+q+d4Ysr9e+ItusH0opTuwyg+K08Lh0ajLUgazLtXCSCXwVdQ8mNqY/QTl i1oSVCDOOm9vyKUN93Mc59w3ssrysrc1Dr1bAqP2f+VDYnz3fWP1WlP4ea/Yz4ZJwC90/CTYuqv9E 6K+f+qYQ==; Received: from [2001:4bb8:19a:7ee7:fb46:2fe1:8652:d9d4] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkMZj-000s8n-3T; Tue, 09 Nov 2021 08:33:52 +0000 From: Christoph Hellwig To: Dan Williams Cc: Mike Snitzer , Ira Weiny , dm-devel@redhat.com, linux-xfs@vger.kernel.org, nvdimm@lists.linux.dev, linux-s390@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [PATCH 22/29] iomap: add a IOMAP_DAX flag Date: Tue, 9 Nov 2021 09:33:02 +0100 Message-Id: <20211109083309.584081-23-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211109083309.584081-1-hch@lst.de> References: <20211109083309.584081-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Add a flag so that the file system can easily detect DAX operations. Signed-off-by: Christoph Hellwig --- fs/dax.c | 7 ++++--- include/linux/iomap.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 5b52b878124ac..0bd6cdcbacfc4 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -1180,7 +1180,7 @@ int dax_zero_range(struct inode *inode, loff_t pos, loff_t len, bool *did_zero, .inode = inode, .pos = pos, .len = len, - .flags = IOMAP_ZERO, + .flags = IOMAP_DAX | IOMAP_ZERO, }; int ret; @@ -1308,6 +1308,7 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter, .inode = iocb->ki_filp->f_mapping->host, .pos = iocb->ki_pos, .len = iov_iter_count(iter), + .flags = IOMAP_DAX, }; loff_t done = 0; int ret; @@ -1461,7 +1462,7 @@ static vm_fault_t dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp, .inode = mapping->host, .pos = (loff_t)vmf->pgoff << PAGE_SHIFT, .len = PAGE_SIZE, - .flags = IOMAP_FAULT, + .flags = IOMAP_DAX | IOMAP_FAULT, }; vm_fault_t ret = 0; void *entry; @@ -1570,7 +1571,7 @@ static vm_fault_t dax_iomap_pmd_fault(struct vm_fault *vmf, pfn_t *pfnp, struct iomap_iter iter = { .inode = mapping->host, .len = PMD_SIZE, - .flags = IOMAP_FAULT, + .flags = IOMAP_DAX | IOMAP_FAULT, }; vm_fault_t ret = VM_FAULT_FALLBACK; pgoff_t max_pgoff; diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 6d1b08d0ae930..146a7e3e3ea11 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -141,6 +141,7 @@ struct iomap_page_ops { #define IOMAP_NOWAIT (1 << 5) /* do not block */ #define IOMAP_OVERWRITE_ONLY (1 << 6) /* only pure overwrites allowed */ #define IOMAP_UNSHARE (1 << 7) /* unshare_file_range */ +#define IOMAP_DAX (1 << 8) /* DAX mapping */ struct iomap_ops { /* -- 2.30.2