Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3063454pxa; Tue, 18 Aug 2020 05:50:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOf/1Wz/vzYOuA9KRMJrfQZ3AoiVcb9HTwabe4mLSUWMQ92elJ6NJBuSam0gpMhpao8oEQ X-Received: by 2002:a17:907:213c:: with SMTP id qo28mr19649810ejb.174.1597755016895; Tue, 18 Aug 2020 05:50:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597755016; cv=none; d=google.com; s=arc-20160816; b=KgJfqF4qG05FJZzH4YGAlVn5Ey1EoZOtbDn4yLL1UX8Jya8AOWrfyV8VCvVP32AS8O NJVcYzSzKh8vjvupZFAopzV4apwKrWdKzW3W3rv9Xi6WSgimQImhi95YCnXu2oYpmyWI XQYDFG6WQr9ynaNeOhguSFmN7DUkn7kNveWNOCb1GZKY+DDW1twMJv3XfCxuaRbLLnVH +ictRP7v3RQ7qhHdg01JPHZynmZ09lg63ewISGQ2wJOP6QIcXUk0eXBUaxus2ij9vqhQ ux/PkT0jyPOYMaBR+MRZ/xq/08u7gdS7aUN2qgXXdlAGfsRNP96dAb15jvN1Ilg5aJbN djsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=99mx7mNAMvSAMsnNjk7WfbEPMgEJl6N2aUMpizxR1kY=; b=B2Ra9eUuDB439jYP9Ce1IQCM3LUJRfIXbAZSP+QwIoHD31svgZb2JzeLDhT+HXhkIk syjTgjKwSiqOXvy9r8MoUtv+187N3jIRJ5QZODz2B8M1bT8TszuhoxOmh18SeIJp3/0z mXTs2UZQdCQGBDK195TzWBKnxrALadFHnTmh8Rm7Lib0yTuHWfACTxWV8dXMEGes0vJV /mH8OrBUoT6wcNU82DaMKEFtOw6yz6jdk9MvRf8ev/4Q/TCUw9Nd+rd+z8c4x0snJxkl r3hhmSg0/MGbUQ69/0bBr+eREzOh1rV7axARtKpOtsv0XxvSrnLnAEGFIp2u/t8F903t oLJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q1si13026077edn.222.2020.08.18.05.49.53; Tue, 18 Aug 2020 05:50:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726930AbgHRMsg (ORCPT + 99 others); Tue, 18 Aug 2020 08:48:36 -0400 Received: from mx2.suse.de ([195.135.220.15]:49614 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726828AbgHRMs3 (ORCPT ); Tue, 18 Aug 2020 08:48:29 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0CF9EADF2; Tue, 18 Aug 2020 12:48:53 +0000 (UTC) From: Coly Li To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, netdev@vger.kernel.org, open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org, ceph-devel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Coly Li , Vasily Averin , Cong Wang , Mike Christie , Lee Duncan , Chris Leech , Christoph Hellwig , Hannes Reinecke Subject: [PATCH v6 5/6] scsi: libiscsi: use sendpage_ok() in iscsi_tcp_segment_map() Date: Tue, 18 Aug 2020 20:47:35 +0800 Message-Id: <20200818124736.5790-6-colyli@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200818124736.5790-1-colyli@suse.de> References: <20200818124736.5790-1-colyli@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Vasily Averin Cc: Cong Wang Cc: Mike Christie Cc: Lee Duncan Cc: Chris Leech Cc: Christoph Hellwig Cc: Hannes Reinecke --- 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