[lustre-devel] [PATCH 13/22] Revert "staging: lustre: lnet: Use list_for_each_entry_safe"

NeilBrown neilb at suse.com
Sun Jul 29 20:37:41 PDT 2018


This reverts commit 0daec763260e4f0d8038512b72971ddbcf1c63a1.

These loops really want to remove everything, and using a
  while(!list_empty())
loop makes this more obvious.

Signed-off-by: NeilBrown <neilb at suse.com>
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
index 3f69618ad85b..d531847305e4 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
@@ -2260,12 +2260,13 @@ static inline void
 ksocknal_flush_stale_txs(struct ksock_peer *peer)
 {
 	struct ksock_tx *tx;
-	struct ksock_tx *tmp;
 	LIST_HEAD(stale_txs);
 
 	write_lock_bh(&ksocknal_data.ksnd_global_lock);
 
-	list_for_each_entry_safe(tx, tmp, &peer->ksnp_tx_queue, tx_list) {
+	while (!list_empty(&peer->ksnp_tx_queue)) {
+		tx = list_entry(peer->ksnp_tx_queue.next, struct ksock_tx, tx_list);
+
 		if (ktime_get_seconds() < tx->tx_deadline)
 			break;
 




More information about the lustre-devel mailing list