From: Jeff Layton Date: Fri, 23 Mar 2012 18:40:55 +0000 (-0400) Subject: cifs: allow caller to specify completion op when allocating writedata X-Git-Tag: Ubuntu-goldfish-3.4.0-4.27~569^2~2^2~10 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=c2e8764009a0245fd24fcd2a63ffbf64236af016;p=mirror_ubuntu-zesty-kernel.git cifs: allow caller to specify completion op when allocating writedata We'll need a different set of write completion ops when not writing out of the pagecache. Signed-off-by: Jeff Layton Reviewed-by: Pavel Shilovsky --- diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 9e68340c7306..cbf09cdd42a7 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -495,7 +495,9 @@ struct cifs_writedata { }; int cifs_async_writev(struct cifs_writedata *wdata); -struct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages); +void cifs_writev_complete(struct work_struct *work); +struct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages, + work_func_t complete); void cifs_writedata_release(struct kref *refcount); #endif /* _CIFSPROTO_H */ diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 61922142cf0d..21ff4bff6c89 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -2035,7 +2035,7 @@ cifs_writev_requeue(struct cifs_writedata *wdata) kref_put(&wdata->refcount, cifs_writedata_release); } -static void +void cifs_writev_complete(struct work_struct *work) { struct cifs_writedata *wdata = container_of(work, @@ -2065,7 +2065,7 @@ cifs_writev_complete(struct work_struct *work) } struct cifs_writedata * -cifs_writedata_alloc(unsigned int nr_pages) +cifs_writedata_alloc(unsigned int nr_pages, work_func_t complete) { struct cifs_writedata *wdata; @@ -2079,7 +2079,7 @@ cifs_writedata_alloc(unsigned int nr_pages) wdata = kzalloc(sizeof(*wdata) + sizeof(struct page *) * (nr_pages - 1), GFP_NOFS); if (wdata != NULL) { - INIT_WORK(&wdata->work, cifs_writev_complete); + INIT_WORK(&wdata->work, complete); kref_init(&wdata->refcount); } return wdata; diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 5fedf6cb5a56..f624c4d4a393 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -1684,7 +1684,8 @@ retry: tofind = min((cifs_sb->wsize / PAGE_CACHE_SIZE) - 1, end - index) + 1; - wdata = cifs_writedata_alloc((unsigned int)tofind); + wdata = cifs_writedata_alloc((unsigned int)tofind, + cifs_writev_complete); if (!wdata) { rc = -ENOMEM; break;