[lustre-devel] [PATCH 10/49] lnet: socklnd: change various ints to bool.
James Simmons
jsimmons at infradead.org
Wed Apr 14 21:02:02 PDT 2021
From: Mr NeilBrown <neilb at suse.de>
Each of these int variables, and one int function, are
really truth values, so change to bool.
WC-bug-id: https://jira.whamcloud.com/browse/LU-12678
Lustre-commit: a3275d1d79df5ab5 ("LU-12678 socklnd: change various ints to bool.")
Signed-off-by: Mr NeilBrown <neilb at suse.de>
Reviewed-on: https://review.whamcloud.com/39302
Reviewed-by: James Simmons <jsimmons at infradead.org>
Reviewed-by: Chris Horn <chris.horn at hpe.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
net/lnet/klnds/socklnd/socklnd.c | 13 ++++++-------
net/lnet/klnds/socklnd/socklnd_cb.c | 22 +++++++++++-----------
2 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/net/lnet/klnds/socklnd/socklnd.c b/net/lnet/klnds/socklnd/socklnd.c
index a7c0b65..589a835 100644
--- a/net/lnet/klnds/socklnd/socklnd.c
+++ b/net/lnet/klnds/socklnd/socklnd.c
@@ -1533,7 +1533,7 @@ struct ksock_peer_ni *
void
ksocknal_peer_failed(struct ksock_peer_ni *peer_ni)
{
- int notify = 0;
+ bool notify = false;
time64_t last_alive = 0;
/*
@@ -1547,7 +1547,7 @@ struct ksock_peer_ni *
list_empty(&peer_ni->ksnp_conns) &&
!peer_ni->ksnp_accepting &&
!ksocknal_find_connecting_route_locked(peer_ni)) {
- notify = 1;
+ notify = true;
last_alive = peer_ni->ksnp_last_alive;
}
@@ -1598,15 +1598,14 @@ struct ksock_peer_ni *
void
ksocknal_terminate_conn(struct ksock_conn *conn)
{
- /*
- * This gets called by the reaper (guaranteed thread context) to
+ /* This gets called by the reaper (guaranteed thread context) to
* disengage the socket from its callbacks and close it.
* ksnc_refcount will eventually hit zero, and then the reaper will
* destroy it.
*/
struct ksock_peer_ni *peer_ni = conn->ksnc_peer;
struct ksock_sched *sched = conn->ksnc_scheduler;
- int failed = 0;
+ bool failed = false;
LASSERT(conn->ksnc_closing);
@@ -1643,7 +1642,7 @@ struct ksock_peer_ni *
if (peer_ni->ksnp_error) {
/* peer_ni's last conn closed in error */
LASSERT(list_empty(&peer_ni->ksnp_conns));
- failed = 1;
+ failed = true;
peer_ni->ksnp_error = 0; /* avoid multiple notifications */
}
@@ -2493,7 +2492,7 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id)
for (i = 0; i < net->ksnn_ninterfaces; i++) {
char *ifnam = &net->ksnn_interfaces[i].ksni_name[0];
char *colon = strchr(ifnam, ':');
- int found = 0;
+ bool found = false;
struct ksock_net *tmp;
int j;
diff --git a/net/lnet/klnds/socklnd/socklnd_cb.c b/net/lnet/klnds/socklnd/socklnd_cb.c
index 7fa2d58..b1146dc 100644
--- a/net/lnet/klnds/socklnd/socklnd_cb.c
+++ b/net/lnet/klnds/socklnd/socklnd_cb.c
@@ -1337,7 +1337,7 @@ int ksocknal_scheduler(void *arg)
spin_lock_bh(&sched->kss_lock);
while (!ksocknal_data.ksnd_shuttingdown) {
- int did_something = 0;
+ bool did_something = false;
/* Ensure I progress everything semi-fairly */
@@ -1387,7 +1387,7 @@ int ksocknal_scheduler(void *arg)
ksocknal_conn_decref(conn);
}
- did_something = 1;
+ did_something = true;
}
if (!list_empty(&sched->kss_tx_conns)) {
@@ -1463,7 +1463,7 @@ int ksocknal_scheduler(void *arg)
ksocknal_conn_decref(conn);
}
- did_something = 1;
+ did_something = true;
}
if (!did_something || /* nothing to do */
need_resched()) { /* hogging CPU? */
@@ -1767,7 +1767,7 @@ void ksocknal_write_callback(struct ksock_conn *conn)
return 0;
}
-static int
+static bool
ksocknal_connect(struct ksock_route *route)
{
LIST_HEAD(zombies);
@@ -1776,7 +1776,7 @@ void ksocknal_write_callback(struct ksock_conn *conn)
int wanted;
struct socket *sock;
time64_t deadline;
- int retry_later = 0;
+ bool retry_later = 0;
int rc = 0;
deadline = ktime_get_seconds() + ksocknal_timeout();
@@ -1797,7 +1797,7 @@ void ksocknal_write_callback(struct ksock_conn *conn)
*/
if (peer_ni->ksnp_closing || route->ksnr_deleted ||
!wanted) {
- retry_later = 0;
+ retry_later = false;
break;
}
@@ -1807,7 +1807,7 @@ void ksocknal_write_callback(struct ksock_conn *conn)
"peer_ni %s(%d) already connecting to me, retry later.\n",
libcfs_nid2str(peer_ni->ksnp_id.nid),
peer_ni->ksnp_accepting);
- retry_later = 1;
+ retry_later = true;
}
if (retry_later) /* needs reschedule */
@@ -2087,7 +2087,7 @@ void ksocknal_write_callback(struct ksock_conn *conn)
struct ksock_route *route = NULL;
time64_t sec = ktime_get_real_seconds();
long timeout = MAX_SCHEDULE_TIMEOUT;
- int dropped_lock = 0;
+ bool dropped_lock = false;
if (ksocknal_connd_check_stop(sec, &timeout)) {
/* wakeup another one to check stop */
@@ -2097,7 +2097,7 @@ void ksocknal_write_callback(struct ksock_conn *conn)
if (ksocknal_connd_check_start(sec, &timeout)) {
/* created new thread */
- dropped_lock = 1;
+ dropped_lock = true;
}
cr = list_first_entry_or_null(&ksocknal_data.ksnd_connd_connreqs,
@@ -2107,7 +2107,7 @@ void ksocknal_write_callback(struct ksock_conn *conn)
list_del(&cr->ksncr_list);
spin_unlock_bh(connd_lock);
- dropped_lock = 1;
+ dropped_lock = true;
ksocknal_create_conn(cr->ksncr_ni, NULL,
cr->ksncr_sock, SOCKLND_CONN_NONE);
@@ -2130,7 +2130,7 @@ void ksocknal_write_callback(struct ksock_conn *conn)
list_del(&route->ksnr_connd_list);
ksocknal_data.ksnd_connd_connecting++;
spin_unlock_bh(connd_lock);
- dropped_lock = 1;
+ dropped_lock = true;
if (ksocknal_connect(route)) {
/* consecutive retry */
--
1.8.3.1
More information about the lustre-devel
mailing list