Re: [PATCH 06/11] target/iscsi: Use min() in iscsit_dump_data_payload() instead of open-coding it

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

 



On 10/31/2017 07:03 PM, Bart Van Assche wrote:
> This patch does not change any functionality.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx>
> Cc: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxx>
> Cc: Hannes Reinecke <hare@xxxxxxxx>
> Cc: Mike Christie <mchristi@xxxxxxxxxx>
> ---
>  drivers/target/iscsi/iscsi_target_erl1.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c
> index fe9b7f1e44ac..659efafb43ec 100644
> --- a/drivers/target/iscsi/iscsi_target_erl1.c
> +++ b/drivers/target/iscsi/iscsi_target_erl1.c
> @@ -34,7 +34,7 @@
>  #include "iscsi_target_erl2.h"
>  #include "iscsi_target.h"
>  
> -#define OFFLOAD_BUF_SIZE	32768
> +#define OFFLOAD_BUF_SIZE	32768U
>  
>  /*
>   *	Used to dump excess datain payload for certain error recovery
> @@ -56,7 +56,7 @@ int iscsit_dump_data_payload(
>  	if (conn->sess->sess_ops->RDMAExtensions)
>  		return 0;
>  
> -	length = (buf_len > OFFLOAD_BUF_SIZE) ? OFFLOAD_BUF_SIZE : buf_len;
> +	length = min(buf_len, OFFLOAD_BUF_SIZE);
>  
>  	buf = kzalloc(length, GFP_ATOMIC);
>  	if (!buf) {
> @@ -67,8 +67,7 @@ int iscsit_dump_data_payload(
>  	memset(&iov, 0, sizeof(struct kvec));
>  
>  	while (offset < buf_len) {
> -		size = ((offset + length) > buf_len) ?
> -			(buf_len - offset) : length;
> +		size = min(buf_len - offset, length);
>  
>  		iov.iov_len = size;
>  		iov.iov_base = buf;
> 
Reviewed-by: Hannes Reinecke <hare@xxxxxxxx>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@xxxxxxxx			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux