Skip to content

Commit ae0abb4

Browse files
Paulo Alcantarasmfrench
authored andcommitted
cifs: convert list_for_each to entry variant
Convert list_for_each{,_safe} to list_for_each_entry{,_safe} in cifs_mark_tcp_ses_conns_for_reconnect() function. Signed-off-by: Paulo Alcantara (SUSE) <[email protected]> Reviewed-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 43b459a commit ae0abb4

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

fs/cifs/connect.c

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,9 @@ static inline int reconn_setup_dfs_targets(struct cifs_sb_info *cifs_sb,
206206
*/
207207
static void cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server)
208208
{
209-
struct list_head *tmp, *tmp2;
210209
struct cifs_ses *ses;
211210
struct cifs_tcon *tcon;
212-
struct mid_q_entry *mid_entry;
211+
struct mid_q_entry *mid, *nmid;
213212
struct list_head retry_list;
214213

215214
server->maxBuf = 0;
@@ -223,13 +222,10 @@ static void cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server
223222
*/
224223
cifs_dbg(FYI, "%s: marking sessions and tcons for reconnect\n", __func__);
225224
spin_lock(&cifs_tcp_ses_lock);
226-
list_for_each(tmp, &server->smb_ses_list) {
227-
ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
225+
list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
228226
ses->need_reconnect = true;
229-
list_for_each(tmp2, &ses->tcon_list) {
230-
tcon = list_entry(tmp2, struct cifs_tcon, tcon_list);
227+
list_for_each_entry(tcon, &ses->tcon_list, tcon_list)
231228
tcon->need_reconnect = true;
232-
}
233229
if (ses->tcon_ipc)
234230
ses->tcon_ipc->need_reconnect = true;
235231
}
@@ -258,23 +254,21 @@ static void cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server
258254
INIT_LIST_HEAD(&retry_list);
259255
cifs_dbg(FYI, "%s: moving mids to private list\n", __func__);
260256
spin_lock(&GlobalMid_Lock);
261-
list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
262-
mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
263-
kref_get(&mid_entry->refcount);
264-
if (mid_entry->mid_state == MID_REQUEST_SUBMITTED)
265-
mid_entry->mid_state = MID_RETRY_NEEDED;
266-
list_move(&mid_entry->qhead, &retry_list);
267-
mid_entry->mid_flags |= MID_DELETED;
257+
list_for_each_entry_safe(mid, nmid, &server->pending_mid_q, qhead) {
258+
kref_get(&mid->refcount);
259+
if (mid->mid_state == MID_REQUEST_SUBMITTED)
260+
mid->mid_state = MID_RETRY_NEEDED;
261+
list_move(&mid->qhead, &retry_list);
262+
mid->mid_flags |= MID_DELETED;
268263
}
269264
spin_unlock(&GlobalMid_Lock);
270265
mutex_unlock(&server->srv_mutex);
271266

272267
cifs_dbg(FYI, "%s: issuing mid callbacks\n", __func__);
273-
list_for_each_safe(tmp, tmp2, &retry_list) {
274-
mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
275-
list_del_init(&mid_entry->qhead);
276-
mid_entry->callback(mid_entry);
277-
cifs_mid_q_entry_release(mid_entry);
268+
list_for_each_entry_safe(mid, nmid, &retry_list, qhead) {
269+
list_del_init(&mid->qhead);
270+
mid->callback(mid);
271+
cifs_mid_q_entry_release(mid);
278272
}
279273

280274
if (cifs_rdma_enabled(server)) {

0 commit comments

Comments
 (0)