Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1128509pxk; Fri, 2 Oct 2020 01:31:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyuyLQ6fwkUcPqn9EdTqMkLqh/cyP14GCYrDp5wNtJtkUYMOU9hlmO8c8yrTe4avCZkIHA X-Received: by 2002:a05:6402:16c9:: with SMTP id r9mr1117365edx.27.1601627511157; Fri, 02 Oct 2020 01:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601627511; cv=none; d=google.com; s=arc-20160816; b=DYpY+BYKglDEQ5d/YPmUqZWQ8EZPJPlBKTecdrsOKW8+GyZ2gdhhr9bMNbIcN7FX63 b3U0nijGhN8Kwr/jTyWTTSt6LSJG2emBE0KOT/bP5rIlH0DM+UGXy24hHFAm44PKpkvg Jcw7UJ8Mz22M8RY1pcpk8ijvvEdFV6DQVzi6NPb6R9HW70Mf02zAGCrHUcR7pmT41E1G slWcpwPrlOhFalVh2O9Kiw1lygLBWqHgPtpHEjpy18NRXx5XPqIlk7CPqurRc48U7hI6 9+YgpB9oploxHdWZi2At1B4hUuwAGQ4S5/1qK9z/+kfVtdCDRC3JVl+sQ8piJRbee6ps p2zA== 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=vHQTRB1KlW+4yTfe2shMGf4Qanxe9gATVMeRCZjdIKOuqutgi3VrVnGhm6NwaR1PQb LNxgMxQQAgbfPstTc4Jbts4bBZsf3E/wvrIf0geKOdt9ecJVZ9OsiH0drihFGXkX73YR NC9cVpneOEkgLm4D7OEu3Qk4Q/s2s+VsoNajR8seZI0yp2BOfrPjepRVQFN/RlwcUW/N rQ3+TVmh+x8SzlxKtP/6gJ+ninfA/cvwPxEf0c+B/dk2JLnuPkFAf0vFr6kYVZhSTlGh mULl/cD9+xdq4Lvwe9R2voJ9YKaBpQqRlf9416rsetAjL1pFa3qyjpfYsrAlLlGRcKKj bHZQ== 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 i14si524233edj.61.2020.10.02.01.31.27; Fri, 02 Oct 2020 01:31:51 -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 S2387751AbgJBI2o (ORCPT + 99 others); Fri, 2 Oct 2020 04:28:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:50470 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387740AbgJBI2l (ORCPT ); Fri, 2 Oct 2020 04:28:41 -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 14465B1D2; Fri, 2 Oct 2020 08:28:40 +0000 (UTC) From: Coly Li To: davem@davemloft.net, 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 v10 7/7] libceph: use sendpage_ok() in ceph_tcp_sendpage() Date: Fri, 2 Oct 2020 16:27:34 +0800 Message-Id: <20201002082734.13925-8-colyli@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201002082734.13925-1-colyli@suse.de> References: <20201002082734.13925-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