Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3082848pxa; Tue, 18 Aug 2020 06:17:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWRTQnGwPReNAYt4/cBTlHJSdnZ7D6TJ9/Yq5FcEPDyGDO3kW7CG8aJE8lq/wPlyjz9xpw X-Received: by 2002:a17:906:7104:: with SMTP id x4mr21042143ejj.417.1597756635911; Tue, 18 Aug 2020 06:17:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597756635; cv=none; d=google.com; s=arc-20160816; b=bVNIiBvh8wauKhw/qRmfJb/Xj9daeZFppMHUSH9ENUPX/qqPOBgZKVmMI2JobhH+D3 mfUOH1OkfSNvBSVHTOCK4m3ZuZB2n91bqgkZrzGCoSiP0B+m5J6ymeXDq+hgsuR4xV9l 0/GDxDE9wv43Q8K29d4TxPOp+opGvwMbiGWcYGb8L1C0vFHLiD3jPEKwDve+2Pa9AXxk AO763Q9BPvTcMhmHJ8BFBxqk7wy++qoyz3+6FvyrPTQW9f41uTzx9qGasemINlMl+nYh QAwRE507h8hHZXMBgHx64+FOy9L7p9YvObWA+luhtt5+970HrrhClLR5iItxGdm2SG2k gwMA== 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=X7GwyuNqxpuIj9NLpKOaS4Ka3QTY4PmFXqHBt1yJkByv5ZWVUBe3ymlEXG0iniD/zN GTZxdY5czjpafTmiSeWLMrBaMRPwMHZGKzE/k8Z8OUeHNB9bp58FVSTujgzlP6fbt6PT hcbkFQoljiymNFRY3xeAPqZGEKaHe3cvNiicITKHp4EbDS+4geqM6CvDr/S+FvR9AB0R T5S3+C0wwVN42n0ABN0U38nC2O5CYQiFHc47Ha2dUSX3Z3LdM0xXnT6TTHGDEdgnbBm+ Ii1m7l3N/NJDU53IwXZLysUWM+04wVha5p+jEfvHAPQOwcgPTYO4iPn+jD+2m0bSc/9T JQbg== 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 b10si13269475edy.92.2020.08.18.06.16.51; Tue, 18 Aug 2020 06:17:15 -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 S1726953AbgHRNN6 (ORCPT + 99 others); Tue, 18 Aug 2020 09:13:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:33698 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726884AbgHRNNk (ORCPT ); Tue, 18 Aug 2020 09:13:40 -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 811D9B178; Tue, 18 Aug 2020 13:14:04 +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 v7 6/6] libceph: use sendpage_ok() in ceph_tcp_sendpage() Date: Tue, 18 Aug 2020 21:12:27 +0800 Message-Id: <20200818131227.37020-7-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 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