Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1274249 > unrolled thread

[PATCH] IB/iser: use sector_div instead of do_div

Started byArnd Bergmann <arnd@arndb.de>
First post2015-11-20 17:50 +0100
Last post2015-11-21 03:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] IB/iser: use sector_div instead of do_div Arnd Bergmann <arnd@arndb.de> - 2015-11-20 17:50 +0100
    Re: [PATCH] IB/iser: use sector_div instead of do_div Sagi Grimberg <sagig@dev.mellanox.co.il> - 2015-11-21 03:20 +0100

#1274249 — [PATCH] IB/iser: use sector_div instead of do_div

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-20 17:50 +0100
Subject[PATCH] IB/iser: use sector_div instead of do_div
Message-ID<qwX2O-1hA-17@gated-at.bofh.it>
do_div is the wrong way to divide a sector_t, as it is less
efficient when sector_t is 32-bit wide. With the upcoming
do_div optimizations, the kernel starts warning about this:

drivers/infiniband/ulp/iser/iser_verbs.c:1296:4: note: in expansion of macro 'do_div'
include/asm-generic/div64.h:224:22: warning: passing argument 1 of '__div64_32' from incompatible pointer type

This changes the code to use sector_div instead, which always
produces optimal code.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index a93070210109..42f4da620f2e 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -1293,7 +1293,7 @@ u8 iser_check_task_pi_status(struct iscsi_iser_task *iser_task,
 		if (mr_status.fail_status & IB_MR_CHECK_SIG_STATUS) {
 			sector_t sector_off = mr_status.sig_err.sig_err_offset;
 
-			do_div(sector_off, sector_size + 8);
+			sector_div(sector_off, sector_size + 8);
 			*sector = scsi_get_lba(iser_task->sc) + sector_off;
 
 			pr_err("PI error found type %d at sector %llx "

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1274593

FromSagi Grimberg <sagig@dev.mellanox.co.il>
Date2015-11-21 03:20 +0100
Message-ID<qx5Wq-7lt-5@gated-at.bofh.it>
In reply to#1274249
> do_div is the wrong way to divide a sector_t, as it is less
> efficient when sector_t is 32-bit wide. With the upcoming
> do_div optimizations, the kernel starts warning about this:
>
> drivers/infiniband/ulp/iser/iser_verbs.c:1296:4: note: in expansion of macro 'do_div'
> include/asm-generic/div64.h:224:22: warning: passing argument 1 of '__div64_32' from incompatible pointer type
>
> This changes the code to use sector_div instead, which always
> produces optimal code.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks Arnd,

Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web