cifs: list_for_each() -> list_for_each_entry()
Replace list_for_each() by list_for_each_entr() where appropriate. Remove no longer used list_head stack variables. Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
ec88cc57c3
commit
9543c8ab30
|
@ -168,7 +168,6 @@ cifs_dump_iface(struct seq_file *m, struct cifs_server_iface *iface)
|
||||||
|
|
||||||
static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
|
static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
|
||||||
{
|
{
|
||||||
struct list_head *tmp, *tmp1, *tmp2;
|
|
||||||
struct TCP_Server_Info *server;
|
struct TCP_Server_Info *server;
|
||||||
struct cifs_ses *ses;
|
struct cifs_ses *ses;
|
||||||
struct cifs_tcon *tcon;
|
struct cifs_tcon *tcon;
|
||||||
|
@ -184,14 +183,10 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
|
||||||
#endif /* CIFS_DEBUG2 */
|
#endif /* CIFS_DEBUG2 */
|
||||||
spin_lock(&cifs_tcp_ses_lock);
|
spin_lock(&cifs_tcp_ses_lock);
|
||||||
list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
|
list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
|
||||||
list_for_each(tmp, &server->smb_ses_list) {
|
list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
|
||||||
ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
|
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
|
||||||
list_for_each(tmp1, &ses->tcon_list) {
|
|
||||||
tcon = list_entry(tmp1, struct cifs_tcon, tcon_list);
|
|
||||||
spin_lock(&tcon->open_file_lock);
|
spin_lock(&tcon->open_file_lock);
|
||||||
list_for_each(tmp2, &tcon->openFileList) {
|
list_for_each_entry(cfile, &tcon->openFileList, tlist) {
|
||||||
cfile = list_entry(tmp2, struct cifsFileInfo,
|
|
||||||
tlist);
|
|
||||||
seq_printf(m,
|
seq_printf(m,
|
||||||
"0x%x 0x%llx 0x%x %d %d %d %pd",
|
"0x%x 0x%llx 0x%x %d %d %d %pd",
|
||||||
tcon->tid,
|
tcon->tid,
|
||||||
|
@ -218,7 +213,6 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
|
static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
|
||||||
{
|
{
|
||||||
struct list_head *tmp2, *tmp3;
|
|
||||||
struct mid_q_entry *mid_entry;
|
struct mid_q_entry *mid_entry;
|
||||||
struct TCP_Server_Info *server;
|
struct TCP_Server_Info *server;
|
||||||
struct cifs_ses *ses;
|
struct cifs_ses *ses;
|
||||||
|
@ -381,9 +375,7 @@ skip_rdma:
|
||||||
|
|
||||||
seq_printf(m, "\n\n\tSessions: ");
|
seq_printf(m, "\n\n\tSessions: ");
|
||||||
i = 0;
|
i = 0;
|
||||||
list_for_each(tmp2, &server->smb_ses_list) {
|
list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
|
||||||
ses = list_entry(tmp2, struct cifs_ses,
|
|
||||||
smb_ses_list);
|
|
||||||
i++;
|
i++;
|
||||||
if ((ses->serverDomain == NULL) ||
|
if ((ses->serverDomain == NULL) ||
|
||||||
(ses->serverOS == NULL) ||
|
(ses->serverOS == NULL) ||
|
||||||
|
@ -447,9 +439,7 @@ skip_rdma:
|
||||||
else
|
else
|
||||||
seq_puts(m, "none\n");
|
seq_puts(m, "none\n");
|
||||||
|
|
||||||
list_for_each(tmp3, &ses->tcon_list) {
|
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
|
||||||
tcon = list_entry(tmp3, struct cifs_tcon,
|
|
||||||
tcon_list);
|
|
||||||
++j;
|
++j;
|
||||||
seq_printf(m, "\n\t%d) ", j);
|
seq_printf(m, "\n\t%d) ", j);
|
||||||
cifs_debug_tcon(m, tcon);
|
cifs_debug_tcon(m, tcon);
|
||||||
|
@ -474,9 +464,7 @@ skip_rdma:
|
||||||
|
|
||||||
seq_puts(m, "\n\n\tMIDs: ");
|
seq_puts(m, "\n\n\tMIDs: ");
|
||||||
spin_lock(&GlobalMid_Lock);
|
spin_lock(&GlobalMid_Lock);
|
||||||
list_for_each(tmp3, &server->pending_mid_q) {
|
list_for_each_entry(mid_entry, &server->pending_mid_q, qhead) {
|
||||||
mid_entry = list_entry(tmp3, struct mid_q_entry,
|
|
||||||
qhead);
|
|
||||||
seq_printf(m, "\n\tState: %d com: %d pid:"
|
seq_printf(m, "\n\tState: %d com: %d pid:"
|
||||||
" %d cbdata: %p mid %llu\n",
|
" %d cbdata: %p mid %llu\n",
|
||||||
mid_entry->mid_state,
|
mid_entry->mid_state,
|
||||||
|
@ -504,7 +492,6 @@ static ssize_t cifs_stats_proc_write(struct file *file,
|
||||||
{
|
{
|
||||||
bool bv;
|
bool bv;
|
||||||
int rc;
|
int rc;
|
||||||
struct list_head *tmp1, *tmp2, *tmp3;
|
|
||||||
struct TCP_Server_Info *server;
|
struct TCP_Server_Info *server;
|
||||||
struct cifs_ses *ses;
|
struct cifs_ses *ses;
|
||||||
struct cifs_tcon *tcon;
|
struct cifs_tcon *tcon;
|
||||||
|
@ -525,9 +512,7 @@ static ssize_t cifs_stats_proc_write(struct file *file,
|
||||||
GlobalCurrentXid = 0;
|
GlobalCurrentXid = 0;
|
||||||
spin_unlock(&GlobalMid_Lock);
|
spin_unlock(&GlobalMid_Lock);
|
||||||
spin_lock(&cifs_tcp_ses_lock);
|
spin_lock(&cifs_tcp_ses_lock);
|
||||||
list_for_each(tmp1, &cifs_tcp_ses_list) {
|
list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
|
||||||
server = list_entry(tmp1, struct TCP_Server_Info,
|
|
||||||
tcp_ses_list);
|
|
||||||
server->max_in_flight = 0;
|
server->max_in_flight = 0;
|
||||||
#ifdef CONFIG_CIFS_STATS2
|
#ifdef CONFIG_CIFS_STATS2
|
||||||
for (i = 0; i < NUMBER_OF_SMB2_COMMANDS; i++) {
|
for (i = 0; i < NUMBER_OF_SMB2_COMMANDS; i++) {
|
||||||
|
@ -538,13 +523,8 @@ static ssize_t cifs_stats_proc_write(struct file *file,
|
||||||
server->fastest_cmd[0] = 0;
|
server->fastest_cmd[0] = 0;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_CIFS_STATS2 */
|
#endif /* CONFIG_CIFS_STATS2 */
|
||||||
list_for_each(tmp2, &server->smb_ses_list) {
|
list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
|
||||||
ses = list_entry(tmp2, struct cifs_ses,
|
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
|
||||||
smb_ses_list);
|
|
||||||
list_for_each(tmp3, &ses->tcon_list) {
|
|
||||||
tcon = list_entry(tmp3,
|
|
||||||
struct cifs_tcon,
|
|
||||||
tcon_list);
|
|
||||||
atomic_set(&tcon->num_smbs_sent, 0);
|
atomic_set(&tcon->num_smbs_sent, 0);
|
||||||
spin_lock(&tcon->stat_lock);
|
spin_lock(&tcon->stat_lock);
|
||||||
tcon->bytes_read = 0;
|
tcon->bytes_read = 0;
|
||||||
|
@ -569,7 +549,6 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
|
||||||
#ifdef CONFIG_CIFS_STATS2
|
#ifdef CONFIG_CIFS_STATS2
|
||||||
int j;
|
int j;
|
||||||
#endif /* STATS2 */
|
#endif /* STATS2 */
|
||||||
struct list_head *tmp2, *tmp3;
|
|
||||||
struct TCP_Server_Info *server;
|
struct TCP_Server_Info *server;
|
||||||
struct cifs_ses *ses;
|
struct cifs_ses *ses;
|
||||||
struct cifs_tcon *tcon;
|
struct cifs_tcon *tcon;
|
||||||
|
@ -619,13 +598,8 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
|
||||||
atomic_read(&server->smb2slowcmd[j]),
|
atomic_read(&server->smb2slowcmd[j]),
|
||||||
server->hostname, j);
|
server->hostname, j);
|
||||||
#endif /* STATS2 */
|
#endif /* STATS2 */
|
||||||
list_for_each(tmp2, &server->smb_ses_list) {
|
list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
|
||||||
ses = list_entry(tmp2, struct cifs_ses,
|
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
|
||||||
smb_ses_list);
|
|
||||||
list_for_each(tmp3, &ses->tcon_list) {
|
|
||||||
tcon = list_entry(tmp3,
|
|
||||||
struct cifs_tcon,
|
|
||||||
tcon_list);
|
|
||||||
i++;
|
i++;
|
||||||
seq_printf(m, "\n%d) %s", i, tcon->treeName);
|
seq_printf(m, "\n%d) %s", i, tcon->treeName);
|
||||||
if (tcon->need_reconnect)
|
if (tcon->need_reconnect)
|
||||||
|
|
|
@ -2257,13 +2257,10 @@ static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
|
||||||
static struct cifs_tcon *
|
static struct cifs_tcon *
|
||||||
cifs_find_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
|
cifs_find_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
|
||||||
{
|
{
|
||||||
struct list_head *tmp;
|
|
||||||
struct cifs_tcon *tcon;
|
struct cifs_tcon *tcon;
|
||||||
|
|
||||||
spin_lock(&cifs_tcp_ses_lock);
|
spin_lock(&cifs_tcp_ses_lock);
|
||||||
list_for_each(tmp, &ses->tcon_list) {
|
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
|
||||||
tcon = list_entry(tmp, struct cifs_tcon, tcon_list);
|
|
||||||
|
|
||||||
if (!match_tcon(tcon, ctx))
|
if (!match_tcon(tcon, ctx))
|
||||||
continue;
|
continue;
|
||||||
++tcon->tc_count;
|
++tcon->tc_count;
|
||||||
|
|
|
@ -928,9 +928,7 @@ int cifs_close(struct inode *inode, struct file *file)
|
||||||
void
|
void
|
||||||
cifs_reopen_persistent_handles(struct cifs_tcon *tcon)
|
cifs_reopen_persistent_handles(struct cifs_tcon *tcon)
|
||||||
{
|
{
|
||||||
struct cifsFileInfo *open_file;
|
struct cifsFileInfo *open_file, *tmp;
|
||||||
struct list_head *tmp;
|
|
||||||
struct list_head *tmp1;
|
|
||||||
struct list_head tmp_list;
|
struct list_head tmp_list;
|
||||||
|
|
||||||
if (!tcon->use_persistent || !tcon->need_reopen_files)
|
if (!tcon->use_persistent || !tcon->need_reopen_files)
|
||||||
|
@ -943,8 +941,7 @@ cifs_reopen_persistent_handles(struct cifs_tcon *tcon)
|
||||||
|
|
||||||
/* list all files open on tree connection, reopen resilient handles */
|
/* list all files open on tree connection, reopen resilient handles */
|
||||||
spin_lock(&tcon->open_file_lock);
|
spin_lock(&tcon->open_file_lock);
|
||||||
list_for_each(tmp, &tcon->openFileList) {
|
list_for_each_entry(open_file, &tcon->openFileList, tlist) {
|
||||||
open_file = list_entry(tmp, struct cifsFileInfo, tlist);
|
|
||||||
if (!open_file->invalidHandle)
|
if (!open_file->invalidHandle)
|
||||||
continue;
|
continue;
|
||||||
cifsFileInfo_get(open_file);
|
cifsFileInfo_get(open_file);
|
||||||
|
@ -952,8 +949,7 @@ cifs_reopen_persistent_handles(struct cifs_tcon *tcon)
|
||||||
}
|
}
|
||||||
spin_unlock(&tcon->open_file_lock);
|
spin_unlock(&tcon->open_file_lock);
|
||||||
|
|
||||||
list_for_each_safe(tmp, tmp1, &tmp_list) {
|
list_for_each_entry_safe(open_file, tmp, &tmp_list, rlist) {
|
||||||
open_file = list_entry(tmp, struct cifsFileInfo, rlist);
|
|
||||||
if (cifs_reopen_file(open_file, false /* do not flush */))
|
if (cifs_reopen_file(open_file, false /* do not flush */))
|
||||||
tcon->need_reopen_files = true;
|
tcon->need_reopen_files = true;
|
||||||
list_del_init(&open_file->rlist);
|
list_del_init(&open_file->rlist);
|
||||||
|
|
|
@ -400,7 +400,6 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv)
|
||||||
{
|
{
|
||||||
struct smb_hdr *buf = (struct smb_hdr *)buffer;
|
struct smb_hdr *buf = (struct smb_hdr *)buffer;
|
||||||
struct smb_com_lock_req *pSMB = (struct smb_com_lock_req *)buf;
|
struct smb_com_lock_req *pSMB = (struct smb_com_lock_req *)buf;
|
||||||
struct list_head *tmp, *tmp1, *tmp2;
|
|
||||||
struct cifs_ses *ses;
|
struct cifs_ses *ses;
|
||||||
struct cifs_tcon *tcon;
|
struct cifs_tcon *tcon;
|
||||||
struct cifsInodeInfo *pCifsInode;
|
struct cifsInodeInfo *pCifsInode;
|
||||||
|
@ -467,18 +466,14 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv)
|
||||||
|
|
||||||
/* look up tcon based on tid & uid */
|
/* look up tcon based on tid & uid */
|
||||||
spin_lock(&cifs_tcp_ses_lock);
|
spin_lock(&cifs_tcp_ses_lock);
|
||||||
list_for_each(tmp, &srv->smb_ses_list) {
|
list_for_each_entry(ses, &srv->smb_ses_list, smb_ses_list) {
|
||||||
ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
|
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
|
||||||
list_for_each(tmp1, &ses->tcon_list) {
|
|
||||||
tcon = list_entry(tmp1, struct cifs_tcon, tcon_list);
|
|
||||||
if (tcon->tid != buf->Tid)
|
if (tcon->tid != buf->Tid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
cifs_stats_inc(&tcon->stats.cifs_stats.num_oplock_brks);
|
cifs_stats_inc(&tcon->stats.cifs_stats.num_oplock_brks);
|
||||||
spin_lock(&tcon->open_file_lock);
|
spin_lock(&tcon->open_file_lock);
|
||||||
list_for_each(tmp2, &tcon->openFileList) {
|
list_for_each_entry(netfile, &tcon->openFileList, tlist) {
|
||||||
netfile = list_entry(tmp2, struct cifsFileInfo,
|
|
||||||
tlist);
|
|
||||||
if (pSMB->Fid != netfile->fid.netfid)
|
if (pSMB->Fid != netfile->fid.netfid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -763,14 +758,12 @@ void
|
||||||
cifs_close_all_deferred_files(struct cifs_tcon *tcon)
|
cifs_close_all_deferred_files(struct cifs_tcon *tcon)
|
||||||
{
|
{
|
||||||
struct cifsFileInfo *cfile;
|
struct cifsFileInfo *cfile;
|
||||||
struct list_head *tmp;
|
|
||||||
struct file_list *tmp_list, *tmp_next_list;
|
struct file_list *tmp_list, *tmp_next_list;
|
||||||
struct list_head file_head;
|
struct list_head file_head;
|
||||||
|
|
||||||
INIT_LIST_HEAD(&file_head);
|
INIT_LIST_HEAD(&file_head);
|
||||||
spin_lock(&tcon->open_file_lock);
|
spin_lock(&tcon->open_file_lock);
|
||||||
list_for_each(tmp, &tcon->openFileList) {
|
list_for_each_entry(cfile, &tcon->openFileList, tlist) {
|
||||||
cfile = list_entry(tmp, struct cifsFileInfo, tlist);
|
|
||||||
if (delayed_work_pending(&cfile->deferred)) {
|
if (delayed_work_pending(&cfile->deferred)) {
|
||||||
if (cancel_delayed_work(&cfile->deferred)) {
|
if (cancel_delayed_work(&cfile->deferred)) {
|
||||||
tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC);
|
tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC);
|
||||||
|
@ -793,7 +786,6 @@ void
|
||||||
cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon, const char *path)
|
cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon, const char *path)
|
||||||
{
|
{
|
||||||
struct cifsFileInfo *cfile;
|
struct cifsFileInfo *cfile;
|
||||||
struct list_head *tmp;
|
|
||||||
struct file_list *tmp_list, *tmp_next_list;
|
struct file_list *tmp_list, *tmp_next_list;
|
||||||
struct list_head file_head;
|
struct list_head file_head;
|
||||||
void *page;
|
void *page;
|
||||||
|
@ -802,8 +794,7 @@ cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon, const char *path)
|
||||||
INIT_LIST_HEAD(&file_head);
|
INIT_LIST_HEAD(&file_head);
|
||||||
page = alloc_dentry_path();
|
page = alloc_dentry_path();
|
||||||
spin_lock(&tcon->open_file_lock);
|
spin_lock(&tcon->open_file_lock);
|
||||||
list_for_each(tmp, &tcon->openFileList) {
|
list_for_each_entry(cfile, &tcon->openFileList, tlist) {
|
||||||
cfile = list_entry(tmp, struct cifsFileInfo, tlist);
|
|
||||||
full_path = build_path_from_dentry(cfile->dentry, page);
|
full_path = build_path_from_dentry(cfile->dentry, page);
|
||||||
if (strstr(full_path, path)) {
|
if (strstr(full_path, path)) {
|
||||||
if (delayed_work_pending(&cfile->deferred)) {
|
if (delayed_work_pending(&cfile->deferred)) {
|
||||||
|
|
|
@ -2575,7 +2575,6 @@ static void
|
||||||
smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server)
|
smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server)
|
||||||
{
|
{
|
||||||
struct smb2_hdr *shdr = (struct smb2_hdr *)buf;
|
struct smb2_hdr *shdr = (struct smb2_hdr *)buf;
|
||||||
struct list_head *tmp, *tmp1;
|
|
||||||
struct cifs_ses *ses;
|
struct cifs_ses *ses;
|
||||||
struct cifs_tcon *tcon;
|
struct cifs_tcon *tcon;
|
||||||
|
|
||||||
|
@ -2583,10 +2582,8 @@ smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
spin_lock(&cifs_tcp_ses_lock);
|
spin_lock(&cifs_tcp_ses_lock);
|
||||||
list_for_each(tmp, &server->smb_ses_list) {
|
list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
|
||||||
ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
|
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
|
||||||
list_for_each(tmp1, &ses->tcon_list) {
|
|
||||||
tcon = list_entry(tmp1, struct cifs_tcon, tcon_list);
|
|
||||||
if (tcon->tid == le32_to_cpu(shdr->Id.SyncId.TreeId)) {
|
if (tcon->tid == le32_to_cpu(shdr->Id.SyncId.TreeId)) {
|
||||||
tcon->need_reconnect = true;
|
tcon->need_reconnect = true;
|
||||||
spin_unlock(&cifs_tcp_ses_lock);
|
spin_unlock(&cifs_tcp_ses_lock);
|
||||||
|
|
Loading…
Reference in New Issue