From patchwork Wed Nov 21 03:27:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huaisheng Ye X-Patchwork-Id: 10691713 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 DCDF516B1 for ; Wed, 21 Nov 2018 03:27:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7F4B2B409 for ; Wed, 21 Nov 2018 03:27:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC3DF2B412; Wed, 21 Nov 2018 03:27:22 +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 5B0C02B409 for ; Wed, 21 Nov 2018 03:27:22 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4FB7421193761; Tue, 20 Nov 2018 19:27:22 -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 51B88211935BA for ; Tue, 20 Nov 2018 19:27:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542770838; cv=none; d=zoho.com; s=zohoarc; b=CHGL1Zk2KmvmqLdhGLV1ZTpXSyFGAsj3XhcGtsJLghv8eEbdWs1CRZSBYRR7iUq6XnFtt4jJ49PBs6jrt6M92pXMwmIqIq6Gc+MqG6K2B39UsquNgmmxqAXZ+ddrAb2AGEz4JjxT7GOPhv142I6ViEbkknEaUeyvuvML4c5tk1Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1542770838; h=Cc:Date:From:In-Reply-To:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=x5kiuOrmgRFLAeD2AslmuJBuZpUUO1Oydcg13gKN4JY=; b=ZfpysI/otcY8lDMrhinqsV0xzeastr8IbvMqQy83SKWnNwrb3KyfcWafA96+EznvH1poweMg7e6rusysoJuTMFqh2VhurtqgKfYZsZdrk0OgiSe+TbCCVjamPFHBa2n2RA+0K1O4b3KsbysLL8khA6chTLCoPGGEoMkq70meaWA= 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:in-reply-to:references; b=uMP3wH7Fa043JOBhcF3XHpl+6mC/ihtrgE7BQmN9GQQUUbUBCk2sg/hXgaiBwp51EnSnNbSDtkFs +4Ixrhq3TWeCQES79gN8sUmYrRZQtSXO8YOJ+m+uRw2H71s025/n DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1542770838; s=default; d=zoho.com; i=yehs2007@zoho.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; l=3918; bh=x5kiuOrmgRFLAeD2AslmuJBuZpUUO1Oydcg13gKN4JY=; b=TWBHnOC7CUsEFrq3IFREfEbQUz02Ook1AIiO8SEgDDJYP5eugJCXzO5Bq9oiO3jx NFefZbzoHEpuugm44PAgUqteA9LIoFNh6lc2a/rxHk7spoZXxpG5rWXv4OuwihY0YlP 98JP9KE3pjVrBw8WFSOARBfnWErR4syDJvOIv/6c= Received: from YEHS1XR956R00D1.lenovo.com (58.243.153.247 [58.243.153.247]) by mx.zohomail.com with SMTPS id 1542770837567242.21765413287517; Tue, 20 Nov 2018 19:27:17 -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 1/3] dm: enable dax_operations for dm-snapshot Date: Wed, 21 Nov 2018 11:27:00 +0800 Message-Id: <20181121032702.3048-2-yehs2007@zoho.com> X-Mailer: git-send-email 2.17.0.windows.1 In-Reply-To: <20181121032702.3048-1-yehs2007@zoho.com> References: <20181121032702.3048-1-yehs2007@zoho.com> 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 Reconstruct origin_dax_direct_access and expand functions origin_dax_copy_to/from_iter for DAX operations of dm-snapshot. Here is the call trace of origin_dax_copy_to_iter, origin_dax_copy_to_iter will callin dm-linear (-real) for further dax_operation. [518597.924019] Call Trace: [518597.927320] dump_stack+0x65/0x7e [518597.931592] origin_dax_copy_to_iter+0x51/0x78 [dm_snapshot] [518597.938494] dm_dax_copy_to_iter+0x86/0xc5 [dm_mod] [518597.944519] dax_copy_to_iter+0x27/0x29 [518597.949371] dax_iomap_actor+0x264/0x326 [518597.954308] ? trace_event_raw_event_dax_pmd_load_hole_class+0xd0/0xd0 [518597.962159] iomap_apply+0xc7/0x128 [518597.966609] ? trace_event_raw_event_dax_pmd_load_hole_class+0xd0/0xd0 [518597.974447] dax_iomap_rw+0x66/0xa8 [518597.978893] ? trace_event_raw_event_dax_pmd_load_hole_class+0xd0/0xd0 [518597.986741] ext2_file_read_iter+0x4f/0x83 [ext2] [518597.992552] __vfs_read+0x130/0x168 [518597.997001] vfs_read+0x92/0x146 [518598.001155] ksys_read+0x4f/0xa5 [518598.005308] __x64_sys_read+0x16/0x18 [518598.009942] do_syscall_64+0x88/0x15f [518598.014575] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Signed-off-by: Huaisheng Ye --- drivers/md/dm-snap.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index ae4b33d..714e26f 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "dm.h" @@ -2316,13 +2317,57 @@ static int origin_map(struct dm_target *ti, struct bio *bio) return do_origin(o->dev, bio); } +#if IS_ENABLED(CONFIG_DAX_DRIVER) static long origin_dax_direct_access(struct dm_target *ti, pgoff_t pgoff, long nr_pages, void **kaddr, pfn_t *pfn) { - DMWARN("device does not support dax."); - return -EIO; + long ret = 0; + struct dm_origin *o = ti->private; + struct block_device *bdev = o->dev->bdev; + struct dax_device *dax_dev = o->dev->dax_dev; + sector_t sector = pgoff * PAGE_SECTORS; + + ret = bdev_dax_pgoff(bdev, sector, nr_pages * PAGE_SIZE, &pgoff); + if (ret) + return ret; + + return dax_direct_access(dax_dev, pgoff, nr_pages, kaddr, pfn); +} + +static size_t origin_dax_copy_from_iter(struct dm_target *ti, pgoff_t pgoff, + void *addr, size_t bytes, struct iov_iter *i) +{ + struct dm_origin *o = ti->private; + struct block_device *bdev = o->dev->bdev; + struct dax_device *dax_dev = o->dev->dax_dev; + sector_t sector = pgoff * PAGE_SECTORS; + + if (bdev_dax_pgoff(bdev, sector, ALIGN(bytes, PAGE_SIZE), &pgoff)) + return 0; + + return dax_copy_from_iter(dax_dev, pgoff, addr, bytes, i); } +static size_t origin_dax_copy_to_iter(struct dm_target *ti, pgoff_t pgoff, + void *addr, size_t bytes, struct iov_iter *i) +{ + struct dm_origin *o = ti->private; + struct block_device *bdev = o->dev->bdev; + struct dax_device *dax_dev = o->dev->dax_dev; + sector_t sector = pgoff * PAGE_SECTORS; + + if (bdev_dax_pgoff(bdev, sector, ALIGN(bytes, PAGE_SIZE), &pgoff)) + return 0; + + return dax_copy_to_iter(dax_dev, pgoff, addr, bytes, i); +} + +#else +#define origin_dax_direct_access NULL +#define origin_dax_copy_from_iter NULL +#define origin_dax_copy_to_iter NULL +#endif + /* * Set the target "max_io_len" field to the minimum of all the snapshots' * chunk sizes. @@ -2383,6 +2428,8 @@ static int origin_iterate_devices(struct dm_target *ti, .status = origin_status, .iterate_devices = origin_iterate_devices, .direct_access = origin_dax_direct_access, + .dax_copy_to_iter = origin_dax_copy_to_iter, + .dax_copy_from_iter = origin_dax_copy_from_iter, }; static struct target_type snapshot_target = { From patchwork Wed Nov 21 03:27:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huaisheng Ye X-Patchwork-Id: 10691721 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 1A39213BB for ; Wed, 21 Nov 2018 03:27:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0522E2B409 for ; Wed, 21 Nov 2018 03:27:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDCC32B412; Wed, 21 Nov 2018 03:27:30 +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 85D2E2B409 for ; Wed, 21 Nov 2018 03:27:30 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 67FB321A07A82; Tue, 20 Nov 2018 19:27:30 -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 B6A2421A07A82 for ; Tue, 20 Nov 2018 19:27:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542770844; cv=none; d=zoho.com; s=zohoarc; b=PutmrYCjSX/yAkiVtGMFv6fByWB9BmBdKf5RKGTlqgpZmxP6jVMqL58FFMRrEMQwyjOKSZEydnRtjo+8LIcBfLt7GUTtwk5wgbA++z82Jh3cNQO5I4CkV9c9BNSV12bmmYP22pqw+taTm807hi0OY/CA32OfiGrY45Jw2rFGltI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1542770844; h=Cc:Date:From:In-Reply-To:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=jTSA+Zs1+7240+81mturwydytJwomKEmU0d3STdG9hM=; b=bfnE8FlF7gPFQv8EKrpXPCvhx37+4lzUYKru3cdwcP/2eGU2NLKlISlSPYng4q6I5YEthONzIb+Gkwr3oXJVqn4qgtIcsjyNL5EOJS0mH+HfynBYLLIzOkwA3ijNYMO94d9OLwBw/QuccVeE1+hoO1or5a3aIrEHLoeidMgOh58= 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:in-reply-to:references; b=Ha8glDJjwY5EYmOU4mjNtDx0QS9DZnvY/TBw3vHHgkQYBJ2cy9/dLUBqiang5OJwvgxy/SgP04tz 0uVYKJENFXzN2UpshzmDcRIKhbzQyLksFl4tRutK2FspT29DN2CV DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1542770844; s=default; d=zoho.com; i=yehs2007@zoho.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; l=3228; bh=jTSA+Zs1+7240+81mturwydytJwomKEmU0d3STdG9hM=; b=mQJGZ4SrTjloB8ctOUA/k3Mg81pozVm5dtN9r4ou86mGR7TSzexA1ZzlEQIBNsyY Nd84vAgpNArua5+7lN1a/rFdBL5LVmcC+9tj41Ycqnb26wIXl0WAE032TXgXv9fv0LU TpWFhPSZw3cPffmvYLnaO9YP+o0m5dVoMc1ikz24= Received: from YEHS1XR956R00D1.lenovo.com (58.243.153.247 [58.243.153.247]) by mx.zohomail.com with SMTPS id 1542770842498985.7941611476728; Tue, 20 Nov 2018 19:27:22 -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 2/3] dm: expand hc_map in mapped_device for lack of map Date: Wed, 21 Nov 2018 11:27:01 +0800 Message-Id: <20181121032702.3048-3-yehs2007@zoho.com> X-Mailer: git-send-email 2.17.0.windows.1 In-Reply-To: <20181121032702.3048-1-yehs2007@zoho.com> References: <20181121032702.3048-1-yehs2007@zoho.com> 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 Sometimes dm_swap_table couldn't be used in time. For example, during the origin construction of dm-snapshot, the sys_ioctl table_load will try to detect the lower device origin-real whether support direct access or not. But origin-real md's struct dm-table pointer has not yet been assigned real address in time by dev_suspend. So I expand hc_map for get the address from struct hash_cell directly in this case. Here is the call trace, dm_dax_direct_access will call dm_dax_get_live_target for get the struct dm_table pointer. [ 213.975827] Call Trace: [ 213.975832] dump_stack+0x5a/0x73 [ 213.975840] dm_dax_direct_access+0x12b/0x1b0 [dm_mod] [ 213.975845] dax_direct_access+0x2d/0x60 [ 213.975848] __bdev_dax_supported+0x162/0x2a0 [ 213.975851] ? dump_stack+0x5a/0x73 [ 213.975859] device_supports_dax+0x15/0x20 [dm_mod] [ 213.975867] dm_table_supports_dax.isra.13+0x7d/0xa0 [dm_mod] [ 213.975875] dm_table_complete+0x3fb/0x750 [dm_mod] [ 213.975883] table_load+0x19a/0x390 [dm_mod] [ 213.975891] ? retrieve_status+0x1c0/0x1c0 [dm_mod] [ 213.975898] ctl_ioctl+0x1d8/0x450 [dm_mod] [ 213.975909] dm_ctl_ioctl+0xa/0x10 [dm_mod] [ 213.975913] do_vfs_ioctl+0xa9/0x620 [ 213.975918] ? syscall_trace_enter+0x1c9/0x2b0 [ 213.975923] ksys_ioctl+0x60/0x90 [ 213.975927] __x64_sys_ioctl+0x16/0x20 [ 213.975931] do_syscall_64+0x5b/0x180 [ 213.975936] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Signed-off-by: Huaisheng Ye --- drivers/md/dm-core.h | 1 + drivers/md/dm-ioctl.c | 1 + drivers/md/dm.c | 15 +++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/drivers/md/dm-core.h b/drivers/md/dm-core.h index 224d445..5577d90 100644 --- a/drivers/md/dm-core.h +++ b/drivers/md/dm-core.h @@ -40,6 +40,7 @@ struct mapped_device { * dereference. */ void __rcu *map; + struct dm_table *hc_map; unsigned long flags; diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index f666778..a27016e 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c @@ -1365,6 +1365,7 @@ static int table_load(struct file *filp, struct dm_ioctl *param, size_t param_si if (hc->new_map) old_map = hc->new_map; hc->new_map = t; + hc->md->hc_map = hc->new_map; up_write(&_hash_lock); param->flags |= DM_INACTIVE_PRESENT_FLAG; diff --git a/drivers/md/dm.c b/drivers/md/dm.c index c510179..19b48bb 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1080,6 +1080,21 @@ static struct dm_target *dm_dax_get_live_target(struct mapped_device *md, struct dm_target *ti; map = dm_get_live_table(md, srcu_idx); + if (!map) { + /* Sometimes dm_swap_table couldn't be used in time. + * + * For example, during the origin construction of + * dm-snapshot, the sys_ioctl table_load will try to + * detect the lower device origin-real whether support + * direct access or not. But origin-real device md's struct + * dm-table pointer has not yet been assigned real address. + * So hc_map has been used for get the address from + * struct hash_cell directly. + */ + DMINFO("failed to get map, use hc_map insteadly"); + map = md->hc_map; + } + if (!map) return NULL; From patchwork Wed Nov 21 03:27:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huaisheng Ye X-Patchwork-Id: 10691729 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 ED7EB13BB for ; Wed, 21 Nov 2018 03:27:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7D272B40C for ; Wed, 21 Nov 2018 03:27:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC63C2B413; Wed, 21 Nov 2018 03:27:35 +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 88F0B2B40C for ; Wed, 21 Nov 2018 03:27:35 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 80756211935BD; Tue, 20 Nov 2018 19:27:35 -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 D6DBE2097F57C for ; Tue, 20 Nov 2018 19:27:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542770850; cv=none; d=zoho.com; s=zohoarc; b=HqRpAU2QJYFlyRlP2HAtbKV5Nkbgm3zs8K+e1epfj5F6EU/KaBGwGutx9fUrkRwqdM+K3ixiNGoTSdKw43TkCBElveD1iXbekHGLq4oEhY1/9xxH9QteVI5prnPcTSPhWnEqba1oOUOsO6qdJn8XFy6sTCFHdRjMDsEQRAGdJqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1542770850; h=Cc:Date:From:In-Reply-To:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=GHh1ilgk8ZdCIo8lwzMZINvkNuuU7rjdcC8nSOe4YS4=; b=P/a36/jZXuJd0zloqWt9aVZn/hOpSUSUDvSPegyT5N3WnY3cpERjhuo01PH3xKHGZ86zFyyBM7MFR7Vkj2Cvsm04VMdR8HUnVd26PvcWfSpq/PhdwqP60FF0rUXcOnoR4gETgaOkI59kbbUHFyE2uqn88Twu+9Rj42N9j8euIgM= 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:in-reply-to:references; b=HonwnfQeTzGWRJf/BUR7ZCsjCnI8jY1YspYxRXqdc0ZHqlNqWWW0h3B1bjrGPrbu+nAv/EWjWP5C Tp2azGgUK+MVMQDYXh6GebWB5lCjurMoNtDIszAyIiJ6XdXJmmL6 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1542770850; s=default; d=zoho.com; i=yehs2007@zoho.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; l=1150; bh=GHh1ilgk8ZdCIo8lwzMZINvkNuuU7rjdcC8nSOe4YS4=; b=M6Lvmv/VwGyYT4m0e+UOt/Xn6zEzHb3MVK6vPfb5c+8ZK3PxFcik5ACEe/2wlbnP Heu75WHAXyQ7qPguULix8PdXsfLzHQp9xcfFYKFXk4H5muFSeyDsjWbkpxSCJ690lsL M+AoAl0Q4trWC2dRCAryGb72bvYFXM7XgjtZ6SEc= Received: from YEHS1XR956R00D1.lenovo.com (58.243.153.247 [58.243.153.247]) by mx.zohomail.com with SMTPS id 1542770848969100.83345673388703; Tue, 20 Nov 2018 19:27:28 -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 3/3] dm: expand valid types for dm-ioctl Date: Wed, 21 Nov 2018 11:27:02 +0800 Message-Id: <20181121032702.3048-4-yehs2007@zoho.com> X-Mailer: git-send-email 2.17.0.windows.1 In-Reply-To: <20181121032702.3048-1-yehs2007@zoho.com> References: <20181121032702.3048-1-yehs2007@zoho.com> 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 If use DAX way to mount the origin device of dm_snapshot, when merging back snapshot to origin, system call table_load during the construction of snapshot-merge will try to detect new dm_table's type equals to the existed md's type or not. The existed type equals to DM_TYPE_DAX_BIO_BASED, but the new created type belongs to DM_TYPE_BIO_BASED. So, we need to expand valid_type in function is_valid_type. Signed-off-by: Huaisheng Ye --- drivers/md/dm-ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index a27016e..158d657 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c @@ -1295,7 +1295,8 @@ static int populate_table(struct dm_table *table, static bool is_valid_type(enum dm_queue_mode cur, enum dm_queue_mode new) { if (cur == new || - (cur == DM_TYPE_BIO_BASED && new == DM_TYPE_DAX_BIO_BASED)) + (cur == DM_TYPE_BIO_BASED && new == DM_TYPE_DAX_BIO_BASED) || + (cur == DM_TYPE_DAX_BIO_BASED && new == DM_TYPE_BIO_BASED)) return true; return false;