Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3081403pxa; Tue, 18 Aug 2020 06:15:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6QnqOdR9K92A15CaeMrln+WvJdVMYKdKC/uWwtxJnSzVvxpXVoECDTGS1e4VPTXLz8l3e X-Received: by 2002:a05:6402:17bb:: with SMTP id j27mr19078182edy.291.1597756522106; Tue, 18 Aug 2020 06:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597756522; cv=none; d=google.com; s=arc-20160816; b=Srce1jHGgwESaHnFODBbhpk7fUrH6TD2GAcJ2jxmvAmUCEoiw03Kzcx85+Zh8CZYao OBE/AchFgYlmXsobg6JS6Kz8afQncxoumHXNksfFEA3xtdSDc1up1JHLvf9Ghm6iMr8R zv7pwfwAljMFxvUsBGpiAtVRhxOOXUujoRsBnPY/gMMnQDlG4rQmnEwjXNJ6PVOYcvJg i1XXdmeMZThJmyS2c5wzcmBoqmuNCj+Qnirh8PDxmx3Df+oF8U8teu9+lZa/fVt7mQbM VzYb6e3qO3rXdb2ff1tByvRQdxAmIKieTCl4jAsUP4jU5QEN+TkaJuA1zxFuPdAW3Rfx XaVg== 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=Czvf0dqoqBrBPtDitLESWKMtGxSyDA+vkR+j95lMS6O5FRlGj+BizqxSimr+rn84SG /7OMI963jpfmwZkGP7gFsUvPz/AoRd2G0+UP+mnS9NzBU5C2+1yJrqpxdtD1Jpx8zv9m xhhPiCFWuWV9hpznS70M1jt7ckenGlgJoZCUooluSzoxNASNjgyGJpneGnOSRsAr/V5q +v+u/wnx2NfWG1MU2srk1+eeMPC0u+0bqqSxq3dg9xWg+knl7bCSp8mJJvB5lwNAcXAy 43eiAs6rTYKFWWq5HRWksYpubAJXQyGox9FsCPiv+w9bR8Rb0b73RZEloQst2StZKA8b j3AQ== 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 o10si13282914edv.301.2020.08.18.06.14.58; Tue, 18 Aug 2020 06:15:22 -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 S1726918AbgHRNNp (ORCPT + 99 others); Tue, 18 Aug 2020 09:13:45 -0400 Received: from mx2.suse.de ([195.135.220.15]:33628 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726829AbgHRNNf (ORCPT ); Tue, 18 Aug 2020 09:13:35 -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 929A8B17F; Tue, 18 Aug 2020 13:13:59 +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 v7 5/6] scsi: libiscsi: use sendpage_ok() in iscsi_tcp_segment_map() Date: Tue, 18 Aug 2020 21:12:26 +0800 Message-Id: <20200818131227.37020-6-colyli@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200818131227.37020-1-colyli@suse.de> References: <20200818131227.37020-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