* [PATCH v4 0/6] Add alignment check for DAX mount
@ 2016-05-10 16:23 Toshi Kani
2016-05-10 16:23 ` [PATCH v4 1/6] block: Add vfs_msg() interface Toshi Kani
` (7 more replies)
0 siblings, 8 replies; 23+ messages in thread
From: Toshi Kani @ 2016-05-10 16:23 UTC (permalink / raw)
To: dan.j.williams, jack, david, viro
Cc: axboe, hch, boaz, tytso, adilger.kernel, ross.zwisler, toshi.kani,
micah.parrish, linux-nvdimm, linux-fsdevel, linux-block,
linux-kernel
When a partition is not aligned by 4KB, mount -o dax succeeds,
but any read/write access to the filesystem fails, except for
metadata update. Add alignment check to ext4, ext2, and xfs.
- Patch 1-2 add bdev_dax_supported() which performs all the checks
necessary for dax mount.
- Patch 3-5 change fillesystems to call bdev_dax_supported().
- Patch 6 is a cleanup to keep dax capability checks consistent.
v4:
- blkdev_dax_capable() is similar to bdev_dax_supported().
Manage them consistently. (Dan Williams, Dave Chinner)
v3:
- Remove boilerplate code from filesytems (Christoph Hellwig)
- Add a helper function to perform all checks (Dave Chinner)
v2:
- Use a helper function via ->direct_access for the check.
(Christoph Hellwig)
- Call bdev_direct_access() with sector 0 for the check.
(Boaz Harrosh)
---
Toshi Kani (6):
1/6 block: Add vfs_msg() interface
2/6 block: Add bdev_dax_supported() for dax mount checks
3/6 ext4: Add alignment check for DAX mount
4/6 ext2: Add alignment check for DAX mount
5/6 xfs: Add alignment check for DAX mount
6/6 block: Update blkdev_dax_capable() for consistency
---
block/ioctl.c | 30 ----------------
fs/block_dev.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++++--
fs/ext2/super.c | 11 ++----
fs/ext4/super.c | 11 ++----
fs/xfs/xfs_super.c | 12 +++----
include/linux/blkdev.h | 13 +++++++
include/linux/fs.h | 8 -----
7 files changed, 116 insertions(+), 65 deletions(-)
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v4 1/6] block: Add vfs_msg() interface
2016-05-10 16:23 [PATCH v4 0/6] Add alignment check for DAX mount Toshi Kani
@ 2016-05-10 16:23 ` Toshi Kani
2016-05-10 16:23 ` [PATCH v4 2/6] block: Add bdev_dax_supported() for dax mount checks Toshi Kani
` (6 subsequent siblings)
7 siblings, 0 replies; 23+ messages in thread
From: Toshi Kani @ 2016-05-10 16:23 UTC (permalink / raw)
To: dan.j.williams, jack, david, viro
Cc: axboe, hch, boaz, tytso, adilger.kernel, ross.zwisler, toshi.kani,
micah.parrish, linux-nvdimm, linux-fsdevel, linux-block,
linux-kernel
In preparation of moving DAX capability checks to the block layer
from filesystem code, add a VFS message interface that aligns with
filesystem's message format.
For instance, a vfs_msg() message followed by XFS messages in case
of a dax mount error may look like:
VFS (pmem0p1): error: unaligned partition for dax
XFS (pmem0p1): DAX unsupported by block device. Turning off DAX.
XFS (pmem0p1): Mounting V5 Filesystem
:
vfs_msg() is largely based on ext4_msg().
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Jens Axboe <axboe@fb.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Jan Kara <jack@suse.cz>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Boaz Harrosh <boaz@plexistor.com>
---
fs/block_dev.c | 12 ++++++++++++
include/linux/blkdev.h | 11 +++++++++++
2 files changed, 23 insertions(+)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 20a2c02..7be17c4 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -50,6 +50,18 @@ struct block_device *I_BDEV(struct inode *inode)
}
EXPORT_SYMBOL(I_BDEV);
+void __vfs_msg(struct super_block *sb, const char *prefix, const char *fmt, ...)
+{
+ struct va_format vaf;
+ va_list args;
+
+ va_start(args, fmt);
+ vaf.fmt = fmt;
+ vaf.va = &args;
+ printk_ratelimited("%sVFS (%s): %pV\n", prefix, sb->s_id, &vaf);
+ va_end(args);
+}
+
static void bdev_write_inode(struct block_device *bdev)
{
struct inode *inode = bdev->bd_inode;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 669e419..78c48ab 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -767,6 +767,17 @@ static inline void rq_flush_dcache_pages(struct request *rq)
}
#endif
+#ifdef CONFIG_PRINTK
+#define vfs_msg(sb, level, fmt, ...) \
+ __vfs_msg(sb, level, fmt, ##__VA_ARGS__)
+#else
+#define vfs_msg(sb, level, fmt, ...) \
+do { \
+ no_printk(fmt, ##__VA_ARGS__); \
+ __vfs_msg(sb, "", " "); \
+} while (0)
+#endif
+
extern int blk_register_queue(struct gendisk *disk);
extern void blk_unregister_queue(struct gendisk *disk);
extern blk_qc_t generic_make_request(struct bio *bio);
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v4 2/6] block: Add bdev_dax_supported() for dax mount checks
2016-05-10 16:23 [PATCH v4 0/6] Add alignment check for DAX mount Toshi Kani
2016-05-10 16:23 ` [PATCH v4 1/6] block: Add vfs_msg() interface Toshi Kani
@ 2016-05-10 16:23 ` Toshi Kani
2016-05-10 16:23 ` [PATCH v4 3/6] ext4: Add alignment check for DAX mount Toshi Kani
` (5 subsequent siblings)
7 siblings, 0 replies; 23+ messages in thread
From: Toshi Kani @ 2016-05-10 16:23 UTC (permalink / raw)
To: dan.j.williams, jack, david, viro
Cc: axboe, hch, boaz, tytso, adilger.kernel, ross.zwisler, toshi.kani,
micah.parrish, linux-nvdimm, linux-fsdevel, linux-block,
linux-kernel
DAX imposes additional requirements to a device. Add
bdev_dax_supported() which performs all the precondition checks
necessary for filesystem to mount the device with dax option.
Also add a new check to verify if a partition is aligned by 4KB.
When a partition is unaligned, any dax read/write access fails,
except for metadata update.
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Jens Axboe <axboe@fb.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Jan Kara <jack@suse.cz>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Boaz Harrosh <boaz@plexistor.com>
---
fs/block_dev.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
include/linux/blkdev.h | 1 +
2 files changed, 46 insertions(+)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 7be17c4..db55638 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -509,6 +509,51 @@ long bdev_direct_access(struct block_device *bdev, struct blk_dax_ctl *dax)
}
EXPORT_SYMBOL_GPL(bdev_direct_access);
+/**
+ * bdev_dax_supported() - Check if the device supports dax for filesystem
+ * @sb: The superblock of the device
+ * @blocksize: The block size of the device
+ *
+ * This is a library function for filesystems to check if the block device
+ * can be mounted with dax option.
+ *
+ * Return: negative errno if unsupported, 0 if supported.
+ */
+int bdev_dax_supported(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_dax_supported);
+
/*
* pseudo-fs
*/
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 78c48ab..71231a5 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1688,6 +1688,7 @@ extern int bdev_read_page(struct block_device *, sector_t, struct page *);
extern int bdev_write_page(struct block_device *, sector_t, struct page *,
struct writeback_control *);
extern long bdev_direct_access(struct block_device *, struct blk_dax_ctl *);
+extern int bdev_dax_supported(struct super_block *, int);
#else /* CONFIG_BLOCK */
struct block_device;
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v4 3/6] ext4: Add alignment check for DAX mount
2016-05-10 16:23 [PATCH v4 0/6] Add alignment check for DAX mount Toshi Kani
2016-05-10 16:23 ` [PATCH v4 1/6] block: Add vfs_msg() interface Toshi Kani
2016-05-10 16:23 ` [PATCH v4 2/6] block: Add bdev_dax_supported() for dax mount checks Toshi Kani
@ 2016-05-10 16:23 ` Toshi Kani
2016-05-10 16:23 ` [PATCH v4 4/6] ext2: " Toshi Kani
` (4 subsequent siblings)
7 siblings, 0 replies; 23+ messages in thread
From: Toshi Kani @ 2016-05-10 16:23 UTC (permalink / raw)
To: dan.j.williams, jack, david, viro
Cc: axboe, hch, boaz, tytso, adilger.kernel, ross.zwisler, toshi.kani,
micah.parrish, linux-nvdimm, linux-fsdevel, linux-block,
linux-kernel
When a partition is not aligned by 4KB, mount -o dax succeeds,
but any read/write access to the filesystem fails, except for
metadata update.
Call bdev_dax_supported() to perform proper precondition checks
which includes this partition alignment check.
Reported-by: Micah Parrish <micah.parrish@hpe.com>
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Jan Kara <jack@suse.cz>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Boaz Harrosh <boaz@plexistor.com>
---
fs/ext4/super.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 304c712..6925e86 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3416,16 +3416,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
}
if (sbi->s_mount_opt & EXT4_MOUNT_DAX) {
- if (blocksize != PAGE_SIZE) {
- ext4_msg(sb, KERN_ERR,
- "error: unsupported blocksize for dax");
- goto failed_mount;
- }
- if (!sb->s_bdev->bd_disk->fops->direct_access) {
- ext4_msg(sb, KERN_ERR,
- "error: device does not support dax");
+ err = bdev_dax_supported(sb, blocksize);
+ if (err)
goto failed_mount;
- }
}
if (ext4_has_feature_encrypt(sb) && es->s_encryption_level) {
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v4 4/6] ext2: Add alignment check for DAX mount
2016-05-10 16:23 [PATCH v4 0/6] Add alignment check for DAX mount Toshi Kani
` (2 preceding siblings ...)
2016-05-10 16:23 ` [PATCH v4 3/6] ext4: Add alignment check for DAX mount Toshi Kani
@ 2016-05-10 16:23 ` Toshi Kani
2016-05-10 16:23 ` [PATCH v4 5/6] xfs: " Toshi Kani
` (3 subsequent siblings)
7 siblings, 0 replies; 23+ messages in thread
From: Toshi Kani @ 2016-05-10 16:23 UTC (permalink / raw)
To: dan.j.williams, jack, david, viro
Cc: axboe, hch, boaz, tytso, adilger.kernel, ross.zwisler, toshi.kani,
micah.parrish, linux-nvdimm, linux-fsdevel, linux-block,
linux-kernel
When a partition is not aligned by 4KB, mount -o dax succeeds,
but any read/write access to the filesystem fails, except for
metadata update.
Call bdev_dax_supported() to perform proper precondition checks
which includes this partition alignment check.
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Jan Kara <jack@suse.cz>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Boaz Harrosh <boaz@plexistor.com>
---
fs/ext2/super.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index b78caf2..1d93795 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -922,16 +922,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);
if (sbi->s_mount_opt & EXT2_MOUNT_DAX) {
- if (blocksize != PAGE_SIZE) {
- ext2_msg(sb, KERN_ERR,
- "error: unsupported blocksize for dax");
+ err = bdev_dax_supported(sb, blocksize);
+ if (err)
goto failed_mount;
- }
- if (!sb->s_bdev->bd_disk->fops->direct_access) {
- ext2_msg(sb, KERN_ERR,
- "error: device does not support dax");
- goto failed_mount;
- }
}
/* If the blocksize doesn't match, re-read the thing.. */
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v4 5/6] xfs: Add alignment check for DAX mount
2016-05-10 16:23 [PATCH v4 0/6] Add alignment check for DAX mount Toshi Kani
` (3 preceding siblings ...)
2016-05-10 16:23 ` [PATCH v4 4/6] ext2: " Toshi Kani
@ 2016-05-10 16:23 ` Toshi Kani
2016-05-10 16:23 ` [PATCH v4 6/6] block: Update blkdev_dax_capable() for consistency Toshi Kani
` (2 subsequent siblings)
7 siblings, 0 replies; 23+ messages in thread
From: Toshi Kani @ 2016-05-10 16:23 UTC (permalink / raw)
To: dan.j.williams, jack, david, viro
Cc: axboe, hch, boaz, tytso, adilger.kernel, ross.zwisler, toshi.kani,
micah.parrish, linux-nvdimm, linux-fsdevel, linux-block,
linux-kernel
When a partition is not aligned by 4KB, mount -o dax succeeds,
but any read/write access to the filesystem fails, except for
metadata update.
Call bdev_dax_supported() to perform proper precondition checks
which includes this partition alignment check.
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Boaz Harrosh <boaz@plexistor.com>
---
fs/xfs/xfs_super.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 187e14b..39f4e6a 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1558,14 +1558,12 @@ xfs_fs_fill_super(
if (mp->m_flags & XFS_MOUNT_DAX) {
xfs_warn(mp,
- "DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
- if (sb->s_blocksize != PAGE_SIZE) {
- xfs_alert(mp,
- "Filesystem block size invalid for DAX Turning DAX off.");
- mp->m_flags &= ~XFS_MOUNT_DAX;
- } else if (!sb->s_bdev->bd_disk->fops->direct_access) {
+ "DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
+
+ error = bdev_dax_supported(sb, sb->s_blocksize);
+ if (error) {
xfs_alert(mp,
- "Block device does not support DAX Turning DAX off.");
+ "DAX unsupported by block device. Turning off DAX.");
mp->m_flags &= ~XFS_MOUNT_DAX;
}
}
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v4 6/6] block: Update blkdev_dax_capable() for consistency
2016-05-10 16:23 [PATCH v4 0/6] Add alignment check for DAX mount Toshi Kani
` (4 preceding siblings ...)
2016-05-10 16:23 ` [PATCH v4 5/6] xfs: " Toshi Kani
@ 2016-05-10 16:23 ` Toshi Kani
2016-05-10 19:49 ` Dan Williams
` (3 more replies)
2016-05-11 13:20 ` [PATCH v4 0/6] Add alignment check for DAX mount Carlos Maiolino
2016-05-19 23:37 ` Eric Sandeen
7 siblings, 4 replies; 23+ messages in thread
From: Toshi Kani @ 2016-05-10 16:23 UTC (permalink / raw)
To: dan.j.williams, jack, david, viro
Cc: axboe, hch, boaz, tytso, adilger.kernel, ross.zwisler, toshi.kani,
micah.parrish, linux-nvdimm, linux-fsdevel, linux-block,
linux-kernel
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.
Link: https://lkml.org/lkml/2016/5/9/950
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Jens Axboe <axboe@fb.com>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Jan Kara <jack@suse.cz>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Boaz Harrosh <boaz@plexistor.com>
---
block/ioctl.c | 30 ------------------------------
fs/block_dev.c | 39 +++++++++++++++++++++++++++++++++++++--
include/linux/blkdev.h | 1 +
include/linux/fs.h | 8 --------
4 files changed, 38 insertions(+), 40 deletions(-)
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
-
static int blkdev_flushbuf(struct block_device *bdev, fmode_t mode,
unsigned cmd, unsigned long arg)
{
diff --git a/fs/block_dev.c b/fs/block_dev.c
index db55638..5d79093 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -29,6 +29,7 @@
#include <linux/log2.h>
#include <linux/cleancache.h>
#include <linux/dax.h>
+#include <linux/badblocks.h>
#include <asm/uaccess.h>
#include "internal.h"
@@ -554,6 +555,40 @@ int bdev_dax_supported(struct super_block *sb, int blocksize)
}
EXPORT_SYMBOL_GPL(bdev_dax_supported);
+/**
+ * bdev_dax_capable() - Return if the raw device is capable for dax
+ * @bdev: The device for raw block device access
+ */
+bool bdev_dax_capable(struct block_device *bdev)
+{
+ struct gendisk *disk = bdev->bd_disk;
+ struct blk_dax_ctl dax = {
+ .size = PAGE_SIZE,
+ };
+
+ if (!IS_ENABLED(CONFIG_FS_DAX))
+ return false;
+
+ dax.sector = 0;
+ if (bdev_direct_access(bdev, &dax) < 0)
+ return false;
+
+ dax.sector = bdev->bd_part->nr_sects - (PAGE_SIZE / 512);
+ if (bdev_direct_access(bdev, &dax) < 0)
+ 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;
+}
+
/*
* pseudo-fs
*/
@@ -1295,7 +1330,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
if (!ret) {
bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
- if (!blkdev_dax_capable(bdev))
+ if (!bdev_dax_capable(bdev))
bdev->bd_inode->i_flags &= ~S_DAX;
}
@@ -1332,7 +1367,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
goto out_clear;
}
bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9);
- if (!blkdev_dax_capable(bdev))
+ if (!bdev_dax_capable(bdev))
bdev->bd_inode->i_flags &= ~S_DAX;
}
} else {
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 71231a5..27cbefe 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1689,6 +1689,7 @@ extern int bdev_write_page(struct block_device *, sector_t, struct page *,
struct writeback_control *);
extern long bdev_direct_access(struct block_device *, struct blk_dax_ctl *);
extern int bdev_dax_supported(struct super_block *, int);
+extern bool bdev_dax_capable(struct block_device *);
#else /* CONFIG_BLOCK */
struct block_device;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 70e61b5..8363a10 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2320,14 +2320,6 @@ extern struct super_block *freeze_bdev(struct block_device *);
extern void emergency_thaw_all(void);
extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
extern int fsync_bdev(struct block_device *);
-#ifdef CONFIG_FS_DAX
-extern bool blkdev_dax_capable(struct block_device *bdev);
-#else
-static inline bool blkdev_dax_capable(struct block_device *bdev)
-{
- return false;
-}
-#endif
extern struct super_block *blockdev_superblock;
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH v4 6/6] block: Update blkdev_dax_capable() for consistency
2016-05-10 16:23 ` [PATCH v4 6/6] block: Update blkdev_dax_capable() for consistency Toshi Kani
@ 2016-05-10 19:49 ` Dan Williams
2016-05-10 21:36 ` Toshi Kani
2016-05-11 8:05 ` Jan Kara
` (2 subsequent siblings)
3 siblings, 1 reply; 23+ messages in thread
From: Dan Williams @ 2016-05-10 19:49 UTC (permalink / raw)
To: Toshi Kani
Cc: Jan Kara, david, Al Viro, Jens Axboe, Christoph Hellwig,
Boaz Harrosh, Theodore Ts'o, Andreas Dilger, Ross Zwisler,
micah.parrish, linux-nvdimm@lists.01.org, linux-fsdevel,
linux-block, linux-kernel@vger.kernel.org, Vishal L Verma
On Tue, May 10, 2016 at 9:23 AM, Toshi Kani <toshi.kani@hpe.com> 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.
>
> Link: https://lkml.org/lkml/2016/5/9/950
> Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> Cc: Jens Axboe <axboe@fb.com>
> Cc: Andreas Dilger <adilger.kernel@dilger.ca>
> Cc: Jan Kara <jack@suse.cz>
> Cc: Dave Chinner <david@fromorbit.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
> Cc: Christoph Hellwig <hch@infradead.org>
> Cc: Boaz Harrosh <boaz@plexistor.com>
> ---
> block/ioctl.c | 30 ------------------------------
> fs/block_dev.c | 39 +++++++++++++++++++++++++++++++++++++--
> include/linux/blkdev.h | 1 +
> include/linux/fs.h | 8 --------
> 4 files changed, 38 insertions(+), 40 deletions(-)
>
> 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.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 6/6] block: Update blkdev_dax_capable() for consistency
2016-05-10 19:49 ` Dan Williams
@ 2016-05-10 21:36 ` Toshi Kani
0 siblings, 0 replies; 23+ messages in thread
From: Toshi Kani @ 2016-05-10 21:36 UTC (permalink / raw)
To: Dan Williams
Cc: Jan Kara, david, Al Viro, Jens Axboe, Christoph Hellwig,
Boaz Harrosh, Theodore Ts'o, Andreas Dilger, Ross Zwisler,
micah.parrish, linux-nvdimm@lists.01.org, linux-fsdevel,
linux-block, linux-kernel@vger.kernel.org, Vishal L Verma
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@hpe.com> 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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 6/6] block: Update blkdev_dax_capable() for consistency
2016-05-10 16:23 ` [PATCH v4 6/6] block: Update blkdev_dax_capable() for consistency Toshi Kani
2016-05-10 19:49 ` Dan Williams
@ 2016-05-11 8:05 ` Jan Kara
2016-05-11 14:25 ` Toshi Kani
2016-05-17 22:07 ` Dan Williams
2016-05-18 7:54 ` [PATCH] remove unused blkdev_dax_capable() function Arnd Bergmann
3 siblings, 1 reply; 23+ messages in thread
From: Jan Kara @ 2016-05-11 8:05 UTC (permalink / raw)
To: Toshi Kani
Cc: dan.j.williams, jack, david, viro, axboe, hch, boaz, tytso,
adilger.kernel, ross.zwisler, micah.parrish, linux-nvdimm,
linux-fsdevel, linux-block, linux-kernel
On Tue 10-05-16 10:23:57, Toshi Kani 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.
...
> +bool bdev_dax_capable(struct block_device *bdev)
> +{
> + struct gendisk *disk = bdev->bd_disk;
> + struct blk_dax_ctl dax = {
> + .size = PAGE_SIZE,
> + };
> +
> + if (!IS_ENABLED(CONFIG_FS_DAX))
> + return false;
Frankly, I prefer the #ifdef CONFIG_FS_DAX and just compile the code out
when DAX is not enabled (like it was with blkdev_dax_capable()). That way we
don't grow the kernel for people who don't care about DAX.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 0/6] Add alignment check for DAX mount
2016-05-10 16:23 [PATCH v4 0/6] Add alignment check for DAX mount Toshi Kani
` (5 preceding siblings ...)
2016-05-10 16:23 ` [PATCH v4 6/6] block: Update blkdev_dax_capable() for consistency Toshi Kani
@ 2016-05-11 13:20 ` Carlos Maiolino
2016-05-19 23:37 ` Eric Sandeen
7 siblings, 0 replies; 23+ messages in thread
From: Carlos Maiolino @ 2016-05-11 13:20 UTC (permalink / raw)
To: linux-fsdevel, linux-kernel
On Tue, May 10, 2016 at 10:23:51AM -0600, Toshi Kani wrote:
> When a partition is not aligned by 4KB, mount -o dax succeeds,
> but any read/write access to the filesystem fails, except for
> metadata update. Add alignment check to ext4, ext2, and xfs.
>
> - Patch 1-2 add bdev_dax_supported() which performs all the checks
> necessary for dax mount.
> - Patch 3-5 change fillesystems to call bdev_dax_supported().
> - Patch 6 is a cleanup to keep dax capability checks consistent.
>
> v4:
> - blkdev_dax_capable() is similar to bdev_dax_supported().
> Manage them consistently. (Dan Williams, Dave Chinner)
>
> v3:
> - Remove boilerplate code from filesytems (Christoph Hellwig)
> - Add a helper function to perform all checks (Dave Chinner)
>
> v2:
> - Use a helper function via ->direct_access for the check.
> (Christoph Hellwig)
> - Call bdev_direct_access() with sector 0 for the check.
> (Boaz Harrosh)
>
> ---
> Toshi Kani (6):
> 1/6 block: Add vfs_msg() interface
> 2/6 block: Add bdev_dax_supported() for dax mount checks
> 3/6 ext4: Add alignment check for DAX mount
> 4/6 ext2: Add alignment check for DAX mount
> 5/6 xfs: Add alignment check for DAX mount
> 6/6 block: Update blkdev_dax_capable() for consistency
>
Despite Jan's comment on patch 6, that I should agree, that checking DAX during
compile time is better than at run time, all patches looks good to me, the
conflicts with Dan's patches, also should not cause any semantics change of this
patchset, you can add:
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Cheers
> ---
> block/ioctl.c | 30 ----------------
> fs/block_dev.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++++--
> fs/ext2/super.c | 11 ++----
> fs/ext4/super.c | 11 ++----
> fs/xfs/xfs_super.c | 12 +++----
> include/linux/blkdev.h | 13 +++++++
> include/linux/fs.h | 8 -----
> 7 files changed, 116 insertions(+), 65 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
--
Carlos
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 6/6] block: Update blkdev_dax_capable() for consistency
2016-05-11 8:05 ` Jan Kara
@ 2016-05-11 14:25 ` Toshi Kani
2016-05-11 15:26 ` Jan Kara
0 siblings, 1 reply; 23+ messages in thread
From: Toshi Kani @ 2016-05-11 14:25 UTC (permalink / raw)
To: Jan Kara
Cc: dan.j.williams, david, viro, axboe, hch, boaz, tytso,
adilger.kernel, ross.zwisler, micah.parrish, linux-nvdimm,
linux-fsdevel, linux-block, linux-kernel
On Wed, 2016-05-11 at 10:05 +0200, Jan Kara wrote:
> On Tue 10-05-16 10:23:57, Toshi Kani 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.
> ...
> >
> > +bool bdev_dax_capable(struct block_device *bdev)
> > +{
> > + struct gendisk *disk = bdev->bd_disk;
> > + struct blk_dax_ctl dax = {
> > + .size = PAGE_SIZE,
> > + };
> > +
> > + if (!IS_ENABLED(CONFIG_FS_DAX))
> > + return false;
>
> Frankly, I prefer the #ifdef CONFIG_FS_DAX and just compile the code out
> when DAX is not enabled (like it was with blkdev_dax_capable()). That way
> we don't grow the kernel for people who don't care about DAX.
When CONFIG_FS_DAX is not set, the rest of the code is optimized out. So,
I think the code size is the same.
(gdb) disas bdev_dax_capable
Dump of assembler code for function bdev_dax_capable:
0xffffffff81260d20 <+0>: callq 0xffffffff81813c30 <__fentry__>
0xffffffff81260d25 <+5>: push %rbp
0xffffffff81260d26 <+6>: xor %eax,%eax
0xffffffff81260d28 <+8>: mov %rsp,%rbp
0xffffffff81260d2b <+11>: pop %rbp
0xffffffff81260d2c <+12>: retq
End of assembler dump.
Thanks,
-Toshi
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 6/6] block: Update blkdev_dax_capable() for consistency
2016-05-11 14:25 ` Toshi Kani
@ 2016-05-11 15:26 ` Jan Kara
0 siblings, 0 replies; 23+ messages in thread
From: Jan Kara @ 2016-05-11 15:26 UTC (permalink / raw)
To: Toshi Kani
Cc: Jan Kara, dan.j.williams, david, viro, axboe, hch, boaz, tytso,
adilger.kernel, ross.zwisler, micah.parrish, linux-nvdimm,
linux-fsdevel, linux-block, linux-kernel
On Wed 11-05-16 08:25:10, Toshi Kani wrote:
> On Wed, 2016-05-11 at 10:05 +0200, Jan Kara wrote:
> > On Tue 10-05-16 10:23:57, Toshi Kani 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.
> > ...
> > >
> > > +bool bdev_dax_capable(struct block_device *bdev)
> > > +{
> > > + struct gendisk *disk = bdev->bd_disk;
> > > + struct blk_dax_ctl dax = {
> > > + .size = PAGE_SIZE,
> > > + };
> > > +
> > > + if (!IS_ENABLED(CONFIG_FS_DAX))
> > > + return false;
> >
> > Frankly, I prefer the #ifdef CONFIG_FS_DAX and just compile the code out
> > when DAX is not enabled (like it was with blkdev_dax_capable()). That way
> > we don't grow the kernel for people who don't care about DAX.
>
> When CONFIG_FS_DAX is not set, the rest of the code is optimized out. �So,
> I think the code size is the same.
>
> (gdb) disas bdev_dax_capable
> Dump of assembler code for function bdev_dax_capable:
> ���0xffffffff81260d20 <+0>:�����callq��0xffffffff81813c30 <__fentry__>
> ���0xffffffff81260d25 <+5>:�����push���%rbp
> ���0xffffffff81260d26 <+6>:�����xor����%eax,%eax
> ���0xffffffff81260d28 <+8>:�����mov����%rsp,%rbp
> ���0xffffffff81260d2b <+11>:����pop����%rbp
> ���0xffffffff81260d2c <+12>:����retq���
> End of assembler dump.
Ah, good. So feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 6/6] block: Update blkdev_dax_capable() for consistency
2016-05-10 16:23 ` [PATCH v4 6/6] block: Update blkdev_dax_capable() for consistency Toshi Kani
2016-05-10 19:49 ` Dan Williams
2016-05-11 8:05 ` Jan Kara
@ 2016-05-17 22:07 ` Dan Williams
2016-05-18 7:54 ` [PATCH] remove unused blkdev_dax_capable() function Arnd Bergmann
3 siblings, 0 replies; 23+ messages in thread
From: Dan Williams @ 2016-05-17 22:07 UTC (permalink / raw)
To: Toshi Kani
Cc: Jan Kara, david, Al Viro, Jens Axboe, Christoph Hellwig,
Boaz Harrosh, Theodore Ts'o, Andreas Dilger, Ross Zwisler,
micah.parrish, linux-nvdimm@lists.01.org, linux-fsdevel,
linux-block, linux-kernel@vger.kernel.org
On Tue, May 10, 2016 at 9:23 AM, Toshi Kani <toshi.kani@hpe.com> 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.
>
> Link: https://lkml.org/lkml/2016/5/9/950
> Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> Cc: Jens Axboe <axboe@fb.com>
> Cc: Andreas Dilger <adilger.kernel@dilger.ca>
> Cc: Jan Kara <jack@suse.cz>
> Cc: Dave Chinner <david@fromorbit.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
> Cc: Christoph Hellwig <hch@infradead.org>
> Cc: Boaz Harrosh <boaz@plexistor.com>
> ---
> block/ioctl.c | 30 ------------------------------
> fs/block_dev.c | 39 +++++++++++++++++++++++++++++++++++++--
> include/linux/blkdev.h | 1 +
> include/linux/fs.h | 8 --------
> 4 files changed, 38 insertions(+), 40 deletions(-)
>
> 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
> -
> static int blkdev_flushbuf(struct block_device *bdev, fmode_t mode,
> unsigned cmd, unsigned long arg)
> {
> diff --git a/fs/block_dev.c b/fs/block_dev.c
> index db55638..5d79093 100644
> --- a/fs/block_dev.c
> +++ b/fs/block_dev.c
> @@ -29,6 +29,7 @@
> #include <linux/log2.h>
> #include <linux/cleancache.h>
> #include <linux/dax.h>
> +#include <linux/badblocks.h>
> #include <asm/uaccess.h>
> #include "internal.h"
>
> @@ -554,6 +555,40 @@ int bdev_dax_supported(struct super_block *sb, int blocksize)
> }
> EXPORT_SYMBOL_GPL(bdev_dax_supported);
>
> +/**
> + * bdev_dax_capable() - Return if the raw device is capable for dax
> + * @bdev: The device for raw block device access
> + */
> +bool bdev_dax_capable(struct block_device *bdev)
> +{
> + struct gendisk *disk = bdev->bd_disk;
> + struct blk_dax_ctl dax = {
> + .size = PAGE_SIZE,
> + };
> +
> + if (!IS_ENABLED(CONFIG_FS_DAX))
> + return false;
> +
> + dax.sector = 0;
> + if (bdev_direct_access(bdev, &dax) < 0)
> + return false;
> +
> + dax.sector = bdev->bd_part->nr_sects - (PAGE_SIZE / 512);
> + if (bdev_direct_access(bdev, &dax) < 0)
> + return false;
So I just noticed that this new implementation of bdev_dax_capable()
prevents us from enabling DAX in the presence of errors, which was the
goal of Vishal's pending patches for 4.7.
I like the goal of centralizing checks, but this collides the base DAX
capability with the ability to perform an actual accesses at a given
address.
All the immediate solutions that come to mind right now are pretty
ugly, like an ignore errors flag...
Hmm, what about explicitly returning -EBADBLOCK and updating size to
return the offset of the error? That might be useful information to
have in general...
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH] remove unused blkdev_dax_capable() function
2016-05-10 16:23 ` [PATCH v4 6/6] block: Update blkdev_dax_capable() for consistency Toshi Kani
` (2 preceding siblings ...)
2016-05-17 22:07 ` Dan Williams
@ 2016-05-18 7:54 ` Arnd Bergmann
2016-05-18 14:01 ` Toshi Kani
` (2 more replies)
3 siblings, 3 replies; 23+ messages in thread
From: Arnd Bergmann @ 2016-05-18 7:54 UTC (permalink / raw)
To: Toshi Kani
Cc: dan.j.williams, jack, david, viro, axboe, hch, boaz, tytso,
adilger.kernel, ross.zwisler, micah.parrish, linux-nvdimm,
linux-fsdevel, linux-block, linux-kernel
The change from blkdev_dax_capable() to bdev_dax_capable() removed the only user
of the former, so we now get a build warning:
fs/block_dev.c:1244:13: error: 'blkdev_dax_capable' defined but not used [-Werror=unused-function]
static bool blkdev_dax_capable(struct block_device *bdev)
This removes the now-unused function.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: a8078b1fc616 ("block: Update blkdev_dax_capable() for consistency")
---
On Tuesday 10 May 2016 10:23:57 Toshi Kani wrote:
> @@ -1295,7 +1330,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
>
> if (!ret) {
> bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
> - if (!blkdev_dax_capable(bdev))
> + if (!bdev_dax_capable(bdev))
> bdev->bd_inode->i_flags &= ~S_DAX;
>
It's not entirely from the patch description what the intention was here
in keeping two slightly different implementations of the same function
in one file, my best guess is that it was not intentional and we should
just remove this.
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 97f324642b5f..dad77225a721 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1241,33 +1241,6 @@ void bd_set_size(struct block_device *bdev, loff_t size)
}
EXPORT_SYMBOL(bd_set_size);
-static bool blkdev_dax_capable(struct block_device *bdev)
-{
- struct gendisk *disk = bdev->bd_disk;
-
- if (!disk->fops->direct_access || !IS_ENABLED(CONFIG_FS_DAX))
- 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;
-}
-
static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part);
/*
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH] remove unused blkdev_dax_capable() function
2016-05-18 7:54 ` [PATCH] remove unused blkdev_dax_capable() function Arnd Bergmann
@ 2016-05-18 14:01 ` Toshi Kani
2016-05-18 19:30 ` Vishal Verma
2016-05-20 11:32 ` kbuild test robot
2 siblings, 0 replies; 23+ messages in thread
From: Toshi Kani @ 2016-05-18 14:01 UTC (permalink / raw)
To: Arnd Bergmann
Cc: dan.j.williams, jack, david, viro, axboe, hch, boaz, tytso,
adilger.kernel, ross.zwisler, micah.parrish, linux-nvdimm,
linux-fsdevel, linux-block, linux-kernel
On Wed, 2016-05-18 at 09:54 +0200, Arnd Bergmann wrote:
> The change from blkdev_dax_capable() to bdev_dax_capable() removed the
> only user of the former, so we now get a build warning:
>
> fs/block_dev.c:1244:13: error: 'blkdev_dax_capable' defined but not used
> [-Werror=unused-function]
> static bool blkdev_dax_capable(struct block_device *bdev)
>
> This removes the now-unused function.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: a8078b1fc616 ("block: Update blkdev_dax_capable() for
> consistency")
:
> It's not entirely from the patch description what the intention was here
> in keeping two slightly different implementations of the same function
> in one file, my best guess is that it was not intentional and we should
> just remove this.
Thanks for the build fix. Looks like there was a conflict
between 8044aae6f374 and a8078b1fc616d, which resulted this build error.
Both patches moved blkdev_dax_capable() from block/ioctl.c
to fs/block_dev.c.
Acked-by: Toshi Kani <toshi.kani@hpe.com>
Thanks,
-Toshi
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] remove unused blkdev_dax_capable() function
2016-05-18 7:54 ` [PATCH] remove unused blkdev_dax_capable() function Arnd Bergmann
2016-05-18 14:01 ` Toshi Kani
@ 2016-05-18 19:30 ` Vishal Verma
2016-05-20 11:32 ` kbuild test robot
2 siblings, 0 replies; 23+ messages in thread
From: Vishal Verma @ 2016-05-18 19:30 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Toshi Kani, hch, jack, linux-block, linux-nvdimm, david,
linux-kernel, micah.parrish, axboe, adilger.kernel, viro,
linux-fsdevel, tytso, sfr
On Wed, May 18, 2016 at 09:54:08AM +0200, Arnd Bergmann wrote:
> The change from blkdev_dax_capable() to bdev_dax_capable() removed the only user
> of the former, so we now get a build warning:
>
> fs/block_dev.c:1244:13: error: 'blkdev_dax_capable' defined but not used [-Werror=unused-function]
> static bool blkdev_dax_capable(struct block_device *bdev)
>
> This removes the now-unused function.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: a8078b1fc616 ("block: Update blkdev_dax_capable() for consistency")
> ---
> On Tuesday 10 May 2016 10:23:57 Toshi Kani wrote:
> > @@ -1295,7 +1330,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
> >
> > if (!ret) {
> > bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
> > - if (!blkdev_dax_capable(bdev))
> > + if (!bdev_dax_capable(bdev))
> > bdev->bd_inode->i_flags &= ~S_DAX;
> >
>
> It's not entirely from the patch description what the intention was here
> in keeping two slightly different implementations of the same function
> in one file, my best guess is that it was not intentional and we should
> just remove this.
>
Good catch - like Toshi said, this was indeed a mis-merge.
Stephen, for reference, I've added a branch with the expected conflict
resolution at:
https://git.kernel.org/cgit/linux/kernel/git/nvdimm/nvdimm.git/ libnvdimm-for-4.7-merge
Thanks,
-Vishal
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 0/6] Add alignment check for DAX mount
2016-05-10 16:23 [PATCH v4 0/6] Add alignment check for DAX mount Toshi Kani
` (6 preceding siblings ...)
2016-05-11 13:20 ` [PATCH v4 0/6] Add alignment check for DAX mount Carlos Maiolino
@ 2016-05-19 23:37 ` Eric Sandeen
2016-05-20 14:50 ` Kani, Toshimitsu
7 siblings, 1 reply; 23+ messages in thread
From: Eric Sandeen @ 2016-05-19 23:37 UTC (permalink / raw)
To: Toshi Kani, dan.j.williams, jack, david, viro
Cc: axboe, hch, boaz, tytso, adilger.kernel, ross.zwisler,
micah.parrish, linux-nvdimm, linux-fsdevel, linux-block,
linux-kernel
On 5/10/16 11:23 AM, Toshi Kani wrote:
> When a partition is not aligned by 4KB, mount -o dax succeeds,
Sorry for being late, but -
Shouldn't this and all subsequent patch commits refer to
PAGE_SIZE, rather than "4kB?"
-Eric
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] remove unused blkdev_dax_capable() function
2016-05-18 7:54 ` [PATCH] remove unused blkdev_dax_capable() function Arnd Bergmann
2016-05-18 14:01 ` Toshi Kani
2016-05-18 19:30 ` Vishal Verma
@ 2016-05-20 11:32 ` kbuild test robot
2016-05-20 15:48 ` Kani, Toshimitsu
2 siblings, 1 reply; 23+ messages in thread
From: kbuild test robot @ 2016-05-20 11:32 UTC (permalink / raw)
To: Arnd Bergmann
Cc: kbuild-all, Toshi Kani, dan.j.williams, jack, david, viro, axboe,
hch, boaz, tytso, adilger.kernel, ross.zwisler, micah.parrish,
linux-nvdimm, linux-fsdevel, linux-block, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2001 bytes --]
Hi,
[auto build test ERROR on next-20160517]
[cannot apply to v4.6-rc7 v4.6-rc6 v4.6-rc5 v4.6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Arnd-Bergmann/remove-unused-blkdev_dax_capable-function/20160518-155729
config: m68k-allyesconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 4.9.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=m68k
All errors (new ones prefixed by >>):
fs/block_dev.c: In function '__blkdev_get':
>> fs/block_dev.c:1242:5: error: implicit declaration of function 'blkdev_dax_capable' [-Werror=implicit-function-declaration]
if (!blkdev_dax_capable(bdev))
^
cc1: some warnings being treated as errors
vim +/blkdev_dax_capable +1242 fs/block_dev.c
d3374825 NeilBrown 2009-01-09 1236 goto restart;
d3374825 NeilBrown 2009-01-09 1237 }
1196f8b8 Tejun Heo 2011-04-21 1238 }
7e69723f Tejun Heo 2011-05-23 1239
5a023cdb Dan Williams 2015-11-30 1240 if (!ret) {
7e69723f Tejun Heo 2011-05-23 1241 bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
5a023cdb Dan Williams 2015-11-30 @1242 if (!blkdev_dax_capable(bdev))
5a023cdb Dan Williams 2015-11-30 1243 bdev->bd_inode->i_flags &= ~S_DAX;
5a023cdb Dan Williams 2015-11-30 1244 }
7e69723f Tejun Heo 2011-05-23 1245
:::::: The code at line 1242 was first introduced by commit
:::::: 5a023cdba50c5f5f2bc351783b3131699deb3937 block: enable dax for raw block devices
:::::: TO: Dan Williams <dan.j.williams@intel.com>
:::::: CC: Dan Williams <dan.j.williams@intel.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 37213 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 0/6] Add alignment check for DAX mount
2016-05-19 23:37 ` Eric Sandeen
@ 2016-05-20 14:50 ` Kani, Toshimitsu
2016-05-20 17:34 ` Verma, Vishal L
0 siblings, 1 reply; 23+ messages in thread
From: Kani, Toshimitsu @ 2016-05-20 14:50 UTC (permalink / raw)
To: dan.j.williams@intel.com, viro@zeniv.linux.org.uk, jack@suse.cz,
david@fromorbit.com, sandeen@sandeen.net,
vishal.l.verma@intel.com
Cc: Parrish, Micah (HP Servers Linux R&D),
linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
hch@infradead.org, adilger.kernel@dilger.ca, axboe@fb.com,
linux-nvdimm@lists.01.org, linux-fsdevel@vger.kernel.org,
ross.zwisler@linux.intel.com, tytso@mit.edu, boaz@plexistor.com
On Thu, 2016-05-19 at 18:37 -0500, Eric Sandeen wrote:
> On 5/10/16 11:23 AM, Toshi Kani wrote:
> >
> > When a partition is not aligned by 4KB, mount -o dax succeeds,
>
> Sorry for being late, but -
>
> Shouldn't this and all subsequent patch commits refer to
> PAGE_SIZE, rather than "4kB?"
Right, the patch commits should refer to PAGE_SIZE to match with the code
changes. I am afraid it may be a bit too late to update, though...
Vishal, do you think you can tweak the logs, "4KB" to "PAGE_SIZE"?
Thanks,
-Toshi
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] remove unused blkdev_dax_capable() function
2016-05-20 11:32 ` kbuild test robot
@ 2016-05-20 15:48 ` Kani, Toshimitsu
0 siblings, 0 replies; 23+ messages in thread
From: Kani, Toshimitsu @ 2016-05-20 15:48 UTC (permalink / raw)
To: lkp@intel.com, arnd@arndb.de
Cc: Parrish, Micah (HP Servers Linux R&D),
linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
hch@infradead.org, adilger.kernel@dilger.ca,
viro@zeniv.linux.org.uk, dan.j.williams@intel.com, axboe@fb.com,
linux-nvdimm@lists.01.org, kbuild-all@01.org,
linux-fsdevel@vger.kernel.org, ross.zwisler@linux.intel.com,
tytso@mit.edu, boaz@plexistor.com, david@fromorbit.com,
jack@suse.cz
FYI, fs/block_dev.c has multiple updates since then including the code in
question. I just built tot -next m64 kernel with the attached config file,
and confirmed no compile error on the file.
-Toshi
On Fri, 2016-05-20 at 19:32 +0800, kbuild test robot wrote:
> Hi,
>
> [auto build test ERROR on next-20160517]
> [cannot apply to v4.6-rc7 v4.6-rc6 v4.6-rc5 v4.6]
> [if your patch is applied to the wrong git tree, please drop us a note to
> help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Arnd-Bergmann/remove-unu
> sed-blkdev_dax_capable-function/20160518-155729
> config: m68k-allyesconfig (attached as .config)
> compiler: m68k-linux-gcc (GCC) 4.9.0
> reproduce:
> wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.g
> it/plain/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=m68k
>
> All errors (new ones prefixed by >>):
>
> fs/block_dev.c: In function '__blkdev_get':
> >
> > >
> > > fs/block_dev.c:1242:5: error: implicit declaration of function
> > > 'blkdev_dax_capable' [-Werror=implicit-function-declaration]
> if (!blkdev_dax_capable(bdev))
> ^
> cc1: some warnings being treated as errors
>
> vim +/blkdev_dax_capable +1242 fs/block_dev.c
>
> d3374825 NeilBrown 2009-01-09 1236
> goto restart;
> d3374825 NeilBrown 2009-01-09 1237 }
> 1196f8b8 Tejun Heo 2011-04-21 1238 }
> 7e69723f Tejun Heo 2011-05-23 1239
> 5a023cdb Dan Williams 2015-11-30 1240 if (!ret)
> {
> 7e69723f Tejun Heo 2011-05-23 1241 b
> d_set_size(bdev,(loff_t)get_capacity(disk)<<9);
> 5a023cdb Dan Williams 2015-11-30 @1242 i
> f (!blkdev_dax_capable(bdev))
> 5a023cdb Dan Williams 2015-11-30 1243
> bdev->bd_inode->i_flags &= ~S_DAX;
> 5a023cdb Dan Williams 2015-11-30 1244 }
> 7e69723f Tejun Heo 2011-05-23 1245
>
> :::::: The code at line 1242 was first introduced by commit
> :::::: 5a023cdba50c5f5f2bc351783b3131699deb3937 block: enable dax for raw
> block devices
>
> :::::: TO: Dan Williams <dan.j.williams@intel.com>
> :::::: CC: Dan Williams <dan.j.williams@intel.com>
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology
> Center
> https://lists.01.org/pipermail/kbuild-all Intel
> Corporation
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 0/6] Add alignment check for DAX mount
2016-05-20 14:50 ` Kani, Toshimitsu
@ 2016-05-20 17:34 ` Verma, Vishal L
2016-05-20 17:49 ` Kani, Toshimitsu
0 siblings, 1 reply; 23+ messages in thread
From: Verma, Vishal L @ 2016-05-20 17:34 UTC (permalink / raw)
To: Williams, Dan J, viro@zeniv.linux.org.uk, toshi.kani@hpe.com,
jack@suse.cz, sandeen@sandeen.net, david@fromorbit.com
Cc: micah.parrish@hpe.com, linux-kernel@vger.kernel.org,
linux-block@vger.kernel.org, hch@infradead.org,
adilger.kernel@dilger.ca, axboe@fb.com, linux-nvdimm@lists.01.org,
linux-fsdevel@vger.kernel.org, ross.zwisler@linux.intel.com,
tytso@mit.edu, boaz@plexistor.com
On Fri, 2016-05-20 at 14:50 +0000, Kani, Toshimitsu wrote:
> On Thu, 2016-05-19 at 18:37 -0500, Eric Sandeen wrote:
> >
> > On 5/10/16 11:23 AM, Toshi Kani wrote:
> > >
> > >
> > > When a partition is not aligned by 4KB, mount -o dax succeeds,
> > Sorry for being late, but -
> >
> > Shouldn't this and all subsequent patch commits refer to
> > PAGE_SIZE, rather than "4kB?"
> Right, the patch commits should refer to PAGE_SIZE to match with the
> code
> changes. I am afraid it may be a bit too late to update, though...
>
> Vishal, do you think you can tweak the logs, "4KB" to "PAGE_SIZE"?
>
> Thanks,
> -Toshi
Hi Toshi,
Is it just commit message changes? If so I'm not sure it is worthwhile
to rebase everything for that - i.e. my dax error handling series and
Ross' dax-locking branch would both have to be rebased..
If there are and fixes for code, we can do them as an add-on patch
though.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 0/6] Add alignment check for DAX mount
2016-05-20 17:34 ` Verma, Vishal L
@ 2016-05-20 17:49 ` Kani, Toshimitsu
0 siblings, 0 replies; 23+ messages in thread
From: Kani, Toshimitsu @ 2016-05-20 17:49 UTC (permalink / raw)
To: dan.j.williams@intel.com, viro@zeniv.linux.org.uk, jack@suse.cz,
david@fromorbit.com, sandeen@sandeen.net,
vishal.l.verma@intel.com
Cc: Parrish, Micah (HP Servers Linux R&D),
linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
hch@infradead.org, adilger.kernel@dilger.ca, axboe@fb.com,
linux-nvdimm@lists.01.org, linux-fsdevel@vger.kernel.org,
ross.zwisler@linux.intel.com, tytso@mit.edu, boaz@plexistor.com
On Fri, 2016-05-20 at 17:34 +0000, Verma, Vishal L wrote:
> On Fri, 2016-05-20 at 14:50 +0000, Kani, Toshimitsu wrote:
> > On Thu, 2016-05-19 at 18:37 -0500, Eric Sandeen wrote:
> > > On 5/10/16 11:23 AM, Toshi Kani wrote:
> > > >
> > > > When a partition is not aligned by 4KB, mount -o dax succeeds,
> > >
> > > Sorry for being late, but -
> > >
> > > Shouldn't this and all subsequent patch commits refer to
> > > PAGE_SIZE, rather than "4kB?"
> >
> > Right, the patch commits should refer to PAGE_SIZE to match with the
> > code changes. I am afraid it may be a bit too late to update,
> > though...
> >
> > Vishal, do you think you can tweak the logs, "4KB" to "PAGE_SIZE"?
> >
> > Thanks,
> > -Toshi
>
> Hi Toshi,
>
> Is it just commit message changes? If so I'm not sure it is worthwhile
> to rebase everything for that - i.e. my dax error handling series and
> Ross' dax-locking branch would both have to be rebased..
>
> If there are and fixes for code, we can do them as an add-on patch
> though.
Hi Vishal,
Yes, it is just commit messages, and it's OK not to make this change.
Thanks,
-Toshi
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2016-05-20 17:49 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-10 16:23 [PATCH v4 0/6] Add alignment check for DAX mount Toshi Kani
2016-05-10 16:23 ` [PATCH v4 1/6] block: Add vfs_msg() interface Toshi Kani
2016-05-10 16:23 ` [PATCH v4 2/6] block: Add bdev_dax_supported() for dax mount checks Toshi Kani
2016-05-10 16:23 ` [PATCH v4 3/6] ext4: Add alignment check for DAX mount Toshi Kani
2016-05-10 16:23 ` [PATCH v4 4/6] ext2: " Toshi Kani
2016-05-10 16:23 ` [PATCH v4 5/6] xfs: " Toshi Kani
2016-05-10 16:23 ` [PATCH v4 6/6] block: Update blkdev_dax_capable() for consistency Toshi Kani
2016-05-10 19:49 ` Dan Williams
2016-05-10 21:36 ` Toshi Kani
2016-05-11 8:05 ` Jan Kara
2016-05-11 14:25 ` Toshi Kani
2016-05-11 15:26 ` Jan Kara
2016-05-17 22:07 ` Dan Williams
2016-05-18 7:54 ` [PATCH] remove unused blkdev_dax_capable() function Arnd Bergmann
2016-05-18 14:01 ` Toshi Kani
2016-05-18 19:30 ` Vishal Verma
2016-05-20 11:32 ` kbuild test robot
2016-05-20 15:48 ` Kani, Toshimitsu
2016-05-11 13:20 ` [PATCH v4 0/6] Add alignment check for DAX mount Carlos Maiolino
2016-05-19 23:37 ` Eric Sandeen
2016-05-20 14:50 ` Kani, Toshimitsu
2016-05-20 17:34 ` Verma, Vishal L
2016-05-20 17:49 ` Kani, Toshimitsu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).