linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] md-cluster: correct the num for comparison
@ 2015-04-10  8:06 gqjiang
  2015-04-10 13:35 ` Goldwyn Rodrigues
  0 siblings, 1 reply; 2+ messages in thread
From: gqjiang @ 2015-04-10  8:06 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, rgoldwyn, Guoqing Jiang

From: Guoqing Jiang <gqjiang@suse.com>

Since the node num of md-cluster is from zero, and
cinfo->slot_number represents the slot num of dlm,
here also need to deduct one to keep consistency
with other codes.

Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
---
 drivers/md/md-cluster.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index ae8bb54..531cc2b 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -612,7 +612,7 @@ static int join(struct mddev *mddev, int nodes)
 	if (ret)
 		goto err;
 	wait_for_completion(&cinfo->completion);
-	if (nodes <= cinfo->slot_number) {
+	if (nodes <= cinfo->slot_number - 1) {
 		pr_err("md-cluster: Slot allotted(%d) greater than available slots(%d)", cinfo->slot_number - 1,
 			nodes);
 		ret = -ERANGE;
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] md-cluster: correct the num for comparison
  2015-04-10  8:06 [PATCH] md-cluster: correct the num for comparison gqjiang
@ 2015-04-10 13:35 ` Goldwyn Rodrigues
  0 siblings, 0 replies; 2+ messages in thread
From: Goldwyn Rodrigues @ 2015-04-10 13:35 UTC (permalink / raw)
  To: gqjiang, neilb; +Cc: linux-raid



On 04/10/2015 03:06 AM, gqjiang@suse.com wrote:
> From: Guoqing Jiang <gqjiang@suse.com>
>
> Since the node num of md-cluster is from zero, and
> cinfo->slot_number represents the slot num of dlm,
> here also need to deduct one to keep consistency
> with other codes.


This is a good find. Though I would prefer that the comparison be
(nodes < cinfo->slot_number) to decrease computation and looks better, 
though the compiler may optimize what you have done as well.

>
> Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
> ---
>   drivers/md/md-cluster.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
> index ae8bb54..531cc2b 100644
> --- a/drivers/md/md-cluster.c
> +++ b/drivers/md/md-cluster.c
> @@ -612,7 +612,7 @@ static int join(struct mddev *mddev, int nodes)
>   	if (ret)
>   		goto err;
>   	wait_for_completion(&cinfo->completion);
> -	if (nodes <= cinfo->slot_number) {
> +	if (nodes <= cinfo->slot_number - 1) {
>   		pr_err("md-cluster: Slot allotted(%d) greater than available slots(%d)", cinfo->slot_number - 1,
>   			nodes);
>   		ret = -ERANGE;
>

-- 
Goldwyn

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-10 13:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-10  8:06 [PATCH] md-cluster: correct the num for comparison gqjiang
2015-04-10 13:35 ` Goldwyn Rodrigues

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).