Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3064788pxa; Tue, 18 Aug 2020 05:52:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwojDsyx9OA9G33HRST02Nh6YHEto0BLN8D/11pR6pP2ZlBZMKKsKcmLYbsUnbxFnzKNxKp X-Received: by 2002:aa7:c6c3:: with SMTP id b3mr19925210eds.215.1597755160606; Tue, 18 Aug 2020 05:52:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597755160; cv=none; d=google.com; s=arc-20160816; b=IjBXHOYVvgFq+XzlTVYmAe6qNlccBZscyLbPjDo9UY/eyj2b44/W/xU0B3WiSizHQF VMZDxGajU6V6q2/3ugteHXjXq23cacsR+3uRR0qBNwz4jplgL2ch0GHDQ9R0RDKNTxN8 dxQFgOOrJ/OxjS4+dGxTEdJ7eAdKs4jRmgw5LgIDoy1iC4AuvTiEROc6DWBPhMT6OTfY TxHbVbVUd23h+4ytTi7D+pgFSZenKWp8OhfQBm0vUbe045kjDoIP0At4SXduGo9WPyO3 GxLLLhC/f9Sq+6A82TQ0sl/tWoXhuLOSFi8QDNQG1IwPKWPRWPczaJRB519nEE366rIz Q5xg== 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=NOH279WB+19Agj+W01eW07fPoPPxrNMeXtHnKKfXMqs=; b=exRTIg2TqZYFl3QhKaiRYPbq94AK94ZS+XCE/FLNuQHEcnV/xKcG//6zsPkvDfwOsv ad1uWAmo1OT+lBpMH14W7t2V7mJ4cPd4XCjQ/DhAQeTLpXf+4UXD4/90X5kjD8Q1txjf txKdiVS/kofewlWKWwpQHZWhElIoa4bvbX2QiVWLwi1gb7ljWt9ruezPcFsotEH85VFR fkH6Yn47RwiNiTVuBiSDHaxdUdn2s+8zMVHCFLdLtU0M/2MZU9L/XJq0D5tw2vx717Yq sfDS3V11EBOdcZVl5hYo+S3NKuwZSNIkn4pcCluRNILbC4gO8hfjlBWr8lHdo20A3CMg cPNw== 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 v6si13008166edq.488.2020.08.18.05.52.16; Tue, 18 Aug 2020 05:52:40 -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 S1726980AbgHRMtG (ORCPT + 99 others); Tue, 18 Aug 2020 08:49:06 -0400 Received: from mx2.suse.de ([195.135.220.15]:49694 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726916AbgHRMse (ORCPT ); Tue, 18 Aug 2020 08:48:34 -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 62052AF13; Tue, 18 Aug 2020 12:48:58 +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 , Ilya Dryomov , Jeff Layton Subject: [PATCH v6 6/6] libceph: use sendpage_ok() in ceph_tcp_sendpage() Date: Tue, 18 Aug 2020 20:47:36 +0800 Message-Id: <20200818124736.5790-7-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 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 Cc: Ilya Dryomov Cc: Jeff Layton --- 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 27d6ab11f9ee..6a349da7f013 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