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>
This commit is contained in:
committed by
David Teigland
parent
61d9102b62
commit
01da24d3fb
@@ -106,7 +106,6 @@ struct connection {
|
|||||||
struct mutex sock_mutex;
|
struct mutex sock_mutex;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
#define CF_READ_PENDING 1
|
#define CF_READ_PENDING 1
|
||||||
#define CF_WRITE_PENDING 2
|
|
||||||
#define CF_INIT_PENDING 4
|
#define CF_INIT_PENDING 4
|
||||||
#define CF_IS_OTHERCON 5
|
#define CF_IS_OTHERCON 5
|
||||||
#define CF_CLOSE 6
|
#define CF_CLOSE 6
|
||||||
@@ -426,8 +425,7 @@ static void lowcomms_write_space(struct sock *sk)
|
|||||||
clear_bit(SOCKWQ_ASYNC_NOSPACE, &con->sock->flags);
|
clear_bit(SOCKWQ_ASYNC_NOSPACE, &con->sock->flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!test_and_set_bit(CF_WRITE_PENDING, &con->flags))
|
queue_work(send_workqueue, &con->swork);
|
||||||
queue_work(send_workqueue, &con->swork);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void lowcomms_connect_sock(struct connection *con)
|
static inline void lowcomms_connect_sock(struct connection *con)
|
||||||
@@ -578,7 +576,6 @@ static void make_sockaddr(struct sockaddr_storage *saddr, uint16_t port,
|
|||||||
static void close_connection(struct connection *con, bool and_other,
|
static void close_connection(struct connection *con, bool and_other,
|
||||||
bool tx, bool rx)
|
bool tx, bool rx)
|
||||||
{
|
{
|
||||||
clear_bit(CF_WRITE_PENDING, &con->flags);
|
|
||||||
if (tx && cancel_work_sync(&con->swork))
|
if (tx && cancel_work_sync(&con->swork))
|
||||||
log_print("canceled swork for node %d", con->nodeid);
|
log_print("canceled swork for node %d", con->nodeid);
|
||||||
if (rx && cancel_work_sync(&con->rwork))
|
if (rx && cancel_work_sync(&con->rwork))
|
||||||
@@ -1077,7 +1074,6 @@ static void sctp_connect_to_sock(struct connection *con)
|
|||||||
if (result == 0)
|
if (result == 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
|
||||||
bind_err:
|
bind_err:
|
||||||
con->sock = NULL;
|
con->sock = NULL;
|
||||||
sock_release(sock);
|
sock_release(sock);
|
||||||
@@ -1102,7 +1098,6 @@ socket_err:
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&con->sock_mutex);
|
mutex_unlock(&con->sock_mutex);
|
||||||
set_bit(CF_WRITE_PENDING, &con->flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Connect a new socket to its peer */
|
/* Connect a new socket to its peer */
|
||||||
@@ -1196,7 +1191,6 @@ out_err:
|
|||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&con->sock_mutex);
|
mutex_unlock(&con->sock_mutex);
|
||||||
set_bit(CF_WRITE_PENDING, &con->flags);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1452,9 +1446,7 @@ void dlm_lowcomms_commit_buffer(void *mh)
|
|||||||
e->len = e->end - e->offset;
|
e->len = e->end - e->offset;
|
||||||
spin_unlock(&con->writequeue_lock);
|
spin_unlock(&con->writequeue_lock);
|
||||||
|
|
||||||
if (!test_and_set_bit(CF_WRITE_PENDING, &con->flags)) {
|
queue_work(send_workqueue, &con->swork);
|
||||||
queue_work(send_workqueue, &con->swork);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
@@ -1524,12 +1516,15 @@ out:
|
|||||||
send_error:
|
send_error:
|
||||||
mutex_unlock(&con->sock_mutex);
|
mutex_unlock(&con->sock_mutex);
|
||||||
close_connection(con, false, false, true);
|
close_connection(con, false, false, true);
|
||||||
lowcomms_connect_sock(con);
|
/* Requeue the send work. When the work daemon runs again, it will try
|
||||||
|
a new connection, then call this function again. */
|
||||||
|
queue_work(send_workqueue, &con->swork);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
out_connect:
|
out_connect:
|
||||||
mutex_unlock(&con->sock_mutex);
|
mutex_unlock(&con->sock_mutex);
|
||||||
lowcomms_connect_sock(con);
|
queue_work(send_workqueue, &con->swork);
|
||||||
|
cond_resched();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clean_one_writequeue(struct connection *con)
|
static void clean_one_writequeue(struct connection *con)
|
||||||
@@ -1591,7 +1586,7 @@ static void process_send_sockets(struct work_struct *work)
|
|||||||
|
|
||||||
if (con->sock == NULL) /* not mutex protected so check it inside too */
|
if (con->sock == NULL) /* not mutex protected so check it inside too */
|
||||||
con->connect_action(con);
|
con->connect_action(con);
|
||||||
if (test_and_clear_bit(CF_WRITE_PENDING, &con->flags))
|
if (!list_empty(&con->writequeue))
|
||||||
send_to_sock(con);
|
send_to_sock(con);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user