Patchwork [26/31] libext2fs: openfs() musn't allow bigalloc without EXT2_FLAGS_64BITS

login
register
mail settings
Submitter Darrick J. Wong
Date Oct. 1, 2013, 1:29 a.m.
Message ID <20131001012928.28415.62086.stgit@birch.djwong.org>
Download mbox | patch
Permalink /patch/279305/
State Accepted
Headers show

Comments

Darrick J. Wong - Oct. 1, 2013, 1:29 a.m.
Currently, only the 64-bit bitmap implementation supports the block<->cluster
conversions that bigalloc requires.  Therefore, if we have a bigalloc
filesystem, require EXT2_FLAGS_64BITS be passed in to ext2fs_open().

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 lib/ext2fs/openfs.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)



--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lukas Czerner - Oct. 7, 2013, 12:50 p.m.
On Mon, 30 Sep 2013, Darrick J. Wong wrote:

> Date: Mon, 30 Sep 2013 18:29:28 -0700
> From: Darrick J. Wong <darrick.wong@oracle.com>
> To: tytso@mit.edu, darrick.wong@oracle.com
> Cc: linux-ext4@vger.kernel.org
> Subject: [PATCH 26/31] libext2fs: openfs() musn't allow bigalloc without
>     EXT2_FLAGS_64BITS
> 
> Currently, only the 64-bit bitmap implementation supports the block<->cluster
> conversions that bigalloc requires.  Therefore, if we have a bigalloc
> filesystem, require EXT2_FLAGS_64BITS be passed in to ext2fs_open().
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  lib/ext2fs/openfs.c |   12 ++++++++++++
>  1 file changed, 12 insertions(+)

Looks good.

Reviewed-by: Lukas Czerner <lczerner@redhat.com>

> 
> 
> diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
> index 3c0bf14..f486a35 100644
> --- a/lib/ext2fs/openfs.c
> +++ b/lib/ext2fs/openfs.c
> @@ -272,6 +272,18 @@ errcode_t ext2fs_open3(const char *name, const char *io_options,
>  		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
>  		goto cleanup;
>  	}
> +
> +	/*
> +	 * bigalloc requires cluster-aware bitfield operations, which at the
> +	 * moment means we need EXT2_FLAG_64BITS.
> +	 */
> +	if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
> +				       EXT4_FEATURE_RO_COMPAT_BIGALLOC) &&
> +	    !(flags & EXT2_FLAG_64BITS)) {
> +		retval = EXT2_ET_CANT_USE_LEGACY_BITMAPS;
> +		goto cleanup;
> +	}
> +
>  	if (!EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
>  					EXT4_FEATURE_RO_COMPAT_BIGALLOC) &&
>  	    (fs->super->s_log_block_size != fs->super->s_log_cluster_size)) {
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o - Oct. 12, 2013, 1:36 a.m.
On Mon, Oct 07, 2013 at 02:50:52PM +0200, Lukáš Czerner wrote:
> On Mon, 30 Sep 2013, Darrick J. Wong wrote:
> > Currently, only the 64-bit bitmap implementation supports the block<->cluster
> > conversions that bigalloc requires.  Therefore, if we have a bigalloc
> > filesystem, require EXT2_FLAGS_64BITS be passed in to ext2fs_open().
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Reviewed-by: Lukas Czerner <lczerner@redhat.com>

Applied, thanks.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
index 3c0bf14..f486a35 100644
--- a/lib/ext2fs/openfs.c
+++ b/lib/ext2fs/openfs.c
@@ -272,6 +272,18 @@  errcode_t ext2fs_open3(const char *name, const char *io_options,
 		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
 		goto cleanup;
 	}
+
+	/*
+	 * bigalloc requires cluster-aware bitfield operations, which at the
+	 * moment means we need EXT2_FLAG_64BITS.
+	 */
+	if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
+				       EXT4_FEATURE_RO_COMPAT_BIGALLOC) &&
+	    !(flags & EXT2_FLAG_64BITS)) {
+		retval = EXT2_ET_CANT_USE_LEGACY_BITMAPS;
+		goto cleanup;
+	}
+
 	if (!EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
 					EXT4_FEATURE_RO_COMPAT_BIGALLOC) &&
 	    (fs->super->s_log_block_size != fs->super->s_log_cluster_size)) {