Re: [PATCH v4 6/6] block: Update blkdev_dax_capable() for consistency

From: Toshi Kani
Date: Tue May 10 2016 - 17:45:33 EST


On Tue, 2016-05-10 at 12:49 -0700, Dan Williams wrote:
> On Tue, May 10, 2016 at 9:23 AM, Toshi Kani <toshi.kani@xxxxxxx> wrote:
> >
> > blkdev_dax_capable() is similar to bdev_dax_supported(), but needs
> > to remain as a separate interface for checking dax capability of
> > a raw block device.
> >
> > Rename and relocate blkdev_dax_capable() to keep them maintained
> > consistently, and call bdev_direct_access() for the dax capability
> > check.
> >
> > There is no change in the behavior.
Â:
> > diff --git a/block/ioctl.c b/block/ioctl.c
> > index 4ff1f92..7eeda07 100644
> > --- a/block/ioctl.c
> > +++ b/block/ioctl.c
> > @@ -4,7 +4,6 @@
> > Â#include <linux/gfp.h>
> > Â#include <linux/blkpg.h>
> > Â#include <linux/hdreg.h>
> > -#include <linux/badblocks.h>
> > Â#include <linux/backing-dev.h>
> > Â#include <linux/fs.h>
> > Â#include <linux/blktrace_api.h>
> > @@ -407,35 +406,6 @@ static inline int is_unrecognized_ioctl(int ret)
> > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂret == -ENOIOCTLCMD;
> > Â}
> >
> > -#ifdef CONFIG_FS_DAX
> > -bool blkdev_dax_capable(struct block_device *bdev)
> > -{
> > -ÂÂÂÂÂÂÂstruct gendisk *disk = bdev->bd_disk;
> > -
> > -ÂÂÂÂÂÂÂif (!disk->fops->direct_access)
> > -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn false;
> > -
> > -ÂÂÂÂÂÂÂ/*
> > -ÂÂÂÂÂÂÂÂ* If the partition is not aligned on a page boundary, we can't
> > -ÂÂÂÂÂÂÂÂ* do dax I/O to it.
> > -ÂÂÂÂÂÂÂÂ*/
> > -ÂÂÂÂÂÂÂif ((bdev->bd_part->start_sect % (PAGE_SIZE / 512))
> > -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|| (bdev->bd_part->nr_sects % (PAGE_SIZE /
> > 512)))
> > -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn false;
> > -
> > -ÂÂÂÂÂÂÂ/*
> > -ÂÂÂÂÂÂÂÂ* If the device has known bad blocks, force all I/O through
> > the
> > -ÂÂÂÂÂÂÂÂ* driver / page cache.
> > -ÂÂÂÂÂÂÂÂ*
> > -ÂÂÂÂÂÂÂÂ* TODO: support finer grained dax error handling
> > -ÂÂÂÂÂÂÂÂ*/
> > -ÂÂÂÂÂÂÂif (disk->bb && disk->bb->count)
> > -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn false;
> > -
> > -ÂÂÂÂÂÂÂreturn true;
> > -}
> > -#endif
>
> This will collide with my pending change to revert raw block device
> dax support, and also with Vishal's DAX error handling changes.ÂÂFor
> coordination purposes I'm thining this should all go on top of the
> branch that Vishal is putting together with the dax zeroing changes
> from Jan and Christoph as well.

This patch does not depend on the rest of the series, so it can be handled
separately. ÂThere is a minor conflict -- bdev_dax_capable() is put under
bdev_dax_supported() in the same file. ÂThis should be easy to resolve, but
let me know if you need me to merge it up.

Thanks,
-Toshi