[PATCH v6 5/6] scsi: libiscsi: use sendpage_ok() in iscsi_tcp_segment_map()

7 views
Skip to first unread message

Coly Li

unread,
Aug 18, 2020, 6:34:06 PM8/18/20
to linux...@vger.kernel.org, linux...@lists.infradead.org, net...@vger.kernel.org, open-...@googlegroups.com, linux...@vger.kernel.org, ceph-...@vger.kernel.org, linux-...@vger.kernel.org, Coly Li, Vasily Averin, Cong Wang, Mike Christie, Lee Duncan, Chris Leech, Christoph Hellwig, Hannes Reinecke
In iscsci driver, iscsi_tcp_segment_map() uses the following code to
check whether the page should or not be handled by sendpage:
if (!recv && page_count(sg_page(sg)) >= 1 && !PageSlab(sg_page(sg)))

The "page_count(sg_page(sg)) >= 1 && !PageSlab(sg_page(sg)" part is to
make sure the page can be sent to network layer's zero copy path. This
part is exactly what sendpage_ok() does.

This patch uses use sendpage_ok() in iscsi_tcp_segment_map() to replace
the original open coded checks.

Signed-off-by: Coly Li <col...@suse.de>
Cc: Vasily Averin <v...@virtuozzo.com>
Cc: Cong Wang <amw...@redhat.com>
Cc: Mike Christie <mich...@cs.wisc.edu>
Cc: Lee Duncan <ldu...@suse.com>
Cc: Chris Leech <cle...@redhat.com>
Cc: Christoph Hellwig <h...@lst.de>
Cc: Hannes Reinecke <ha...@suse.de>
---
drivers/scsi/libiscsi_tcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c
index 6ef93c7af954..31cd8487c16e 100644
--- a/drivers/scsi/libiscsi_tcp.c
+++ b/drivers/scsi/libiscsi_tcp.c
@@ -128,7 +128,7 @@ static void iscsi_tcp_segment_map(struct iscsi_segment *segment, int recv)
* coalescing neighboring slab objects into a single frag which
* triggers one of hardened usercopy checks.
*/
- if (!recv && page_count(sg_page(sg)) >= 1 && !PageSlab(sg_page(sg)))
+ if (!recv && sendpage_ok(sg_page(sg)))
return;

if (recv) {
--
2.26.2

Coly Li

unread,
Aug 18, 2020, 6:34:07 PM8/18/20
to linux...@vger.kernel.org, linux...@lists.infradead.org, net...@vger.kernel.org, open-...@googlegroups.com, linux...@vger.kernel.org, ceph-...@vger.kernel.org, linux-...@vger.kernel.org, Coly Li, Vasily Averin, Cong Wang, Mike Christie, Lee Duncan, Chris Leech, Christoph Hellwig, Hannes Reinecke
Reply all
Reply to author
Forward
0 new messages