diff options
author | Bob Peterson <rpeterso@redhat.com> | 2017-09-12 04:55:14 -0400 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2017-09-25 13:45:21 -0400 |
commit | 01da24d3fbed92dc6faf60b753e6bd50cdafb646 (patch) | |
tree | d6bdb6f014aa1d293c163f166a84efa20d63b5c3 /fs/dlm | |
parent | 61d9102b62129e13a2258c1e0566962f9a1732f0 (diff) |
DLM: Eliminate CF_WRITE_PENDING flag
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Reviewed-by: Tadashi Miyauchi <miyauchi@toshiba-tops.co.jp>
Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm')
-rw-r--r-- | fs/dlm/lowcomms.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 6a7a49b93374..ed707d4323f4 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
@@ -106,7 +106,6 @@ struct connection { | |||
106 | struct mutex sock_mutex; | 106 | struct mutex sock_mutex; |
107 | unsigned long flags; | 107 | unsigned long flags; |
108 | #define CF_READ_PENDING 1 | 108 | #define CF_READ_PENDING 1 |
109 | #define CF_WRITE_PENDING 2 | ||
110 | #define CF_INIT_PENDING 4 | 109 | #define CF_INIT_PENDING 4 |
111 | #define CF_IS_OTHERCON 5 | 110 | #define CF_IS_OTHERCON 5 |
112 | #define CF_CLOSE 6 | 111 | #define CF_CLOSE 6 |
@@ -426,8 +425,7 @@ static void lowcomms_write_space(struct sock *sk) | |||
426 | clear_bit(SOCKWQ_ASYNC_NOSPACE, &con->sock->flags); | 425 | clear_bit(SOCKWQ_ASYNC_NOSPACE, &con->sock->flags); |
427 | } | 426 | } |
428 | 427 | ||
429 | if (!test_and_set_bit(CF_WRITE_PENDING, &con->flags)) | 428 | queue_work(send_workqueue, &con->swork); |
430 | queue_work(send_workqueue, &con->swork); | ||
431 | } | 429 | } |
432 | 430 | ||
433 | static inline void lowcomms_connect_sock(struct connection *con) | 431 | static inline void lowcomms_connect_sock(struct connection *con) |
@@ -578,7 +576,6 @@ static void make_sockaddr(struct sockaddr_storage *saddr, uint16_t port, | |||
578 | static void close_connection(struct connection *con, bool and_other, | 576 | static void close_connection(struct connection *con, bool and_other, |
579 | bool tx, bool rx) | 577 | bool tx, bool rx) |
580 | { | 578 | { |
581 | clear_bit(CF_WRITE_PENDING, &con->flags); | ||
582 | if (tx && cancel_work_sync(&con->swork)) | 579 | if (tx && cancel_work_sync(&con->swork)) |
583 | log_print("canceled swork for node %d", con->nodeid); | 580 | log_print("canceled swork for node %d", con->nodeid); |
584 | if (rx && cancel_work_sync(&con->rwork)) | 581 | if (rx && cancel_work_sync(&con->rwork)) |
@@ -1077,7 +1074,6 @@ static void sctp_connect_to_sock(struct connection *con) | |||
1077 | if (result == 0) | 1074 | if (result == 0) |
1078 | goto out; | 1075 | goto out; |
1079 | 1076 | ||
1080 | |||
1081 | bind_err: | 1077 | bind_err: |
1082 | con->sock = NULL; | 1078 | con->sock = NULL; |
1083 | sock_release(sock); | 1079 | sock_release(sock); |
@@ -1102,7 +1098,6 @@ socket_err: | |||
1102 | 1098 | ||
1103 | out: | 1099 | out: |
1104 | mutex_unlock(&con->sock_mutex); | 1100 | mutex_unlock(&con->sock_mutex); |
1105 | set_bit(CF_WRITE_PENDING, &con->flags); | ||
1106 | } | 1101 | } |
1107 | 1102 | ||
1108 | /* Connect a new socket to its peer */ | 1103 | /* Connect a new socket to its peer */ |
@@ -1196,7 +1191,6 @@ out_err: | |||
1196 | } | 1191 | } |
1197 | out: | 1192 | out: |
1198 | mutex_unlock(&con->sock_mutex); | 1193 | mutex_unlock(&con->sock_mutex); |
1199 | set_bit(CF_WRITE_PENDING, &con->flags); | ||
1200 | return; | 1194 | return; |
1201 | } | 1195 | } |
1202 | 1196 | ||
@@ -1452,9 +1446,7 @@ void dlm_lowcomms_commit_buffer(void *mh) | |||
1452 | e->len = e->end - e->offset; | 1446 | e->len = e->end - e->offset; |
1453 | spin_unlock(&con->writequeue_lock); | 1447 | spin_unlock(&con->writequeue_lock); |
1454 | 1448 | ||
1455 | if (!test_and_set_bit(CF_WRITE_PENDING, &con->flags)) { | 1449 | queue_work(send_workqueue, &con->swork); |
1456 | queue_work(send_workqueue, &con->swork); | ||
1457 | } | ||
1458 | return; | 1450 | return; |
1459 | 1451 | ||
1460 | out: | 1452 | out: |
@@ -1524,12 +1516,15 @@ out: | |||
1524 | send_error: | 1516 | send_error: |
1525 | mutex_unlock(&con->sock_mutex); | 1517 | mutex_unlock(&con->sock_mutex); |
1526 | close_connection(con, false, false, true); | 1518 | close_connection(con, false, false, true); |
1527 | lowcomms_connect_sock(con); | 1519 | /* Requeue the send work. When the work daemon runs again, it will try |
1520 | a new connection, then call this function again. */ | ||
1521 | queue_work(send_workqueue, &con->swork); | ||
1528 | return; | 1522 | return; |
1529 | 1523 | ||
1530 | out_connect: | 1524 | out_connect: |
1531 | mutex_unlock(&con->sock_mutex); | 1525 | mutex_unlock(&con->sock_mutex); |
1532 | lowcomms_connect_sock(con); | 1526 | queue_work(send_workqueue, &con->swork); |
1527 | cond_resched(); | ||
1533 | } | 1528 | } |
1534 | 1529 | ||
1535 | static void clean_one_writequeue(struct connection *con) | 1530 | static void clean_one_writequeue(struct connection *con) |
@@ -1591,7 +1586,7 @@ static void process_send_sockets(struct work_struct *work) | |||
1591 | 1586 | ||
1592 | if (con->sock == NULL) /* not mutex protected so check it inside too */ | 1587 | if (con->sock == NULL) /* not mutex protected so check it inside too */ |
1593 | con->connect_action(con); | 1588 | con->connect_action(con); |
1594 | if (test_and_clear_bit(CF_WRITE_PENDING, &con->flags)) | 1589 | if (!list_empty(&con->writequeue)) |
1595 | send_to_sock(con); | 1590 | send_to_sock(con); |
1596 | } | 1591 | } |
1597 | 1592 | ||