linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Cc: linux-raid@vger.kernel.org, wojciech.neubauer@intel.com,
	adam.kwolek@intel.com, dan.j.williams@intel.com,
	ed.ciechanowski@intel.com
Subject: Re: [PATCH 07/22] imsm: Add wait_for_reshape_imsm() implementation
Date: Wed, 8 Jun 2011 17:07:03 +1000	[thread overview]
Message-ID: <20110608170703.07bc43c9@notabene.brown> (raw)
In-Reply-To: <20110602144908.27355.89349.stgit@gklab-128-111.igk.intel.com>

On Thu, 02 Jun 2011 16:49:08 +0200 Krzysztof Wojcik
<krzysztof.wojcik@intel.com> wrote:

> From: Adam Kwolek <adam.kwolek@intel.com>
> 
> After each checkpoint mdadm should set new reshaped area and wait
> until md finishes reshape. Function wait_for_reshape_imsm() sets
> new reshape range and waits for job completion.
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
> Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
> ---
>  super-intel.c |   61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 61 insertions(+), 0 deletions(-)
> 
> diff --git a/super-intel.c b/super-intel.c
> index 31fae1e..c395a48 100644
> --- a/super-intel.c
> +++ b/super-intel.c
> @@ -8248,6 +8248,67 @@ exit_imsm_reshape_super:
>  	return ret_val;
>  }
>  
> +/*******************************************************************************
> + * Function:	wait_for_reshape_imsm
> + * Description:	Function writes new sync_max value and waits until
> + *		reshape process reach new position
> + * Parameters:
> + *	sra		: general array info
> + *	to_complete	: new sync_max position
> + *	ndata		: number of disks in new array's layout
> + * Returns:
> + *	 0 : success,
> + *	 1 : there is no reshape in progress,
> + *	-1 : fail
> + ******************************************************************************/
> +int wait_for_reshape_imsm(struct mdinfo *sra, unsigned long long to_complete,
> +			  int ndata)
> +{
> +	int fd = sysfs_get_fd(sra, NULL, "reshape_position");
> +	unsigned long long completed;
> +
> +	struct timeval timeout;
> +
> +	if (fd < 0)
> +		return 1;
> +
> +	sysfs_fd_get_ll(fd, &completed);
> +
> +	if (to_complete == 0) {/* reshape till the end of array */
> +		sysfs_set_str(sra, NULL, "sync_max", "max");
> +		to_complete = MaxSector;
> +	} else {
> +		if (completed > to_complete)
> +			return -1;
> +		if (sysfs_set_num(sra, NULL, "sync_max",
> +				  to_complete / ndata) != 0) {
> +			close(fd);
> +			return -1;
> +		}
> +	}
> +
> +	timeout.tv_sec = 0;
> +	timeout.tv_usec = 500000;

Having a 1/2 second timeout is wrong.  You shouldn't need a timeout at all.
If you do, there is a bug somewhere.

I changed this to 30 seconds.
> +	do {
> +		char action[20];
> +		fd_set rfds;
> +		FD_ZERO(&rfds);
> +		FD_SET(fd, &rfds);
> +		select(fd+1, NULL, NULL, &rfds, &timeout);
> +		if (sysfs_fd_get_ll(fd, &completed) < 0) {
> +			close(fd);
> +			return 1;
> +		}
> +		if (sysfs_get_str(sra, NULL, "sync_action",
> +			    action, 20) > 0 &&
> +			    strncmp(action, "reshape", 7) != 0)
> +			continue;

And if 'sync_action' is not 'reshape' any more then soemthing must have
aborted and just 'continue'ing is wrong.  I have changed this to 'break', but
maybe you want to return an error.

NeilBrown


> +	} while (completed < to_complete);
> +	close(fd);
> +	return 0;
> +
> +}
> +
>  static int imsm_manage_reshape(
>  	int afd, struct mdinfo *sra, struct reshape *reshape,
>  	struct supertype *st, unsigned long stripes,
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2011-06-08  7:07 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-02 14:48 [PATCH 00/22] IMSM checkpointing implementation Krzysztof Wojcik
2011-06-02 14:48 ` [PATCH 01/22] imsm: Add migration record to intel_super Krzysztof Wojcik
2011-06-02 14:48 ` [PATCH 02/22] Support restore_stripes() from the given buffer Krzysztof Wojcik
2011-06-02 14:48 ` [PATCH 03/22] Define dummy functions to mdmon.c Krzysztof Wojcik
2011-06-02 14:48 ` [PATCH 04/22] imsm: Add support for copy area and backup operations Krzysztof Wojcik
2011-06-02 14:48 ` [PATCH 05/22] imsm: check migration compatibility Krzysztof Wojcik
2011-06-02 14:49 ` [PATCH 06/22] FIX: Initialize reshape structure Krzysztof Wojcik
2011-06-08  6:54   ` NeilBrown
2011-06-02 14:49 ` [PATCH 07/22] imsm: Add wait_for_reshape_imsm() implementation Krzysztof Wojcik
2011-06-08  7:07   ` NeilBrown [this message]
2011-06-02 14:49 ` [PATCH 08/22] imsm: Implement imsm_manage_reshape(), reshape workhorse Krzysztof Wojcik
2011-06-02 14:49 ` [PATCH 09/22] imsm: Check if array degradation has been changed Krzysztof Wojcik
2011-06-02 14:49 ` [PATCH 10/22] imsm: Clear migration record when no migration in progress Krzysztof Wojcik
2011-06-02 14:49 ` [PATCH 11/22] imsm: Add information about migration record to mdadm '-E' option Krzysztof Wojcik
2011-06-02 14:49 ` [PATCH 12/22] imsm: update blocks_per_migr_unit() to support migration record Krzysztof Wojcik
2011-06-02 14:49 ` [PATCH 13/22] Add reshape restart support for external metadata Krzysztof Wojcik
2011-06-02 14:50 ` [PATCH 14/22] imsm: Implement recover_backup_imsm() for imsm metadata Krzysztof Wojcik
2011-06-02 14:50 ` [PATCH 15/22] imsm: Disable checkpoint updating by mdmon for general migration Krzysztof Wojcik
2011-06-02 14:50 ` [PATCH 16/22] imsm: Add metadata update type for general migration check-pointing Krzysztof Wojcik
2011-06-02 14:50 ` [PATCH 17/22] imsm: Prepare checkpoint update for general migration Krzysztof Wojcik
2011-06-02 14:50 ` [PATCH 18/22] imsm: Apply checkpoint metadata " Krzysztof Wojcik
2011-06-02 14:50 ` [PATCH 19/22] FIX: Enable metadata updates for raid0 Krzysztof Wojcik
2011-06-02 14:50 ` [PATCH 20/22] Do not use backup file for external metadata Krzysztof Wojcik
2011-06-02 14:51 ` [PATCH 21/22] imsm: Remove user warning before reshape start Krzysztof Wojcik
2011-06-02 14:51 ` [PATCH 22/22] imsm: Unit Tests - remove backup-file during grow command Krzysztof Wojcik
2011-06-08  7:23 ` [PATCH 00/22] IMSM checkpointing implementation NeilBrown
2011-06-08  7:34   ` Wojcik, Krzysztof

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110608170703.07bc43c9@notabene.brown \
    --to=neilb@suse.de \
    --cc=adam.kwolek@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ed.ciechanowski@intel.com \
    --cc=krzysztof.wojcik@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=wojciech.neubauer@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).