[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1405862550-16694-2-git-send-email-riccardo.lucchese@gmail.com>
Date: Sun, 20 Jul 2014 15:22:28 +0200
From: Riccardo Lucchese <riccardo.lucchese@...il.com>
To: gregkh@...uxfoundation.org
Cc: dan.carpenter@...cle.com, oleg.drokin@...el.com,
josh@...htriplett.org, dmitry.eremin@...el.com,
john.hammond@...el.com, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org, julia.lawall@...6.fr,
Riccardo Lucchese <riccardo.lucchese@...il.com>
Subject: [PATCH v2 1/3] staging: lustre: lov: Cleanup lov_check_set() in lov_request.c
Make the code clearer by introducing a local variable and removing the
unnecessary 'if' statement.
Signed-off-by: Riccardo Lucchese <riccardo.lucchese@...il.com>
Acked-by: Julia Lawall <julia.lawall@...6.fr>
---
Changes in v2:
- Improved the commit message:
- changed the subject line to follow the same convention used by
previous commits to the same file.
- rewrote the message body using a more formal language.
- Introduced a local variable to make the code clearer.
- Added Acked-by - Julia.
drivers/staging/lustre/lustre/lov/lov_request.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c
index ce830e4..ae670bb 100644
--- a/drivers/staging/lustre/lustre/lov/lov_request.c
+++ b/drivers/staging/lustre/lustre/lov/lov_request.c
@@ -140,14 +140,14 @@ void lov_set_add_req(struct lov_request *req, struct lov_request_set *set)
static int lov_check_set(struct lov_obd *lov, int idx)
{
- int rc = 0;
+ int rc;
+ struct lov_tgt_desc *desc;
mutex_lock(&lov->lov_lock);
- if (lov->lov_tgts[idx] == NULL ||
- lov->lov_tgts[idx]->ltd_active ||
- (lov->lov_tgts[idx]->ltd_exp != NULL &&
- class_exp2cliimp(lov->lov_tgts[idx]->ltd_exp)->imp_connect_tried))
- rc = 1;
+ desc = lov->lov_tgts[idx];
+ rc = !desc || desc->ltd_active ||
+ (desc->ltd_exp &&
+ class_exp2cliimp(desc->ltd_exp)->imp_connect_tried);
mutex_unlock(&lov->lov_lock);
return rc;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists