diff options
author | David Howells <dhowells@redhat.com> | 2006-11-22 09:57:56 -0500 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2006-11-22 09:57:56 -0500 |
commit | c4028958b6ecad064b1a6303a6a5906d4fe48d73 (patch) | |
tree | 1c4c89652c62a75da09f9b9442012007e4ac6250 /fs/ocfs2/cluster/tcp.c | |
parent | 65f27f38446e1976cc98fd3004b110fedcddd189 (diff) |
WorkStruct: make allyesconfig
Fix up for make allyesconfig.
Signed-Off-By: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/ocfs2/cluster/tcp.c')
-rw-r--r-- | fs/ocfs2/cluster/tcp.c | 78 |
1 files changed, 44 insertions, 34 deletions
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index b650efa8c8be..9b3209dc0b16 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -140,11 +140,11 @@ static int o2net_sys_err_translations[O2NET_ERR_MAX] = | |||
140 | [O2NET_ERR_DIED] = -EHOSTDOWN,}; | 140 | [O2NET_ERR_DIED] = -EHOSTDOWN,}; |
141 | 141 | ||
142 | /* can't quite avoid *all* internal declarations :/ */ | 142 | /* can't quite avoid *all* internal declarations :/ */ |
143 | static void o2net_sc_connect_completed(void *arg); | 143 | static void o2net_sc_connect_completed(struct work_struct *work); |
144 | static void o2net_rx_until_empty(void *arg); | 144 | static void o2net_rx_until_empty(struct work_struct *work); |
145 | static void o2net_shutdown_sc(void *arg); | 145 | static void o2net_shutdown_sc(struct work_struct *work); |
146 | static void o2net_listen_data_ready(struct sock *sk, int bytes); | 146 | static void o2net_listen_data_ready(struct sock *sk, int bytes); |
147 | static void o2net_sc_send_keep_req(void *arg); | 147 | static void o2net_sc_send_keep_req(struct work_struct *work); |
148 | static void o2net_idle_timer(unsigned long data); | 148 | static void o2net_idle_timer(unsigned long data); |
149 | static void o2net_sc_postpone_idle(struct o2net_sock_container *sc); | 149 | static void o2net_sc_postpone_idle(struct o2net_sock_container *sc); |
150 | 150 | ||
@@ -308,10 +308,10 @@ static struct o2net_sock_container *sc_alloc(struct o2nm_node *node) | |||
308 | o2nm_node_get(node); | 308 | o2nm_node_get(node); |
309 | sc->sc_node = node; | 309 | sc->sc_node = node; |
310 | 310 | ||
311 | INIT_WORK(&sc->sc_connect_work, o2net_sc_connect_completed, sc); | 311 | INIT_WORK(&sc->sc_connect_work, o2net_sc_connect_completed); |
312 | INIT_WORK(&sc->sc_rx_work, o2net_rx_until_empty, sc); | 312 | INIT_WORK(&sc->sc_rx_work, o2net_rx_until_empty); |
313 | INIT_WORK(&sc->sc_shutdown_work, o2net_shutdown_sc, sc); | 313 | INIT_WORK(&sc->sc_shutdown_work, o2net_shutdown_sc); |
314 | INIT_WORK(&sc->sc_keepalive_work, o2net_sc_send_keep_req, sc); | 314 | INIT_DELAYED_WORK(&sc->sc_keepalive_work, o2net_sc_send_keep_req); |
315 | 315 | ||
316 | init_timer(&sc->sc_idle_timeout); | 316 | init_timer(&sc->sc_idle_timeout); |
317 | sc->sc_idle_timeout.function = o2net_idle_timer; | 317 | sc->sc_idle_timeout.function = o2net_idle_timer; |
@@ -342,7 +342,7 @@ static void o2net_sc_queue_work(struct o2net_sock_container *sc, | |||
342 | sc_put(sc); | 342 | sc_put(sc); |
343 | } | 343 | } |
344 | static void o2net_sc_queue_delayed_work(struct o2net_sock_container *sc, | 344 | static void o2net_sc_queue_delayed_work(struct o2net_sock_container *sc, |
345 | struct work_struct *work, | 345 | struct delayed_work *work, |
346 | int delay) | 346 | int delay) |
347 | { | 347 | { |
348 | sc_get(sc); | 348 | sc_get(sc); |
@@ -350,7 +350,7 @@ static void o2net_sc_queue_delayed_work(struct o2net_sock_container *sc, | |||
350 | sc_put(sc); | 350 | sc_put(sc); |
351 | } | 351 | } |
352 | static void o2net_sc_cancel_delayed_work(struct o2net_sock_container *sc, | 352 | static void o2net_sc_cancel_delayed_work(struct o2net_sock_container *sc, |
353 | struct work_struct *work) | 353 | struct delayed_work *work) |
354 | { | 354 | { |
355 | if (cancel_delayed_work(work)) | 355 | if (cancel_delayed_work(work)) |
356 | sc_put(sc); | 356 | sc_put(sc); |
@@ -564,9 +564,11 @@ static void o2net_ensure_shutdown(struct o2net_node *nn, | |||
564 | * ourselves as state_change couldn't get the nn_lock and call set_nn_state | 564 | * ourselves as state_change couldn't get the nn_lock and call set_nn_state |
565 | * itself. | 565 | * itself. |
566 | */ | 566 | */ |
567 | static void o2net_shutdown_sc(void *arg) | 567 | static void o2net_shutdown_sc(struct work_struct *work) |
568 | { | 568 | { |
569 | struct o2net_sock_container *sc = arg; | 569 | struct o2net_sock_container *sc = |
570 | container_of(work, struct o2net_sock_container, | ||
571 | sc_shutdown_work); | ||
570 | struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); | 572 | struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); |
571 | 573 | ||
572 | sclog(sc, "shutting down\n"); | 574 | sclog(sc, "shutting down\n"); |
@@ -1201,9 +1203,10 @@ out: | |||
1201 | /* this work func is triggerd by data ready. it reads until it can read no | 1203 | /* this work func is triggerd by data ready. it reads until it can read no |
1202 | * more. it interprets 0, eof, as fatal. if data_ready hits while we're doing | 1204 | * more. it interprets 0, eof, as fatal. if data_ready hits while we're doing |
1203 | * our work the work struct will be marked and we'll be called again. */ | 1205 | * our work the work struct will be marked and we'll be called again. */ |
1204 | static void o2net_rx_until_empty(void *arg) | 1206 | static void o2net_rx_until_empty(struct work_struct *work) |
1205 | { | 1207 | { |
1206 | struct o2net_sock_container *sc = arg; | 1208 | struct o2net_sock_container *sc = |
1209 | container_of(work, struct o2net_sock_container, sc_rx_work); | ||
1207 | int ret; | 1210 | int ret; |
1208 | 1211 | ||
1209 | do { | 1212 | do { |
@@ -1249,9 +1252,11 @@ static int o2net_set_nodelay(struct socket *sock) | |||
1249 | 1252 | ||
1250 | /* called when a connect completes and after a sock is accepted. the | 1253 | /* called when a connect completes and after a sock is accepted. the |
1251 | * rx path will see the response and mark the sc valid */ | 1254 | * rx path will see the response and mark the sc valid */ |
1252 | static void o2net_sc_connect_completed(void *arg) | 1255 | static void o2net_sc_connect_completed(struct work_struct *work) |
1253 | { | 1256 | { |
1254 | struct o2net_sock_container *sc = arg; | 1257 | struct o2net_sock_container *sc = |
1258 | container_of(work, struct o2net_sock_container, | ||
1259 | sc_connect_work); | ||
1255 | 1260 | ||
1256 | mlog(ML_MSG, "sc sending handshake with ver %llu id %llx\n", | 1261 | mlog(ML_MSG, "sc sending handshake with ver %llu id %llx\n", |
1257 | (unsigned long long)O2NET_PROTOCOL_VERSION, | 1262 | (unsigned long long)O2NET_PROTOCOL_VERSION, |
@@ -1262,9 +1267,11 @@ static void o2net_sc_connect_completed(void *arg) | |||
1262 | } | 1267 | } |
1263 | 1268 | ||
1264 | /* this is called as a work_struct func. */ | 1269 | /* this is called as a work_struct func. */ |
1265 | static void o2net_sc_send_keep_req(void *arg) | 1270 | static void o2net_sc_send_keep_req(struct work_struct *work) |
1266 | { | 1271 | { |
1267 | struct o2net_sock_container *sc = arg; | 1272 | struct o2net_sock_container *sc = |
1273 | container_of(work, struct o2net_sock_container, | ||
1274 | sc_keepalive_work.work); | ||
1268 | 1275 | ||
1269 | o2net_sendpage(sc, o2net_keep_req, sizeof(*o2net_keep_req)); | 1276 | o2net_sendpage(sc, o2net_keep_req, sizeof(*o2net_keep_req)); |
1270 | sc_put(sc); | 1277 | sc_put(sc); |
@@ -1314,14 +1321,15 @@ static void o2net_sc_postpone_idle(struct o2net_sock_container *sc) | |||
1314 | * having a connect attempt fail, etc. This centralizes the logic which decides | 1321 | * having a connect attempt fail, etc. This centralizes the logic which decides |
1315 | * if a connect attempt should be made or if we should give up and all future | 1322 | * if a connect attempt should be made or if we should give up and all future |
1316 | * transmit attempts should fail */ | 1323 | * transmit attempts should fail */ |
1317 | static void o2net_start_connect(void *arg) | 1324 | static void o2net_start_connect(struct work_struct *work) |
1318 | { | 1325 | { |
1319 | struct o2net_node *nn = arg; | 1326 | struct o2net_node *nn = |
1327 | container_of(work, struct o2net_node, nn_connect_work.work); | ||
1320 | struct o2net_sock_container *sc = NULL; | 1328 | struct o2net_sock_container *sc = NULL; |
1321 | struct o2nm_node *node = NULL, *mynode = NULL; | 1329 | struct o2nm_node *node = NULL, *mynode = NULL; |
1322 | struct socket *sock = NULL; | 1330 | struct socket *sock = NULL; |
1323 | struct sockaddr_in myaddr = {0, }, remoteaddr = {0, }; | 1331 | struct sockaddr_in myaddr = {0, }, remoteaddr = {0, }; |
1324 | int ret = 0; | 1332 | int ret = 0, stop; |
1325 | 1333 | ||
1326 | /* if we're greater we initiate tx, otherwise we accept */ | 1334 | /* if we're greater we initiate tx, otherwise we accept */ |
1327 | if (o2nm_this_node() <= o2net_num_from_nn(nn)) | 1335 | if (o2nm_this_node() <= o2net_num_from_nn(nn)) |
@@ -1342,10 +1350,9 @@ static void o2net_start_connect(void *arg) | |||
1342 | 1350 | ||
1343 | spin_lock(&nn->nn_lock); | 1351 | spin_lock(&nn->nn_lock); |
1344 | /* see if we already have one pending or have given up */ | 1352 | /* see if we already have one pending or have given up */ |
1345 | if (nn->nn_sc || nn->nn_persistent_error) | 1353 | stop = (nn->nn_sc || nn->nn_persistent_error); |
1346 | arg = NULL; | ||
1347 | spin_unlock(&nn->nn_lock); | 1354 | spin_unlock(&nn->nn_lock); |
1348 | if (arg == NULL) /* *shrug*, needed some indicator */ | 1355 | if (stop) |
1349 | goto out; | 1356 | goto out; |
1350 | 1357 | ||
1351 | nn->nn_last_connect_attempt = jiffies; | 1358 | nn->nn_last_connect_attempt = jiffies; |
@@ -1421,9 +1428,10 @@ out: | |||
1421 | return; | 1428 | return; |
1422 | } | 1429 | } |
1423 | 1430 | ||
1424 | static void o2net_connect_expired(void *arg) | 1431 | static void o2net_connect_expired(struct work_struct *work) |
1425 | { | 1432 | { |
1426 | struct o2net_node *nn = arg; | 1433 | struct o2net_node *nn = |
1434 | container_of(work, struct o2net_node, nn_connect_expired.work); | ||
1427 | 1435 | ||
1428 | spin_lock(&nn->nn_lock); | 1436 | spin_lock(&nn->nn_lock); |
1429 | if (!nn->nn_sc_valid) { | 1437 | if (!nn->nn_sc_valid) { |
@@ -1436,9 +1444,10 @@ static void o2net_connect_expired(void *arg) | |||
1436 | spin_unlock(&nn->nn_lock); | 1444 | spin_unlock(&nn->nn_lock); |
1437 | } | 1445 | } |
1438 | 1446 | ||
1439 | static void o2net_still_up(void *arg) | 1447 | static void o2net_still_up(struct work_struct *work) |
1440 | { | 1448 | { |
1441 | struct o2net_node *nn = arg; | 1449 | struct o2net_node *nn = |
1450 | container_of(work, struct o2net_node, nn_still_up.work); | ||
1442 | 1451 | ||
1443 | o2quo_hb_still_up(o2net_num_from_nn(nn)); | 1452 | o2quo_hb_still_up(o2net_num_from_nn(nn)); |
1444 | } | 1453 | } |
@@ -1644,9 +1653,9 @@ out: | |||
1644 | return ret; | 1653 | return ret; |
1645 | } | 1654 | } |
1646 | 1655 | ||
1647 | static void o2net_accept_many(void *arg) | 1656 | static void o2net_accept_many(struct work_struct *work) |
1648 | { | 1657 | { |
1649 | struct socket *sock = arg; | 1658 | struct socket *sock = o2net_listen_sock; |
1650 | while (o2net_accept_one(sock) == 0) | 1659 | while (o2net_accept_one(sock) == 0) |
1651 | cond_resched(); | 1660 | cond_resched(); |
1652 | } | 1661 | } |
@@ -1700,7 +1709,7 @@ static int o2net_open_listening_sock(__be16 port) | |||
1700 | write_unlock_bh(&sock->sk->sk_callback_lock); | 1709 | write_unlock_bh(&sock->sk->sk_callback_lock); |
1701 | 1710 | ||
1702 | o2net_listen_sock = sock; | 1711 | o2net_listen_sock = sock; |
1703 | INIT_WORK(&o2net_listen_work, o2net_accept_many, sock); | 1712 | INIT_WORK(&o2net_listen_work, o2net_accept_many); |
1704 | 1713 | ||
1705 | sock->sk->sk_reuse = 1; | 1714 | sock->sk->sk_reuse = 1; |
1706 | ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin)); | 1715 | ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin)); |
@@ -1819,9 +1828,10 @@ int o2net_init(void) | |||
1819 | struct o2net_node *nn = o2net_nn_from_num(i); | 1828 | struct o2net_node *nn = o2net_nn_from_num(i); |
1820 | 1829 | ||
1821 | spin_lock_init(&nn->nn_lock); | 1830 | spin_lock_init(&nn->nn_lock); |
1822 | INIT_WORK(&nn->nn_connect_work, o2net_start_connect, nn); | 1831 | INIT_DELAYED_WORK(&nn->nn_connect_work, o2net_start_connect); |
1823 | INIT_WORK(&nn->nn_connect_expired, o2net_connect_expired, nn); | 1832 | INIT_DELAYED_WORK(&nn->nn_connect_expired, |
1824 | INIT_WORK(&nn->nn_still_up, o2net_still_up, nn); | 1833 | o2net_connect_expired); |
1834 | INIT_DELAYED_WORK(&nn->nn_still_up, o2net_still_up); | ||
1825 | /* until we see hb from a node we'll return einval */ | 1835 | /* until we see hb from a node we'll return einval */ |
1826 | nn->nn_persistent_error = -ENOTCONN; | 1836 | nn->nn_persistent_error = -ENOTCONN; |
1827 | init_waitqueue_head(&nn->nn_sc_wq); | 1837 | init_waitqueue_head(&nn->nn_sc_wq); |