All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()
@ 2023-07-27 15:05 Varun Prakash
  2023-07-31  5:59 ` Christoph Hellwig
  2023-07-31 13:41 ` Sagi Grimberg
  0 siblings, 2 replies; 8+ messages in thread
From: Varun Prakash @ 2023-07-27 15:05 UTC (permalink / raw)
  To: sagi, hch; +Cc: linux-nvme, varun, Rakshana Sridhar

iov_len is the valid data length, so pass iov_len instead of sg->length to
bvec_set_page().

Fixes: 5bfaba275ae6 ("nvmet-tcp: don't map pages which can't come from HIGHMEM")
Signed-off-by: Rakshana Sridhar <rakshanas@chelsio.com>
Signed-off-by: Varun Prakash <varun@chelsio.com>
---
 drivers/nvme/target/tcp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index 868aa4de2e4c..05163751f2e5 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -348,8 +348,8 @@ static void nvmet_tcp_build_pdu_iovec(struct nvmet_tcp_cmd *cmd)
 	while (length) {
 		u32 iov_len = min_t(u32, length, sg->length - sg_offset);
 
-		bvec_set_page(iov, sg_page(sg), sg->length,
-				sg->offset + sg_offset);
+		bvec_set_page(iov, sg_page(sg), iov_len,
+			      sg->offset + sg_offset);
 
 		length -= iov_len;
 		sg = sg_next(sg);
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()
  2023-07-27 15:05 [PATCH] nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page() Varun Prakash
@ 2023-07-31  5:59 ` Christoph Hellwig
  2023-07-31  9:13   ` Sagi Grimberg
  2023-07-31 13:41 ` Sagi Grimberg
  1 sibling, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2023-07-31  5:59 UTC (permalink / raw)
  To: Varun Prakash; +Cc: sagi, hch, linux-nvme, Rakshana Sridhar

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()
  2023-07-31  5:59 ` Christoph Hellwig
@ 2023-07-31  9:13   ` Sagi Grimberg
  0 siblings, 0 replies; 8+ messages in thread
From: Sagi Grimberg @ 2023-07-31  9:13 UTC (permalink / raw)
  To: Christoph Hellwig, Varun Prakash; +Cc: linux-nvme, Rakshana Sridhar

I don't see the original patch(es), Varun can you please resend and CC
me?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()
  2023-07-27 15:05 [PATCH] nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page() Varun Prakash
  2023-07-31  5:59 ` Christoph Hellwig
@ 2023-07-31 13:41 ` Sagi Grimberg
  2023-07-31 18:30   ` Varun Prakash
  1 sibling, 1 reply; 8+ messages in thread
From: Sagi Grimberg @ 2023-07-31 13:41 UTC (permalink / raw)
  To: Varun Prakash, hch; +Cc: linux-nvme, Rakshana Sridhar


> iov_len is the valid data length, so pass iov_len instead of sg->length to
> bvec_set_page().
> 
> Fixes: 5bfaba275ae6 ("nvmet-tcp: don't map pages which can't come from HIGHMEM")
> Signed-off-by: Rakshana Sridhar <rakshanas@chelsio.com>
> Signed-off-by: Varun Prakash <varun@chelsio.com>
> ---
>   drivers/nvme/target/tcp.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
> index 868aa4de2e4c..05163751f2e5 100644
> --- a/drivers/nvme/target/tcp.c
> +++ b/drivers/nvme/target/tcp.c
> @@ -348,8 +348,8 @@ static void nvmet_tcp_build_pdu_iovec(struct nvmet_tcp_cmd *cmd)
>   	while (length) {
>   		u32 iov_len = min_t(u32, length, sg->length - sg_offset);
>   
> -		bvec_set_page(iov, sg_page(sg), sg->length,
> -				sg->offset + sg_offset);
> +		bvec_set_page(iov, sg_page(sg), iov_len,
> +			      sg->offset + sg_offset);

The second line alignment modification is unneeded.
Other than that,

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()
  2023-07-31 13:41 ` Sagi Grimberg
@ 2023-07-31 18:30   ` Varun Prakash
  2023-07-31 19:38     ` hch
  0 siblings, 1 reply; 8+ messages in thread
From: Varun Prakash @ 2023-07-31 18:30 UTC (permalink / raw)
  To: Sagi Grimberg, hch; +Cc: linux-nvme, Rakshana S


>> 
>> diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c 
>> index 868aa4de2e4c..05163751f2e5 100644
>> --- a/drivers/nvme/target/tcp.c
>> +++ b/drivers/nvme/target/tcp.c
>> @@ -348,8 +348,8 @@ static void nvmet_tcp_build_pdu_iovec(struct nvmet_tcp_cmd *cmd)
>>   	while (length) {
>>   		u32 iov_len = min_t(u32, length, sg->length - sg_offset);
>>   
>> -		bvec_set_page(iov, sg_page(sg), sg->length,
>> -				sg->offset + sg_offset);
>> +		bvec_set_page(iov, sg_page(sg), iov_len,
>> +			      sg->offset + sg_offset);
>
>The second line alignment modification is unneeded.

checkpatch.pl was reporting following CHECK warning so I fixed the alignment.

CHECK: Alignment should match open parenthesis
#27: FILE: drivers/nvme/target/tcp.c:352:
+               bvec_set_page(iov, sg_page(sg), iov_len,
                                sg->offset + sg_offset);


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()
  2023-07-31 18:30   ` Varun Prakash
@ 2023-07-31 19:38     ` hch
  2023-08-01  7:34       ` Sagi Grimberg
  0 siblings, 1 reply; 8+ messages in thread
From: hch @ 2023-07-31 19:38 UTC (permalink / raw)
  To: Varun Prakash; +Cc: Sagi Grimberg, hch, linux-nvme, Rakshana S

On Mon, Jul 31, 2023 at 06:30:33PM +0000, Varun Prakash wrote:
> checkpatch.pl was reporting following CHECK warning so I fixed the alignment.

checkpatch.pl is unfortunately not much more useful than Markus Elfring
these days.  Opening brace alignment is a common style and makes sense
in some places, but tab-based alignment often is much easier to maintain.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()
  2023-07-31 19:38     ` hch
@ 2023-08-01  7:34       ` Sagi Grimberg
  2023-08-01  8:19         ` Varun Prakash
  0 siblings, 1 reply; 8+ messages in thread
From: Sagi Grimberg @ 2023-08-01  7:34 UTC (permalink / raw)
  To: hch, Varun Prakash; +Cc: linux-nvme, Rakshana S



On 7/31/23 22:38, hch@lst.de wrote:
> On Mon, Jul 31, 2023 at 06:30:33PM +0000, Varun Prakash wrote:
>> checkpatch.pl was reporting following CHECK warning so I fixed the alignment.
> 
> checkpatch.pl is unfortunately not much more useful than Markus Elfring
> these days.  Opening brace alignment is a common style and makes sense
> in some places, but tab-based alignment often is much easier to maintain.

Yea, this warning in particular is not something that we are
maintaining. Care to respin the patch?



^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()
  2023-08-01  7:34       ` Sagi Grimberg
@ 2023-08-01  8:19         ` Varun Prakash
  0 siblings, 0 replies; 8+ messages in thread
From: Varun Prakash @ 2023-08-01  8:19 UTC (permalink / raw)
  To: Sagi Grimberg, hch; +Cc: linux-nvme, Rakshana S


>>> checkpatch.pl was reporting following CHECK warning so I fixed the alignment.
>> 
>> checkpatch.pl is unfortunately not much more useful than Markus Elfring
>> these days.  Opening brace alignment is a common style and makes sense
>> in some places, but tab-based alignment often is much easier to maintain.
>
>Yea, this warning in particular is not something that we are
>maintaining. Care to respin the patch?

Ok, I will send v2.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-08-01  8:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-27 15:05 [PATCH] nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page() Varun Prakash
2023-07-31  5:59 ` Christoph Hellwig
2023-07-31  9:13   ` Sagi Grimberg
2023-07-31 13:41 ` Sagi Grimberg
2023-07-31 18:30   ` Varun Prakash
2023-07-31 19:38     ` hch
2023-08-01  7:34       ` Sagi Grimberg
2023-08-01  8:19         ` Varun Prakash

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.