[Ocfs2-tools-devel] [PATCH 04/18] tunefs.ocfs2: Display progress while locking down the filesystem

Mark Fasheh mfasheh at suse.com
Wed Jan 14 14:46:23 PST 2009


Signed-off-by: Mark Fasheh <mfasheh at suse.com>

On Mon, Jan 05, 2009 at 06:33:40PM -0800, Joel Becker wrote:
> Locking and unlocking the filesystem takes time with o2cb.  Add progress
> display for it.
> 
> Signed-off-by: Joel Becker <joel.becker at oracle.com>
> ---
>  tunefs.ocfs2/libocfs2ne.c |   29 +++++++++++++++++++++++++++++
>  1 files changed, 29 insertions(+), 0 deletions(-)
> 
> diff --git a/tunefs.ocfs2/libocfs2ne.c b/tunefs.ocfs2/libocfs2ne.c
> index 2c036ea..0403a55 100644
> --- a/tunefs.ocfs2/libocfs2ne.c
> +++ b/tunefs.ocfs2/libocfs2ne.c
> @@ -707,6 +707,15 @@ static errcode_t tunefs_unlock_cluster(ocfs2_filesys *fs)
>  {
>  	errcode_t tmp, err = 0;
>  	struct tunefs_filesystem_state *state = tunefs_get_state(fs);
> +	struct tools_progress *prog = NULL;
> +
> +	if (fs->fs_dlm_ctxt)
> +		prog = tools_progress_start("Unlocking filesystem",
> +					    "unlocking", 2);
> +	/*
> +	 * We continue even with no progress, because we're unlocking
> +	 * and probably exiting.
> +	 */
>  
>  	assert(state->ts_master == fs);
>  	if (state->ts_cluster_locked) {
> @@ -717,6 +726,8 @@ static errcode_t tunefs_unlock_cluster(ocfs2_filesys *fs)
>  		tunefs_unblock_signals();
>  		state->ts_cluster_locked = 0;
>  	}
> +	if (prog)
> +		tools_progress_step(prog, 1);
>  
>  	/* We shut down the dlm regardless of err */
>  	if (fs->fs_dlm_ctxt) {
> @@ -724,6 +735,10 @@ static errcode_t tunefs_unlock_cluster(ocfs2_filesys *fs)
>  		if (!err)
>  			err = tmp;
>  	}
> +	if (prog) {
> +		tools_progress_step(prog, 1);
> +		tools_progress_stop(prog);
> +	}
>  
>  	return err;
>  }
> @@ -751,6 +766,7 @@ static errcode_t tunefs_lock_cluster(ocfs2_filesys *fs, int flags)
>  	errcode_t err = 0;
>  	struct tunefs_filesystem_state *state = tunefs_get_state(fs);
>  	ocfs2_filesys *master_fs = state->ts_master;
> +	struct tools_progress *prog = NULL;
>  
>  	if (state->ts_cluster_locked)
>  		goto out;
> @@ -760,6 +776,12 @@ static errcode_t tunefs_lock_cluster(ocfs2_filesys *fs, int flags)
>  		goto out;
>  	}
>  
> +	prog = tools_progress_start("Locking filesystem", "locking", 2);
> +	if (!prog) {
> +		err = TUNEFS_ET_NO_MEMORY;
> +		goto out;
> +	}
> +
>  	if (!master_fs->fs_dlm_ctxt) {
>  		err = o2cb_init();
>  		if (err)
> @@ -787,6 +809,8 @@ static errcode_t tunefs_lock_cluster(ocfs2_filesys *fs, int flags)
>  			goto out;
>  	}
>  
> +	tools_progress_step(prog, 1);
> +
>  	tunefs_block_signals();
>  	err = ocfs2_lock_down_cluster(master_fs);
>  	tunefs_unblock_signals();
> @@ -798,7 +822,12 @@ static errcode_t tunefs_lock_cluster(ocfs2_filesys *fs, int flags)
>  	else
>  		ocfs2_shutdown_dlm(fs, WHOAMI);
>  
> +	tools_progress_step(prog, 1);
> +
>  out:
> +	if (prog)
> +		tools_progress_stop(prog);
> +
>  	return err;
>  }
>  
> -- 
> 1.5.6.5
--
Mark Fasheh



More information about the Ocfs2-tools-devel mailing list