Re: [PATCH] md-cluster: correct the num for comparison

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 04/10/2015 03:06 AM, gqjiang@xxxxxxxx wrote:
From: Guoqing Jiang <gqjiang@xxxxxxxx>

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@xxxxxxxx>
---
  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
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux