[Ocfs2-tools-devel] [PATCH 09/18] tunefs.ocfs2: Display progress when changing the size of journals.
Joel Becker
joel.becker at oracle.com
Mon Jan 5 18:33:45 PST 2009
Progress indication for adjusting journal sizes. This benefits
op_set_journal_size and op_set_slot_count.
Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
tunefs.ocfs2/libocfs2ne.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/tunefs.ocfs2/libocfs2ne.c b/tunefs.ocfs2/libocfs2ne.c
index 0403a55..3245089 100644
--- a/tunefs.ocfs2/libocfs2ne.c
+++ b/tunefs.ocfs2/libocfs2ne.c
@@ -334,6 +334,7 @@ errcode_t tunefs_set_journal_size(ocfs2_filesys *fs, uint64_t new_size)
char *buf = NULL;
struct ocfs2_dinode *di;
struct tunefs_filesystem_state *state = tunefs_get_state(fs);
+ struct tools_progress *prog;
num_clusters =
ocfs2_clusters_in_blocks(fs,
@@ -359,6 +360,17 @@ errcode_t tunefs_set_journal_size(ocfs2_filesys *fs, uint64_t new_size)
return ret;
}
+ prog = tools_progress_start("Setting journal size", "jsize",
+ max_slots);
+ if (!prog) {
+ ret = TUNEFS_ET_NO_MEMORY;
+ verbosef(VL_LIB,
+ "%s while initializing progress display for "
+ "journal resize\n",
+ error_message(ret));
+ return ret;
+ }
+
for (i = 0; i < max_slots; ++i) {
ocfs2_sprintf_system_inode_name(jrnl_file,
OCFS2_MAX_FILENAME_LEN,
@@ -384,8 +396,10 @@ errcode_t tunefs_set_journal_size(ocfs2_filesys *fs, uint64_t new_size)
}
di = (struct ocfs2_dinode *)buf;
- if (num_clusters == di->i_clusters)
+ if (num_clusters == di->i_clusters) {
+ tools_progress_step(prog, 1);
continue;
+ }
verbosef(VL_LIB,
"Resizing journal \"%s\" to %"PRIu32" clusters\n",
@@ -402,9 +416,11 @@ errcode_t tunefs_set_journal_size(ocfs2_filesys *fs, uint64_t new_size)
}
verbosef(VL_LIB, "Successfully resized journal \"%s\"\n",
jrnl_file);
+ tools_progress_step(prog, 1);
}
bail:
+ tools_progress_stop(prog);
if (buf)
ocfs2_free(&buf);
--
1.5.6.5
More information about the Ocfs2-tools-devel
mailing list