Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp244145pxk; Thu, 1 Oct 2020 00:57:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbomBkdWOYZ+QAcsX9kZu48aPm5Lodb/rY+KM3dgD2qFHMpY72XYyeG/OdchQKLzYuz/MU X-Received: by 2002:a50:ee15:: with SMTP id g21mr6895176eds.47.1601539052156; Thu, 01 Oct 2020 00:57:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601539052; cv=none; d=google.com; s=arc-20160816; b=hv0ln2fX/fe0ed3v6L7WMzgesXL4Fi5hDufa1GeKiPt6rDHGK7IKlhWCM49O5U+GBO +BVd40JF3npBpxpQXf9WcV9lcUIpp4EgYuqTiC5Ix3E87uuO+tLp98tKDSj316HUvvHn eKUsBGuI2lpFEW6D5v5/bNyMoaVm9YAKlIYgbb3/4IG+KxR9ABSW/Dxyb8EVMNaElUtt DNgq0dnhbfCl79NBIal2DcMeRdggUcbdL4f8LQdj+MuSM/SyVcpRmYSB0zVw+vzxjVpz RFPcpS/7EwYGbKi3QaNtfkCQITm2ubiSEjNZk2y9OZOKkqcqvBuDZ9xDaNIPl20ruJL+ qQJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=wdxccPJYBdmTzMEd5xc2H4jr+0bv352WMLEJoTJja40=; b=puEvGEQMkXU3hvjvNF1ALIrDspjeJ2oh1NtbH113GDVFAestzJjB+/d0sKWYR7hRq9 45GDdU7cqPMWvamgeMW4VlejYZD3Lucx2ifJ0ur88/tjQF52G30ZuxmUKmpMBzUaj0PN wqyT/kW72pBHe5811VTozm+kgRm6KQmM+sQyQZIqHly60I8ZXxIYgzKALS7QYOaG7Z2M 6EgGuFVTUgehH6d3WEIueWZ8ACOqHv0aWR17lcTUoynCb0rpd5rMuq51siqagcGUuI72 Gw6Dpj8uIYjD3ikcu+xXyeCJJofsNrIyq/fZhL+6B7bkLCtyPdKqEnNXY/o0TZpk26sT eRSw== 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 w4si2774552ede.468.2020.10.01.00.57.09; Thu, 01 Oct 2020 00:57:32 -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 S1731822AbgJAHzU (ORCPT + 99 others); Thu, 1 Oct 2020 03:55:20 -0400 Received: from mx2.suse.de ([195.135.220.15]:45236 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726540AbgJAHzN (ORCPT ); Thu, 1 Oct 2020 03:55:13 -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 2664FAD64; Thu, 1 Oct 2020 07:55:12 +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 , Jeff Layton , Ilya Dryomov Subject: [PATCH v9 7/7] libceph: use sendpage_ok() in ceph_tcp_sendpage() Date: Thu, 1 Oct 2020 15:54:08 +0800 Message-Id: <20201001075408.25508-8-colyli@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201001075408.25508-1-colyli@suse.de> References: <20201001075408.25508-1-colyli@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In libceph, ceph_tcp_sendpage() does the following checks before handle the page by network layer's zero copy sendpage method, if (page_count(page) >= 1 && !PageSlab(page)) This check is exactly what sendpage_ok() does. This patch replace the open coded checks by sendpage_ok() as a code cleanup. Signed-off-by: Coly Li Acked-by: Jeff Layton Cc: Ilya Dryomov --- net/ceph/messenger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index bdfd66ba3843..d4d7a0e52491 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -575,7 +575,7 @@ static int ceph_tcp_sendpage(struct socket *sock, struct page *page, * coalescing neighboring slab objects into a single frag which * triggers one of hardened usercopy checks. */ - if (page_count(page) >= 1 && !PageSlab(page)) + if (sendpage_ok(page)) sendpage = sock->ops->sendpage; else sendpage = sock_no_sendpage; -- 2.26.2