[Ocfs2-tools-devel] [PATCH 16/18] tunefs.ocfs2: Progress while enabling or disabling the local feature.
Mark Fasheh
mfasheh at suse.com
Wed Jan 14 14:55:45 PST 2009
Signed-off-by: Mark Fasheh <mfasheh at suse.com>
On Mon, Jan 05, 2009 at 06:33:52PM -0800, Joel Becker wrote:
> Display progress while switching between local and clustered
> configuration.
>
> Signed-off-by: Joel Becker <joel.becker at oracle.com>
> ---
> tunefs.ocfs2/feature_local.c | 23 +++++++++++++++++++++++
> 1 files changed, 23 insertions(+), 0 deletions(-)
>
> diff --git a/tunefs.ocfs2/feature_local.c b/tunefs.ocfs2/feature_local.c
> index 711bc3a..dd71d3c 100644
> --- a/tunefs.ocfs2/feature_local.c
> +++ b/tunefs.ocfs2/feature_local.c
> @@ -31,6 +31,7 @@ static int disable_local(ocfs2_filesys *fs, int flags)
> errcode_t ret = 0;
> struct ocfs2_super_block *sb = OCFS2_RAW_SB(fs->fs_super);
> struct o2cb_cluster_desc desc;
> + struct tools_progress *prog = NULL;
>
> if (!ocfs2_mount_local(fs)) {
> verbosef(VL_APP,
> @@ -45,6 +46,13 @@ static int disable_local(ocfs2_filesys *fs, int flags)
> fs->fs_devname))
> goto out;
>
> + prog = tools_progress_start("Disable local", "nolocal", 3);
> + if (!prog) {
> + ret = TUNEFS_ET_NO_MEMORY;
> + tcom_err(ret, "while initializing the progress display");
> + goto out;
> + }
> +
> /*
> * Since it was a local device, tunefs_open() will not
> * have connected to o2cb.
> @@ -54,6 +62,7 @@ static int disable_local(ocfs2_filesys *fs, int flags)
> tcom_err(ret, "while connecting to the cluster stack");
> goto out;
> }
> + tools_progress_step(prog, 1);
> ret = o2cb_running_cluster_desc(&desc);
> if (ret) {
> tcom_err(ret, "while trying to determine the running cluster");
> @@ -66,6 +75,7 @@ static int disable_local(ocfs2_filesys *fs, int flags)
> desc.c_stack, desc.c_cluster);
> else
> verbosef(VL_APP, "Cluster stack: classic o2cb\n");
> + tools_progress_step(prog, 1);
>
> sb->s_feature_incompat &=
> ~OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT;
> @@ -76,7 +86,10 @@ static int disable_local(ocfs2_filesys *fs, int flags)
> if (ret)
> tcom_err(ret, "while writing setting the cluster descriptor");
>
> + tools_progress_step(prog, 1);
> out:
> + if (prog)
> + tools_progress_stop(prog);
> if (ret)
> errorf("Unable to disable the local mount feature on "
> "device \"%s\"\n",
> @@ -88,6 +101,7 @@ static int enable_local(ocfs2_filesys *fs, int flags)
> {
> errcode_t ret = 0;
> struct ocfs2_super_block *sb = OCFS2_RAW_SB(fs->fs_super);
> + struct tools_progress *prog;
>
> if (ocfs2_mount_local(fs)) {
> verbosef(VL_APP,
> @@ -102,6 +116,13 @@ static int enable_local(ocfs2_filesys *fs, int flags)
> fs->fs_devname))
> goto out;
>
> + prog = tools_progress_start("Enable local", "local", 1);
> + if (!prog) {
> + ret = TUNEFS_ET_NO_MEMORY;
> + tcom_err(ret, "while initializing the progress display");
> + goto out;
> + }
> +
> sb->s_feature_incompat |=
> OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT;
> sb->s_feature_incompat &=
> @@ -116,6 +137,8 @@ static int enable_local(ocfs2_filesys *fs, int flags)
> "enable the local mount feature on device \"%s\"",
> fs->fs_devname);
>
> + tools_progress_step(prog, 1);
> + tools_progress_stop(prog);
> out:
> return ret;
> }
> --
> 1.5.6.5
--
Mark Fasheh
More information about the Ocfs2-tools-devel
mailing list