Re: [PATCH v2 1/3] staging: lustre: lov: Cleanup lov_check_set() in lov_request.c

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

 



On Sun, 2014-07-20 at 15:22 +0200, Riccardo Lucchese wrote:
> Make the code clearer by introducing a local variable and removing the
> unnecessary 'if' statement.
> 
> Signed-off-by: Riccardo Lucchese <riccardo.lucchese@xxxxxxxxx>
> Acked-by: Julia Lawall <julia.lawall@xxxxxxx>
> ---
> 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;

desc is not a good temporary name here.

For consistency with the rest of the code
please use tgt

$ git grep "= lov->lov_tgts.*];"
drivers/staging/lustre/lustre/lov/lov_obd.c:                    tgt = lov->lov_tgts[i];
drivers/staging/lustre/lustre/lov/lov_obd.c:            tgt = lov->lov_tgts[i];
drivers/staging/lustre/lustre/lov/lov_obd.c:            tgt = lov->lov_tgts[index];
drivers/staging/lustre/lustre/lov/lov_obd.c:            tgt = lov->lov_tgts[index];
drivers/staging/lustre/lustre/lov/lov_obd.c:                    tgt = lov->lov_tgts[qctl->qc_idx];
drivers/staging/lustre/lustre/lov/lov_obd.c:                            tgt = lov->lov_tgts[i];
drivers/staging/lustre/lustre/lov/lov_obd.c:            tgt = lov->lov_tgts[info->idx];
drivers/staging/lustre/lustre/lov/lov_obd.c:            tgt = lov->lov_tgts[ost_idx];
drivers/staging/lustre/lustre/lov/lov_obd.c:                    tgt = lov->lov_tgts[((struct obd_id_info *)val)->idx];
drivers/staging/lustre/lustre/lov/lov_obd.c:                    tgt = lov->lov_tgts[i];
drivers/staging/lustre/lustre/lov/lov_obd.c:            tgt = lov->lov_tgts[i];
drivers/staging/lustre/lustre/lov/lov_request.c:        tgt = lov->lov_tgts[ost_idx];
drivers/staging/lustre/lustre/lov/lov_request.c:        tgt = lov->lov_tgts[lovreq->rq_idx];


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux