From patchwork Wed Nov 21 03:26:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huaisheng Ye X-Patchwork-Id: 10691707 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 C815613BB for ; Wed, 21 Nov 2018 03:27:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3EE42B40C for ; Wed, 21 Nov 2018 03:27:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A7C702B413; Wed, 21 Nov 2018 03:27:19 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,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 A4AB92B412 for ; Wed, 21 Nov 2018 03:27:18 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 36C8021A09130; Tue, 20 Nov 2018 19:27:18 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=135.84.80.237; helo=sender-pp-092.zoho.com; envelope-from=yehs2007@zoho.com; receiver=linux-nvdimm@lists.01.org Received: from sender-pp-092.zoho.com (sender-pp-092.zoho.com [135.84.80.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5CBE021A07A82 for ; Tue, 20 Nov 2018 19:27:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542770832; cv=none; d=zoho.com; s=zohoarc; b=bFhncskcP7fb0105ABDouH6A1Px0oFAqRstK/SCMBQSVDvw1C6B9vxtuuc2ykzkifB/+CW61r93ubAMouptZh+B8ku0eiDRVopO7qOfzRQMo6e57DgGIUpUFDahBHTWPSGmPU70NF0rzPC4NtrlJJxXHZFVk6DttKu0vxRoSsEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1542770832; h=Cc:Date:From:Message-ID:Subject:To:ARC-Authentication-Results; bh=RlKVwpvHCjZ1SDlUa5wjbUP+HlpARBKConxYOYaQty4=; b=kl8ipXGkk3KQ+EeXIOrY0qxPN/hG7EA/8/HyHGcQLC0sPwqb6cpgC5XhHldQNzgeg4QAZCtg0D1tSMQnH9PZIyYhRu9dy+8OLIqr9/H6nVH8moJD8G07GOoWylkHsnjV6mZ7CfaLgAbCdsSFJOFWqKwpdUAsl9yBbOdZjrCRMNM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass header.i=zoho.com; spf=pass smtp.mailfrom=yehs2007@zoho.com; dmarc=pass header.from= header.from= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=from:to:cc:subject:date:message-id; b=ZtEa9lLlMgCmKqMoHJWaofmDIoeZJlc/kQS/evaTl6ANeu2vIGkYE6OT1yEfSrB9AKbGGU9XFBA3 4PLOBKnzHZ6zXcmsb9xvaGPlE5ye+Xgm6maJH2Ik0be+Bce5R9tZ DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1542770832; s=default; d=zoho.com; i=yehs2007@zoho.com; h=From:To:Cc:Subject:Date:Message-Id; l=2048; bh=RlKVwpvHCjZ1SDlUa5wjbUP+HlpARBKConxYOYaQty4=; b=M4gwlqybHbPsXMPMkEDJLWngpUNCdgWJP7yfTicCzXHoi3yvLYWFeESFQtn/mRWt p/k6sWJGBWuLvMmpMNdixJ5wdbkTfkut+JJt2q21R2Vavf/aSfTUWF5vv9STeQ/MxOO mkz55V3Lj2PxSYiAcRk+x6TSB7r50ZvNSN/i/i0g= Received: from YEHS1XR956R00D1.lenovo.com (58.243.153.247 [58.243.153.247]) by mx.zohomail.com with SMTPS id 1542770831193408.0950458479167; Tue, 20 Nov 2018 19:27:11 -0800 (PST) From: Huaisheng Ye To: linux-nvdimm@lists.01.org, agk@redhat.com, snitzer@redhat.com, dm-devel@redhat.com, dan.j.williams@intel.com, willy@infradead.org, zwisler@kernel.org, jack@suse.cz, dave.jiang@intel.com, vishal.l.verma@intel.com Subject: [RFC PATCH v2 0/3] realize dax_operations for dm-snapshot Date: Wed, 21 Nov 2018 11:26:59 +0800 Message-Id: <20181121032702.3048-1-yehs2007@zoho.com> X-Mailer: git-send-email 2.17.0.windows.1 X-ZohoMailClient: External 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: , Cc: linux-fsdevel@vger.kernel.org, chengnt@lenovo.com, linux-kernel@vger.kernel.org MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP From: Huaisheng Ye Changes v1->v2: Add NULL funtions for origin_dax_direct_access and origin_dax_copy_from/to_iter in order to avoid building error when CONFIG_DAX_DRIVER has NOT been enabled. [v1]: https://lkml.org/lkml/2018/11/20/759 This series patches are used to realize the dax_operations for dm-snapshot with persistent memory device. Here are the steps about how to verify the function. 1. Configure the persistent memory to fs-dax mode and create namespace with ndctl; 2. find them in /dev; # ndctl list { "dev":"namespace0.0", "mode":"fsdax", "map":"dev", "size":132118478848, "sector_size":512, "blockdev":"pmem0", "name":"yhs_pmem0", "numa_node":0 }, 3. create lv_pmem (here is 4G size) for testing; # pvcreate /dev/pmem0 # vgcreate vg_pmem /dev/pmem0 # lvcreate -L 4G -n lv_pmem vg_pmem 4. create filesystem (ext2 or ext4) to /dev/pmem0 # mkfs.ext2 -b 4096 /dev/vg_pmem/lv_pmem 5. mount pmem with DAX way; # mkdir /mnt/lv_pmem # mount -o dax /dev/vg_pmem/lv_pmem /mnt/lv_pmem/ 6. cp some files to /mnt/lv_pmem; # cp linear_table03.log /mnt/lv_pmem/ # cp test0.log /mnt/lv_pmem/ 7. create snapshot for test (here I limit it to 1G size); # lvcreate -L 1G -n snap_pmem -s /dev/vg_pmem/lv_pmem 8. modify the files copied with vim or copy more other new files; # vim /mnt/lv_pmem/test0.log 9. umount the pmem device; # umount /mnt/lv_pmem/ 10.merge the snapshot back to origin; # lvconvert --merge /dev/vg_pmem/snap_pmem 11.mount pmem device again for checking the content of files; # mount -o dax /dev/vg_pmem/lv_pmem /mnt/lv_pmem/ Huaisheng Ye (3): dm: enable dax_operations for dm-snapshot dm: expand hc_map in mapped_device for lack of map dm: expand valid types for dm-ioctl drivers/md/dm-core.h | 1 + drivers/md/dm-ioctl.c | 4 +++- drivers/md/dm-snap.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- drivers/md/dm.c | 15 +++++++++++++++ 4 files changed, 68 insertions(+), 3 deletions(-)