From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751910AbcEIVT3 (ORCPT ); Mon, 9 May 2016 17:19:29 -0400 Received: from ipmail07.adl2.internode.on.net ([150.101.137.131]:59963 "EHLO ipmail07.adl2.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751057AbcEIVT2 (ORCPT ); Mon, 9 May 2016 17:19:28 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2A/FgBe/jBX/5Q5LHldgziBUoJzogUGjBqDVYIahBOGCgICAQECgTpNAQEBAQEBZidBAQEDBwaDbwEBBCcTHCMQCAMYCSUPBSUDIROIKr9aAQEIAgEdGYU/hRSKGAEEh3qFZIEyiRKOEo8hRY52YoN9KjKCDIJjhBcBAQE Date: Tue, 10 May 2016 07:19:03 +1000 From: Dave Chinner To: Dan Williams Cc: Toshi Kani , Jan Kara , Al Viro , Jens Axboe , Christoph Hellwig , Boaz Harrosh , "Theodore Ts'o" , Andreas Dilger , Ross Zwisler , micah.parrish@hpe.com, "linux-nvdimm@lists.01.org" , linux-fsdevel , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3 2/5] block: Add bdev_supports_dax() for dax mount checks Message-ID: <20160509211903.GW18496@dastard> References: <1462494596-20938-1-git-send-email-toshi.kani@hpe.com> <1462494596-20938-3-git-send-email-toshi.kani@hpe.com> <1462817565.27137.102.camel@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 09, 2016 at 11:23:03AM -0700, Dan Williams wrote: > On Mon, May 9, 2016 at 11:12 AM, Toshi Kani wrote: > > On Sun, 2016-05-08 at 12:14 -0700, Dan Williams wrote: > >> On Thu, May 5, 2016 at 5:29 PM, Toshi Kani wrote: > > : > >> > +int bdev_supports_dax(struct super_block *sb, int blocksize) > >> > +{ > >> > + struct blk_dax_ctl dax = { > >> > + .sector = 0, > >> > + .size = PAGE_SIZE, > >> > + }; > >> > + int err; > >> > + > >> > + if (blocksize != PAGE_SIZE) { > >> > + vfs_msg(sb, KERN_ERR, "error: unsupported blocksize for > >> > dax"); > >> > + return -EINVAL; > >> > + } > >> > + > >> > + err = bdev_direct_access(sb->s_bdev, &dax); > >> > + if (err < 0) { > >> > + switch (err) { > >> > + case -EOPNOTSUPP: > >> > + vfs_msg(sb, KERN_ERR, > >> > + "error: device does not support dax"); > >> > + break; > >> > + case -EINVAL: > >> > + vfs_msg(sb, KERN_ERR, > >> > + "error: unaligned partition for dax"); > >> > + break; > >> > + default: > >> > + vfs_msg(sb, KERN_ERR, > >> > + "error: dax access failed (%d)", err); > >> > + } > >> > + return err; > >> > + } > >> > + > >> > + return 0; > >> > +} > >> > +EXPORT_SYMBOL_GPL(bdev_supports_dax); > >> > >> This patch should replace blkdev_dax_capable(), or just reuse that > >> existing routine, or am I missing something? > > > > Good question. bdev_supports_dax() is a helper function tailored for the > > filesystem's mount -o dax case. While blkdev_dax_capable() is similar, it > > does not need error messages like "device does not support dax" since it > > implicitly enables dax when capable. So, I think we can keep > > blkdev_dax_capable(), but change it to call bdev_direct_access() so that > > actual check is performed in a single place. > > Sounds good to me. Can you name them consistently then? i.e. blkdev_dax_supported() and blkdev_dax_capable()? Cheers, Dave. -- Dave Chinner david@fromorbit.com