From patchwork Wed Apr 17 01:27:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ruan Shiyang X-Patchwork-Id: 10904307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4B45D922 for ; Wed, 17 Apr 2019 01:27:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 344AD28A20 for ; Wed, 17 Apr 2019 01:27:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28A0F28A26; Wed, 17 Apr 2019 01:27:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DEB1028A24 for ; Wed, 17 Apr 2019 01:27:30 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B5DE52194EB7A; Tue, 16 Apr 2019 18:27:30 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: None (no SPF record) identity=mailfrom; client-ip=183.91.158.132; helo=heian.cn.fujitsu.com; envelope-from=ruansy.fnst@cn.fujitsu.com; receiver=linux-nvdimm@lists.01.org Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by ml01.01.org (Postfix) with ESMTP id 9257B212017C0 for ; Tue, 16 Apr 2019 18:27:29 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.60,359,1549900800"; d="scan'208";a="59482918" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 17 Apr 2019 09:27:25 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 8BE494CD8477; Wed, 17 Apr 2019 09:27:23 +0800 (CST) Received: from iridescent.g08.fujitsu.local (10.167.225.140) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 17 Apr 2019 09:27:27 +0800 From: Shiyang Ruan To: , Subject: [RFC PATCH 0/4] xfs: add handle for reflink in dax Date: Wed, 17 Apr 2019 09:27:11 +0800 Message-ID: <20190417012715.8287-1-ruansy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 X-Originating-IP: [10.167.225.140] X-yoursite-MailScanner-ID: 8BE494CD8477.A514D X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: ruansy.fnst@cn.fujitsu.com X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP In XFS (under fsdax mode), reflink did not work correctly because xfs iomap operators did not handle the inode with both reflink and dax flag. This patchset aims to take care of this issue to make COW operation work correctly in XFS. XFS uses iomap to do read/write/mmap operations: vfs interface xfs: iomap_bengin(); --> xfs_iomap_begin(); actor(); --> dax_iomap_actor() / mmap actor function iomap_end(); --> xfs_iomap_end(); In xfs_iomap_begin(), COW operation is detected but not told to actor function. To resolve this, a new field 'src_addr' is added into 'struct iomap' to pass this COW info. It means the start address of source blocks in a COW operation, for actor functions to copy data before writing. In actor functions, the value of iomap->src_addr determines if it is a COW operation. If it is, copy data from source blocks to destination blocks first, and then write user data. After the COW operation, it is supposed to update the metadata of the inode. Added in xfs_iomap_end(). Shiyang Ruan (4): fs/iomap: Introduce src_addr for COW in fsdax mode. fs/xfs: iomap: add handle for reflink in fsdax mode fs/dax: copy source blocks before writing when COW fs/xfs: iomap: update the extent list after a COW fs/dax.c | 70 +++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_iomap.c | 23 +++++++++++--- include/linux/iomap.h | 4 +++ 3 files changed, 93 insertions(+), 4 deletions(-)