Skip to contentSkip to conversation

nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()

PATCH Superseded Varun Prakash 3 participants 8 messages Jul 27, 2023 – Aug 1, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()

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")
---
 drivers/nvme/target/tcp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/target/tcp.c +2 -2
index 868aa4de2e4c..05163751f2e5 100644
@@ -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);
Signature · 1 line
2.31.1
maintainer
#2 lore raw

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

maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to Varun Prakash
Quoted 16 lines

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")
---
  drivers/nvme/target/tcp.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/target/tcp.c +0 -0
index 868aa4de2e4c..05163751f2e5 100644

drivers/nvme/target/tcp.c static void nvmet_tcp_build_pdu_iovec(struct nvmet_tcp_cmd *cmd) · line 352

Quoted 7 lines
drivers/nvme/target/tcp.c +2 -2
@@ -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,

#4 lore raw
Quoted 10 lines
Quoted 10 lines
drivers/nvme/target/tcp.c +0 -0
index 868aa4de2e4c..05163751f2e5 100644
@@ -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);
 
Quoted 6 lines

drivers/nvme/target/tcp.c static void nvmet_tcp_build_pdu_iovec(struct nvmet_tcp_cmd *cmd) · line 352

Quoted 4 lines
drivers/nvme/target/tcp.c +2 -2
-		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);
#5 lore raw
Quoted 1 line · Varun Prakash

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.

maintainer
#6 lore raw
Quoted 6 lines · On 7/31/23 22:38, [email protected] wrote:
Quoted 1 line · Varun Prakash

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?

#7 lore raw
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

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.