diff mbox

[v3,4/5] ext2: Add alignment check for DAX mount

Message ID 1462494596-20938-5-git-send-email-toshi.kani@hpe.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kani, Toshi May 6, 2016, 12:29 a.m. UTC
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_supports_dax() to perform proper precondition checks
which includes this partition alignment check.

Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
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(-)

Comments

Christoph Hellwig May 8, 2016, 8:59 a.m. UTC | #1
Not really for the patch, but given that we have the right people
on CC:

Do we really want to keep DAX support in ext2 in the long run?  ext2
is missing a lot of the useful features for a modern FS, shouldn't
we direct people to use ext4 (in non-journal mode if needed) if they
want to use DAX?  ext4 will even support the unmodified ext2 fs, so it
shouldn't be a big hurdle, and it would avoid a lot of churn in ext2.
Jan Kara May 9, 2016, 8:23 a.m. UTC | #2
On Sun 08-05-16 01:59:37, Christoph Hellwig wrote:
> Not really for the patch, but given that we have the right people
> on CC:
> 
> Do we really want to keep DAX support in ext2 in the long run?  ext2
> is missing a lot of the useful features for a modern FS, shouldn't
> we direct people to use ext4 (in non-journal mode if needed) if they
> want to use DAX?  ext4 will even support the unmodified ext2 fs, so it
> shouldn't be a big hurdle, and it would avoid a lot of churn in ext2.

I've heard concerns that embedded people use ext2 driver (due to smaller
code size than ext4 - 1.7 MB object for ext2 vs over 7 MB object for ext4
in my build) including old XIP support. DAX has replaced the old XIP code
so removing DAX from ext2 would be a regression for them - either they'd
have to go with significantly larger module or without XIP. So for now I'd
leave DAX in ext2.

								Honza
Jan Kara May 9, 2016, 8:31 a.m. UTC | #3
On Thu 05-05-16 18:29:55, 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.
> 
> Call bdev_supports_dax() to perform proper precondition checks
> which includes this partition alignment check.
> 
> Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> 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>

Looks good to me. Since this patch depends on the first two in your series,
just feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

and merge it along with other patches. I've removed the ext2 patch from
the previous version from my tree.

								Honza
diff mbox

Patch

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index b78caf2..7d63de4 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_supports_dax(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.. */