[Ocfs2-tools-devel] [PATCH 15/18] tunefs.ocfs2: Display progress for extended slotmap.

Joel Becker joel.becker at oracle.com
Mon Jan 5 18:33:51 PST 2009


Display progress when enabling or disabling the extended slotmap
feature.

Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
 tunefs.ocfs2/feature_extended_slotmap.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/tunefs.ocfs2/feature_extended_slotmap.c b/tunefs.ocfs2/feature_extended_slotmap.c
index 1aff528..fb4497c 100644
--- a/tunefs.ocfs2/feature_extended_slotmap.c
+++ b/tunefs.ocfs2/feature_extended_slotmap.c
@@ -31,6 +31,7 @@ static int enable_extended_slotmap(ocfs2_filesys *fs, int flags)
 {
 	errcode_t err = 0;
 	struct ocfs2_super_block *super = OCFS2_RAW_SB(fs->fs_super);
+	struct tools_progress *prog;
 
 	if (ocfs2_uses_extended_slot_map(super)) {
 		verbosef(VL_APP,
@@ -44,6 +45,14 @@ static int enable_extended_slotmap(ocfs2_filesys *fs, int flags)
 			    fs->fs_devname))
 		goto out;
 
+	prog = tools_progress_start("Enable extended-slotmap",
+				    "extended-slotmap", 1);
+	if (!prog) {
+		err = TUNEFS_ET_NO_MEMORY;
+		tcom_err(err, "while initializing the progress display");
+		goto out;
+	}
+
 	OCFS2_SET_INCOMPAT_FEATURE(super,
 				   OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP);
 	tunefs_block_signals();
@@ -56,6 +65,9 @@ static int enable_extended_slotmap(ocfs2_filesys *fs, int flags)
 		tcom_err(err, "while formatting the extended slot map");
 	tunefs_unblock_signals();
 
+	tools_progress_step(prog, 1);
+	tools_progress_stop(prog);
+
 out:
 	return err;
 }
@@ -64,6 +76,7 @@ static int disable_extended_slotmap(ocfs2_filesys *fs, int flags)
 {
 	errcode_t err = 0;
 	struct ocfs2_super_block *super = OCFS2_RAW_SB(fs->fs_super);
+	struct tools_progress *prog;
 
 	if (!ocfs2_uses_extended_slot_map(super)) {
 		verbosef(VL_APP,
@@ -77,6 +90,14 @@ static int disable_extended_slotmap(ocfs2_filesys *fs, int flags)
 			    fs->fs_devname))
 		goto out;
 
+	prog = tools_progress_start("Disable extended-slotmap",
+				    "noextended-slotmap", 1);
+	if (!prog) {
+		err = TUNEFS_ET_NO_MEMORY;
+		tcom_err(err, "while initializing the progress display");
+		goto out;
+	}
+
 	OCFS2_CLEAR_INCOMPAT_FEATURE(super,
 				     OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP);
 
@@ -90,6 +111,9 @@ static int disable_extended_slotmap(ocfs2_filesys *fs, int flags)
 		tcom_err(err, "while formatting the old-style slot map");
 	tunefs_unblock_signals();
 
+	tools_progress_step(prog, 1);
+	tools_progress_stop(prog);
+
 out:
 	return err;
 }
-- 
1.5.6.5




More information about the Ocfs2-tools-devel mailing list