[Ocfs2-tools-devel] [PATCH 3/5] tunefs.ocfs2: Check for block64 before resizing > 16TB

Goldwyn Rodrigues rgoldwyn at gmail.com
Tue Jan 17 12:10:15 PST 2012


Signed-off-by: Goldwyn Rodrigues <rgoldwyn at suse.de>
Signed-off-by: Michal Srb <msrb at suse.com>
---
 tunefs.ocfs2/libocfs2ne.c       |    8 ++++++++
 tunefs.ocfs2/libocfs2ne.h       |    1 +
 tunefs.ocfs2/op_resize_volume.c |    3 ++-
 3 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/tunefs.ocfs2/libocfs2ne.c b/tunefs.ocfs2/libocfs2ne.c
index 8e814e7..709951c 100644
--- a/tunefs.ocfs2/libocfs2ne.c
+++ b/tunefs.ocfs2/libocfs2ne.c
@@ -2080,6 +2080,14 @@ out:
 	return err;
 }

+int tunefs_is_journal64(ocfs2_filesys *fs)
+{
+	struct tunefs_filesystem_state *state = tunefs_get_state(fs);
+	if (state->ts_journal_features.opt_incompat & JBD2_FEATURE_INCOMPAT_64BIT)
+		return 1;
+	return 0;
+}
+
 errcode_t tunefs_close(ocfs2_filesys *fs)
 {
 	errcode_t tmp, err = 0;
diff --git a/tunefs.ocfs2/libocfs2ne.h b/tunefs.ocfs2/libocfs2ne.h
index 15d0ec6..848840f 100644
--- a/tunefs.ocfs2/libocfs2ne.h
+++ b/tunefs.ocfs2/libocfs2ne.h
@@ -310,5 +310,6 @@ errcode_t tunefs_prepare_dir_trailer(ocfs2_filesys *fs,
 errcode_t tunefs_install_dir_trailer(ocfs2_filesys *fs, struct
ocfs2_dinode *di,
 				struct tunefs_trailer_context *tc);
 void tunefs_trailer_context_free(struct tunefs_trailer_context *tc);
+int tunefs_is_journal64(ocfs2_filesys *fs);

 #endif  /* _LIBTUNEFS_H */
diff --git a/tunefs.ocfs2/op_resize_volume.c b/tunefs.ocfs2/op_resize_volume.c
index c2f8ebd..80311f7 100644
--- a/tunefs.ocfs2/op_resize_volume.c
+++ b/tunefs.ocfs2/op_resize_volume.c
@@ -514,6 +514,7 @@ static errcode_t check_new_size(ocfs2_filesys *fs,
uint64_t new_size,
 	int b_to_c_bits =
 		OCFS2_RAW_SB(fs->fs_super)->s_clustersize_bits -
 		OCFS2_RAW_SB(fs->fs_super)->s_blocksize_bits;
+	int block64 = tunefs_is_journal64(fs);

 	if (new_size > max_bytes) {
 		verbosef(VL_APP,
@@ -578,7 +579,7 @@ static errcode_t check_new_size(ocfs2_filesys *fs,
uint64_t new_size,
 		return TUNEFS_ET_INVALID_NUMBER;
 	}

-	if (try_blocks > UINT32_MAX) {
+	if (!block64 && (try_blocks > UINT32_MAX)) {
 		verbosef(VL_APP,
 			 "Requested %"PRIu32" clusters (%"PRIu64" "
 			 "blocks)\n",
-- 
1.7.7



More information about the Ocfs2-tools-devel mailing list