[Ocfs2-tools-devel] [PATCH 09/18] tunefs.ocfs2: Display progress when changing the size of journals.
Mark Fasheh
mfasheh at suse.com
Wed Jan 14 14:51:26 PST 2009
Signed-off-by: Mark Fasheh <mfasheh at suse.com>
On Mon, Jan 05, 2009 at 06:33:45PM -0800, Joel Becker wrote:
> 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
--
Mark Fasheh
More information about the Ocfs2-tools-devel
mailing list