Commit 40efc4dc authored by Coly Li's avatar Coly Li Committed by David S. Miller

libceph: use sendpage_ok() in ceph_tcp_sendpage()

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: default avatarColy Li <colyli@suse.de>
Acked-by: default avatarJeff Layton <jlayton@kernel.org>
Cc: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6aa25c73
...@@ -575,7 +575,7 @@ static int ceph_tcp_sendpage(struct socket *sock, struct page *page, ...@@ -575,7 +575,7 @@ static int ceph_tcp_sendpage(struct socket *sock, struct page *page,
* coalescing neighboring slab objects into a single frag which * coalescing neighboring slab objects into a single frag which
* triggers one of hardened usercopy checks. * triggers one of hardened usercopy checks.
*/ */
if (page_count(page) >= 1 && !PageSlab(page)) if (sendpage_ok(page))
sendpage = sock->ops->sendpage; sendpage = sock->ops->sendpage;
else else
sendpage = sock_no_sendpage; sendpage = sock_no_sendpage;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment