Commit da472fc8 authored by Jeff Layton's avatar Jeff Layton

cifs: add new cifsiod_wq workqueue

...and convert existing cifs users of system_nrt_wq to use that instead.

Also, make it freezable, and set WQ_MEM_RECLAIM since we use it to
deal with write reply handling.
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Acked-by: default avatarShirish Pargaonkar <shirishpargaonkar@gmail.com>
parent 7c9421e1
...@@ -85,6 +85,8 @@ extern mempool_t *cifs_sm_req_poolp; ...@@ -85,6 +85,8 @@ extern mempool_t *cifs_sm_req_poolp;
extern mempool_t *cifs_req_poolp; extern mempool_t *cifs_req_poolp;
extern mempool_t *cifs_mid_poolp; extern mempool_t *cifs_mid_poolp;
struct workqueue_struct *cifsiod_wq;
static int static int
cifs_read_super(struct super_block *sb) cifs_read_super(struct super_block *sb)
{ {
...@@ -1111,9 +1113,15 @@ init_cifs(void) ...@@ -1111,9 +1113,15 @@ init_cifs(void)
cFYI(1, "cifs_max_pending set to max of %u", CIFS_MAX_REQ); cFYI(1, "cifs_max_pending set to max of %u", CIFS_MAX_REQ);
} }
cifsiod_wq = alloc_workqueue("cifsiod", WQ_FREEZABLE|WQ_MEM_RECLAIM, 0);
if (!cifsiod_wq) {
rc = -ENOMEM;
goto out_clean_proc;
}
rc = cifs_fscache_register(); rc = cifs_fscache_register();
if (rc) if (rc)
goto out_clean_proc; goto out_destroy_wq;
rc = cifs_init_inodecache(); rc = cifs_init_inodecache();
if (rc) if (rc)
...@@ -1161,6 +1169,8 @@ init_cifs(void) ...@@ -1161,6 +1169,8 @@ init_cifs(void)
cifs_destroy_inodecache(); cifs_destroy_inodecache();
out_unreg_fscache: out_unreg_fscache:
cifs_fscache_unregister(); cifs_fscache_unregister();
out_destroy_wq:
destroy_workqueue(cifsiod_wq);
out_clean_proc: out_clean_proc:
cifs_proc_clean(); cifs_proc_clean();
return rc; return rc;
...@@ -1183,6 +1193,7 @@ exit_cifs(void) ...@@ -1183,6 +1193,7 @@ exit_cifs(void)
cifs_destroy_mids(); cifs_destroy_mids();
cifs_destroy_inodecache(); cifs_destroy_inodecache();
cifs_fscache_unregister(); cifs_fscache_unregister();
destroy_workqueue(cifsiod_wq);
cifs_proc_clean(); cifs_proc_clean();
} }
......
...@@ -1070,5 +1070,6 @@ GLOBAL_EXTERN spinlock_t gidsidlock; ...@@ -1070,5 +1070,6 @@ GLOBAL_EXTERN spinlock_t gidsidlock;
void cifs_oplock_break(struct work_struct *work); void cifs_oplock_break(struct work_struct *work);
extern const struct slow_work_ops cifs_oplock_break_ops; extern const struct slow_work_ops cifs_oplock_break_ops;
extern struct workqueue_struct *cifsiod_wq;
#endif /* _CIFS_GLOB_H */ #endif /* _CIFS_GLOB_H */
...@@ -1689,7 +1689,7 @@ cifs_readv_callback(struct mid_q_entry *mid) ...@@ -1689,7 +1689,7 @@ cifs_readv_callback(struct mid_q_entry *mid)
rdata->result = -EIO; rdata->result = -EIO;
} }
queue_work(system_nrt_wq, &rdata->work); queue_work(cifsiod_wq, &rdata->work);
DeleteMidQEntry(mid); DeleteMidQEntry(mid);
cifs_add_credits(server, 1); cifs_add_credits(server, 1);
} }
...@@ -2129,7 +2129,7 @@ cifs_writev_callback(struct mid_q_entry *mid) ...@@ -2129,7 +2129,7 @@ cifs_writev_callback(struct mid_q_entry *mid)
break; break;
} }
queue_work(system_nrt_wq, &wdata->work); queue_work(cifsiod_wq, &wdata->work);
DeleteMidQEntry(mid); DeleteMidQEntry(mid);
cifs_add_credits(tcon->ses->server, 1); cifs_add_credits(tcon->ses->server, 1);
} }
......
...@@ -335,7 +335,7 @@ cifs_echo_request(struct work_struct *work) ...@@ -335,7 +335,7 @@ cifs_echo_request(struct work_struct *work)
server->hostname); server->hostname);
requeue_echo: requeue_echo:
queue_delayed_work(system_nrt_wq, &server->echo, SMB_ECHO_INTERVAL); queue_delayed_work(cifsiod_wq, &server->echo, SMB_ECHO_INTERVAL);
} }
static bool static bool
...@@ -1971,7 +1971,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info) ...@@ -1971,7 +1971,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
cifs_fscache_get_client_cookie(tcp_ses); cifs_fscache_get_client_cookie(tcp_ses);
/* queue echo request delayed work */ /* queue echo request delayed work */
queue_delayed_work(system_nrt_wq, &tcp_ses->echo, SMB_ECHO_INTERVAL); queue_delayed_work(cifsiod_wq, &tcp_ses->echo, SMB_ECHO_INTERVAL);
return tcp_ses; return tcp_ses;
...@@ -3537,7 +3537,7 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info) ...@@ -3537,7 +3537,7 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
tlink_rb_insert(&cifs_sb->tlink_tree, tlink); tlink_rb_insert(&cifs_sb->tlink_tree, tlink);
spin_unlock(&cifs_sb->tlink_tree_lock); spin_unlock(&cifs_sb->tlink_tree_lock);
queue_delayed_work(system_nrt_wq, &cifs_sb->prune_tlinks, queue_delayed_work(cifsiod_wq, &cifs_sb->prune_tlinks,
TLINK_IDLE_EXPIRE); TLINK_IDLE_EXPIRE);
mount_fail_check: mount_fail_check:
...@@ -4091,6 +4091,6 @@ cifs_prune_tlinks(struct work_struct *work) ...@@ -4091,6 +4091,6 @@ cifs_prune_tlinks(struct work_struct *work)
} }
spin_unlock(&cifs_sb->tlink_tree_lock); spin_unlock(&cifs_sb->tlink_tree_lock);
queue_delayed_work(system_nrt_wq, &cifs_sb->prune_tlinks, queue_delayed_work(cifsiod_wq, &cifs_sb->prune_tlinks,
TLINK_IDLE_EXPIRE); TLINK_IDLE_EXPIRE);
} }
...@@ -595,7 +595,7 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv) ...@@ -595,7 +595,7 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv)
cifs_set_oplock_level(pCifsInode, cifs_set_oplock_level(pCifsInode,
pSMB->OplockLevel ? OPLOCK_READ : 0); pSMB->OplockLevel ? OPLOCK_READ : 0);
queue_work(system_nrt_wq, queue_work(cifsiod_wq,
&netfile->oplock_break); &netfile->oplock_break);
netfile->oplock_break_cancelled = false; netfile->oplock_break_cancelled = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment