OSDN Git Service

IB/iser: Refactor iscsi_iser_check_protection function
authorIsrael Rukshin <israelr@mellanox.com>
Wed, 15 May 2019 10:49:25 +0000 (13:49 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Tue, 21 May 2019 18:01:05 +0000 (15:01 -0300)
Reduce lines of code by using local variable.

Signed-off-by: Israel Rukshin <israelr@mellanox.com>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/ulp/iser/iscsi_iser.c

index 9c185a8..dbad827 100644 (file)
@@ -406,13 +406,10 @@ static u8
 iscsi_iser_check_protection(struct iscsi_task *task, sector_t *sector)
 {
        struct iscsi_iser_task *iser_task = task->dd_data;
+       enum iser_data_dir dir = iser_task->dir[ISER_DIR_IN] ?
+                                       ISER_DIR_IN : ISER_DIR_OUT;
 
-       if (iser_task->dir[ISER_DIR_IN])
-               return iser_check_task_pi_status(iser_task, ISER_DIR_IN,
-                                                sector);
-       else
-               return iser_check_task_pi_status(iser_task, ISER_DIR_OUT,
-                                                sector);
+       return iser_check_task_pi_status(iser_task, dir, sector);
 }
 
 /**