From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752807AbcF1TjG (ORCPT ); Tue, 28 Jun 2016 15:39:06 -0400 Received: from g2t1383g.austin.hpe.com ([15.233.16.89]:37770 "EHLO g2t1383g.austin.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752501AbcF1Tia (ORCPT ); Tue, 28 Jun 2016 15:38:30 -0400 From: Toshi Kani To: snitzer@redhat.com Cc: agk@redhat.com, dan.j.williams@intel.com, linux-nvdimm@ml01.01.org, dm-devel@redhat.com, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, Toshi Kani Subject: [PATCH 2/2] dm snap: add fake origin_direct_access Date: Tue, 28 Jun 2016 13:37:16 -0600 Message-Id: <1467142636-21094-3-git-send-email-toshi.kani@hpe.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1467142636-21094-1-git-send-email-toshi.kani@hpe.com> References: <1467142636-21094-1-git-send-email-toshi.kani@hpe.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dax-capable mapped-device is marked as DM_TYPE_DAX_BIO_BASED, which supports both dax and bio-based operations. dm-snap needs to work with dax-capable device when bio-based operation is used. Add fake origin_direct_access() to origin device so that its origin device is also marked as DM_TYPE_DAX_BIO_BASED for dax-capable device. This allows to extend target's DM table. dm-snap works normally when bio-based operation is used. dm-snap does not support dax operation, and mount with dax option to a target device or snapshot device fails. Signed-off-by: Toshi Kani Cc: Mike Snitzer Cc: Alasdair Kergon Cc: Dan Williams --- drivers/md/dm-snap.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 69ab1ff..c472f04 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c @@ -2301,6 +2301,13 @@ static int origin_map(struct dm_target *ti, struct bio *bio) return do_origin(o->dev, bio); } +static long origin_direct_access(struct dm_target *ti, sector_t sector, + void __pmem **kaddr, pfn_t *pfn, long size) +{ + DMWARN("device does not support dax."); + return -EIO; +} + /* * Set the target "max_io_len" field to the minimum of all the snapshots' * chunk sizes. @@ -2360,6 +2367,7 @@ static struct target_type origin_target = { .postsuspend = origin_postsuspend, .status = origin_status, .iterate_devices = origin_iterate_devices, + .direct_access = origin_direct_access, }; static struct target_type snapshot_target = {