Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp817501pxb; Thu, 25 Feb 2021 16:24:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzRJXYrcgPUqv2p8kmGBk7S1lxZSbqeoZ7vpCnPFtgQoAG9wn240TBHtUW0ciHD1X/n1/OQ X-Received: by 2002:aa7:c493:: with SMTP id m19mr542534edq.151.1614299090979; Thu, 25 Feb 2021 16:24:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614299090; cv=none; d=google.com; s=arc-20160816; b=jKzyimHJqpTClpy7irvaWlf3m7GW5gqPJAoNm4OQ4SrYUfguaCFsZcxLeiyXjlddXG X12c0OS0Cr7LC48pvMf7aGJHJADGIX3ufc3UJ5hzHH08xx/0+MSCPUKd19FhHsn9RqOX xBb+8ejJuk6ipY8D/a2X+NbOTfFZe6rRD98Mo6VY0jUBOxqvTDfdWCo390wlegdDdita ugdZd97kzVcou1MB1Id9Xf5cWi4Fave+0+g6lBuqv3h1E+cUkbPkVmKD782ZzzlOBegM CiIqv/wRMTzB9wjhWhbgm7KXOO6dUi0eHtsQCU20LUmfU3TvLcQBvNtJNobqlB0ucdAo w3SA== 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 :message-id:date:subject:cc:to:from; bh=gO2ZGddiDPFlL0WEXzk4qgJ2EaixAAoDY3jJjGAr3cA=; b=uMuuVOIGBfaUac8nl5wW0kLA+FGkjZpz2TP0ueTEoPLOj4Pk4mLioIcsGWQwFL1F7i IROLp+iAzN23rUKaeoGh1ohLOGPmHtWAsIlJLw/s7zHFU0ToMo8EVo9O0qxVV698bT4Y E83xzNHE2Xw/8KmU6PUc403WxTODbHD0Z9mrpmNH8lNuxo79EeoMZ/xTzghuTYgWbBc2 zv8cl7Auckh9qhfZ/MktBNOYhN/UboQNoP735pkE6lNa6TTEijiLLONZ8XpzTS75foJE CjzRFXeStv96LJuddkc/WmQ4WJ6ZGnQVa4k07kiidrzylgwTzcjOxACnaW4qjSpBO3us x//Q== ARC-Authentication-Results: i=1; mx.google.com; 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 oy29si4737213ejb.498.2021.02.25.16.24.28; Thu, 25 Feb 2021 16:24:50 -0800 (PST) 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; 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 S232161AbhBZAWq (ORCPT + 99 others); Thu, 25 Feb 2021 19:22:46 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:12518 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231530AbhBZAWo (ORCPT ); Thu, 25 Feb 2021 19:22:44 -0500 X-IronPort-AV: E=Sophos;i="5.81,207,1610380800"; d="scan'208";a="104882807" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 26 Feb 2021 08:20:41 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id E41984CE1A08; Fri, 26 Feb 2021 08:20:38 +0800 (CST) Received: from G08CNEXCHPEKD04.g08.fujitsu.local (10.167.33.200) by G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 26 Feb 2021 08:20:34 +0800 Received: from irides.mr.mr.mr (10.167.225.141) by G08CNEXCHPEKD04.g08.fujitsu.local (10.167.33.209) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 26 Feb 2021 08:20:33 +0800 From: Shiyang Ruan To: , , , CC: , , , , , , , , , Subject: [PATCH v2 00/10] fsdax,xfs: Add reflink&dedupe support for fsdax Date: Fri, 26 Feb 2021 08:20:20 +0800 Message-ID: <20210226002030.653855-1-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-yoursite-MailScanner-ID: E41984CE1A08.A2B24 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: ruansy.fnst@fujitsu.com X-Spam-Status: No Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset is attempt to add CoW support for fsdax, and take XFS, which has both reflink and fsdax feature, as an example. Changes from V1: - Factor some helper functions to simplify dax fault code - Introduce iomap_apply2() for dax_dedupe_file_range_compare() - Fix mistakes and other problems - Rebased on v5.11 One of the key mechanism need to be implemented in fsdax is CoW. Copy the data from srcmap before we actually write data to the destance iomap. And we just copy range in which data won't be changed. Another mechanism is range comparison. In page cache case, readpage() is used to load data on disk to page cache in order to be able to compare data. In fsdax case, readpage() does not work. So, we need another compare data with direct access support. With the two mechanism implemented in fsdax, we are able to make reflink and fsdax work together in XFS. Some of the patches are picked up from Goldwyn's patchset. I made some changes to adapt to this patchset. (Rebased on v5.11) == Shiyang Ruan (10): fsdax: Factor helpers to simplify dax fault code fsdax: Factor helper: dax_fault_actor() fsdax: Output address in dax_iomap_pfn() and rename it fsdax: Introduce dax_iomap_cow_copy() fsdax: Replace mmap entry in case of CoW fsdax: Add dax_iomap_cow_copy() for dax_iomap_zero iomap: Introduce iomap_apply2() for operations on two files fsdax: Dedup file range to use a compare function fs/xfs: Handle CoW for fsdax write() path fs/xfs: Add dedupe support for fsdax fs/dax.c | 532 +++++++++++++++++++++++++++-------------- fs/iomap/apply.c | 51 ++++ fs/iomap/buffered-io.c | 2 +- fs/remap_range.c | 45 +++- fs/xfs/xfs_bmap_util.c | 3 +- fs/xfs/xfs_file.c | 29 ++- fs/xfs/xfs_inode.c | 8 +- fs/xfs/xfs_inode.h | 1 + fs/xfs/xfs_iomap.c | 30 ++- fs/xfs/xfs_iomap.h | 1 + fs/xfs/xfs_iops.c | 11 +- fs/xfs/xfs_reflink.c | 16 +- include/linux/dax.h | 7 +- include/linux/fs.h | 15 +- include/linux/iomap.h | 7 +- 15 files changed, 550 insertions(+), 208 deletions(-) -- 2.30.1