From patchwork Mon Jun 13 22:21:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kani, Toshi" X-Patchwork-Id: 9174575 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1689F6075D for ; Mon, 13 Jun 2016 22:33:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0902726861 for ; Mon, 13 Jun 2016 22:33:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1CBC27C0C; Mon, 13 Jun 2016 22:33:37 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA0C526861 for ; Mon, 13 Jun 2016 22:33:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424534AbcFMWbx (ORCPT ); Mon, 13 Jun 2016 18:31:53 -0400 Received: from g4t3425.houston.hpe.com ([15.241.140.78]:30035 "EHLO g4t3425.houston.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422932AbcFMWbv (ORCPT ); Mon, 13 Jun 2016 18:31:51 -0400 Received: from g9t2301.houston.hpecorp.net (g9t2301.houston.hpecorp.net [16.220.97.129]) by g4t3425.houston.hpe.com (Postfix) with ESMTP id C15A14E; Mon, 13 Jun 2016 22:31:50 +0000 (UTC) Received: from misato.fc.hp.com (misato.fc.hp.com [16.78.168.61]) by g9t2301.houston.hpecorp.net (Postfix) with ESMTP id D0E134C; Mon, 13 Jun 2016 22:31:49 +0000 (UTC) From: Toshi Kani To: agk@redhat.com, snitzer@redhat.com, dan.j.williams@intel.com Cc: ross.zwisler@linux.intel.com, viro@zeniv.linux.org.uk, axboe@kernel.dk, toshi.kani@hpe.com, linux-nvdimm@lists.01.org, dm-devel@redhat.com, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, Subject: [PATCH 2/6] block: Check GENHD_FL_DAX for DAX capability Date: Mon, 13 Jun 2016 16:21:33 -0600 Message-Id: <1465856497-19698-3-git-send-email-toshi.kani@hpe.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465856497-19698-1-git-send-email-toshi.kani@hpe.com> References: <1465856497-19698-1-git-send-email-toshi.kani@hpe.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that GENHD_FL_DAX is set to all drivers supporting DAX, change bdev_direct_access() and __blkdev_get() to check this GENHD_FL_DAX flag. Signed-off-by: Toshi Kani Cc: Alexander Viro Cc: Dan Williams Cc: Ross Zwisler Cc: --- fs/block_dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/block_dev.c b/fs/block_dev.c index 71ccab1..61935ee 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -493,7 +493,7 @@ long bdev_direct_access(struct block_device *bdev, struct blk_dax_ctl *dax) if (size < 0) return size; - if (!ops->direct_access) + if (!(bdev->bd_disk->flags & GENHD_FL_DAX) || !ops->direct_access) return -EOPNOTSUPP; if ((sector + DIV_ROUND_UP(size, 512)) > part_nr_sects_read(bdev->bd_part)) @@ -1287,7 +1287,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) bdev->bd_disk = disk; bdev->bd_queue = disk->queue; bdev->bd_contains = bdev; - if (IS_ENABLED(CONFIG_BLK_DEV_DAX) && disk->fops->direct_access) + if (IS_ENABLED(CONFIG_BLK_DEV_DAX) && + disk->flags & GENHD_FL_DAX) bdev->bd_inode->i_flags = S_DAX; else bdev->bd_inode->i_flags = 0;