From fb4a1539948678b581bf12356f13e616397a458e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 12 Jul 2014 00:01:03 -0700 Subject: [PATCH] staging: lustre: remove linux-tcpip.h There were just a few macros being used, remove them and have the places where they were being used to make the proper kernel api call instead. Cc: Andreas Dilger Cc: Oleg Drokin Cc: hpdd-discuss Signed-off-by: Greg Kroah-Hartman --- .../include/linux/libcfs/linux/libcfs.h | 2 +- .../include/linux/libcfs/linux/linux-tcpip.h | 66 ------------------- .../lustre/lnet/klnds/socklnd/socklnd.c | 4 +- .../lustre/lnet/klnds/socklnd/socklnd_cb.c | 12 ++-- .../lnet/klnds/socklnd/socklnd_lib-linux.c | 2 +- .../lustre/lustre/libcfs/linux/linux-tcpip.c | 6 +- 6 files changed, 13 insertions(+), 79 deletions(-) delete mode 100644 drivers/staging/lustre/include/linux/libcfs/linux/linux-tcpip.h diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h index c4343fa890e..1c06bf1dc3d 100644 --- a/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h @@ -45,12 +45,12 @@ #include #include #include +#include #include #include "linux-cpu.h" #include "linux-time.h" #include "linux-mem.h" #include "linux-prim.h" -#include "linux-tcpip.h" #include "kp30.h" #include diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/linux-tcpip.h b/drivers/staging/lustre/include/linux/libcfs/linux/linux-tcpip.h deleted file mode 100644 index 441537abec4..00000000000 --- a/drivers/staging/lustre/include/linux/libcfs/linux/linux-tcpip.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - * - * Copyright (c) 2012, Intel Corporation. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - * - * libcfs/include/libcfs/linux/linux-tcpip.h - * - * Basic library routines. - */ - -#ifndef __LIBCFS_LINUX_CFS_TCP_H__ -#define __LIBCFS_LINUX_CFS_TCP_H__ - -#ifndef __LIBCFS_LIBCFS_H__ -#error Do not #include this file directly. #include instead -#endif - -#include - -#define SOCK_TEST_NOSPACE(so) test_bit(SOCK_NOSPACE, &(so)->flags) - -static inline int -cfs_sock_error(struct socket *sock) -{ - return sock->sk->sk_err; -} - -static inline int -cfs_sock_wmem_queued(struct socket *sock) -{ - return sock->sk->sk_wmem_queued; -} - -#define cfs_sk_sleep(sk) sk_sleep(sk) - -#endif diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 237394ca4ed..1590957711a 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -1258,7 +1258,7 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, conn->ksnc_tx_last_post = cfs_time_current(); /* Set the deadline for the outgoing HELLO to drain */ - conn->ksnc_tx_bufnob = cfs_sock_wmem_queued(sock); + conn->ksnc_tx_bufnob = sock->sk->sk_wmem_queued; conn->ksnc_tx_deadline = cfs_time_shift(*ksocknal_tunables.ksnd_timeout); mb(); /* order with adding to peer's conn list */ @@ -1808,7 +1808,7 @@ ksocknal_query (lnet_ni_t *ni, lnet_nid_t nid, cfs_time_t *when) list_for_each (tmp, &peer->ksnp_conns) { conn = list_entry(tmp, ksock_conn_t, ksnc_list); - bufnob = cfs_sock_wmem_queued(conn->ksnc_sock); + bufnob = conn->ksnc_sock->sk->sk_wmem_queued; if (bufnob < conn->ksnc_tx_bufnob) { /* something got ACKed */ diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index 3d0e59dd054..0a82645e685 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -212,7 +212,7 @@ ksocknal_transmit (ksock_conn_t *conn, ksock_tx_t *tx) rc = ksocknal_send_kiov (conn, tx); } - bufnob = cfs_sock_wmem_queued(conn->ksnc_sock); + bufnob = conn->ksnc_sock->sk->sk_wmem_queued; if (rc > 0) /* sent something? */ conn->ksnc_tx_bufnob += rc; /* account it */ @@ -630,7 +630,7 @@ ksocknal_find_conn_locked(ksock_peer_t *peer, ksock_tx_t *tx, int nonblk) list_for_each (tmp, &peer->ksnp_conns) { ksock_conn_t *c = list_entry(tmp, ksock_conn_t, ksnc_list); int nob = atomic_read(&c->ksnc_tx_nob) + - cfs_sock_wmem_queued(c->ksnc_sock); + c->ksnc_sock->sk->sk_wmem_queued; int rc; LASSERT (!c->ksnc_closing); @@ -726,7 +726,7 @@ ksocknal_queue_tx_locked (ksock_tx_t *tx, ksock_conn_t *conn) * FIXME: SOCK_WMEM_QUEUED and SOCK_ERROR could block in __DARWIN8__ * but they're used inside spinlocks a lot. */ - bufnob = cfs_sock_wmem_queued(conn->ksnc_sock); + bufnob = conn->ksnc_sock->sk->sk_wmem_queued; spin_lock_bh(&sched->kss_lock); if (list_empty(&conn->ksnc_tx_queue) && bufnob == 0) { @@ -2260,7 +2260,7 @@ ksocknal_find_timed_out_conn (ksock_peer_t *peer) /* SOCK_ERROR will reset error code of socket in * some platform (like Darwin8.x) */ - error = cfs_sock_error(conn->ksnc_sock); + error = conn->ksnc_sock->sk->sk_err; if (error != 0) { ksocknal_conn_addref(conn); @@ -2311,7 +2311,7 @@ ksocknal_find_timed_out_conn (ksock_peer_t *peer) } if ((!list_empty(&conn->ksnc_tx_queue) || - cfs_sock_wmem_queued(conn->ksnc_sock) != 0) && + conn->ksnc_sock->sk->sk_wmem_queued != 0) && cfs_time_aftereq(cfs_time_current(), conn->ksnc_tx_deadline)) { /* Timed out messages queued for sending or @@ -2508,7 +2508,7 @@ ksocknal_check_peer_timeouts (int idx) "resid: %d, wmem: %d\n", n, libcfs_nid2str(peer->ksnp_id.nid), tx, cfs_duration_sec(cfs_time_current() - deadline), - resid, cfs_sock_wmem_queued(conn->ksnc_sock)); + resid, conn->ksnc_sock->sk->sk_wmem_queued); ksocknal_close_conn_and_siblings (conn, -ETIMEDOUT); ksocknal_conn_decref(conn); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c index d18bab19cd9..245c9d7560a 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c @@ -695,7 +695,7 @@ ksocknal_lib_memory_pressure(ksock_conn_t *conn) sched = conn->ksnc_scheduler; spin_lock_bh(&sched->kss_lock); - if (!SOCK_TEST_NOSPACE(conn->ksnc_sock) && + if (!test_bit(SOCK_NOSPACE, &conn->ksnc_sock->flags) && !conn->ksnc_tx_ready) { /* SOCK_NOSPACE is set when the socket fills * and cleared in the write_space callback diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c index eb14dfd4b0f..a93b6210705 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c @@ -545,7 +545,7 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock) newsock->ops = sock->ops; set_current_state(TASK_INTERRUPTIBLE); - add_wait_queue(cfs_sk_sleep(sock->sk), &wait); + add_wait_queue(sk_sleep(sock->sk), &wait); rc = sock->ops->accept(sock, newsock, O_NONBLOCK); if (rc == -EAGAIN) { @@ -554,7 +554,7 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock) rc = sock->ops->accept(sock, newsock, O_NONBLOCK); } - remove_wait_queue(cfs_sk_sleep(sock->sk), &wait); + remove_wait_queue(sk_sleep(sock->sk), &wait); set_current_state(TASK_RUNNING); if (rc != 0) @@ -573,7 +573,7 @@ EXPORT_SYMBOL(libcfs_sock_accept); void libcfs_sock_abort_accept (struct socket *sock) { - wake_up_all(cfs_sk_sleep(sock->sk)); + wake_up_all(sk_sleep(sock->sk)); } EXPORT_SYMBOL(libcfs_sock_abort_accept); -- 2.46.0