[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1462817565.27137.102.camel@hpe.com>
Date: Mon, 09 May 2016 12:12:45 -0600
From: Toshi Kani <toshi.kani@....com>
To: Dan Williams <dan.j.williams@...el.com>
Cc: Jan Kara <jack@...e.cz>, david <david@...morbit.com>,
Al Viro <viro@...iv.linux.org.uk>, Jens Axboe <axboe@...com>,
Christoph Hellwig <hch@...radead.org>,
Boaz Harrosh <boaz@...xistor.com>,
Theodore Ts'o <tytso@....edu>,
Andreas Dilger <adilger.kernel@...ger.ca>,
Ross Zwisler <ross.zwisler@...ux.intel.com>,
micah.parrish@....com,
"linux-nvdimm@...ts.01.org" <linux-nvdimm@...ts.01.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 2/5] block: Add bdev_supports_dax() for dax mount
checks
On Sun, 2016-05-08 at 12:14 -0700, Dan Williams wrote:
> On Thu, May 5, 2016 at 5:29 PM, Toshi Kani <toshi.kani@....com> 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.
Thanks,
-Toshi
Powered by blists - more mailing lists