]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
cifs: allow caller to specify completion op when allocating writedata
authorJeff Layton <jlayton@redhat.com>
Fri, 23 Mar 2012 18:40:55 +0000 (14:40 -0400)
committerJeff Layton <jlayton@redhat.com>
Fri, 23 Mar 2012 18:40:55 +0000 (14:40 -0400)
We'll need a different set of write completion ops when not writing out
of the pagecache.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Pavel Shilovsky <piastry@etersoft.ru>
fs/cifs/cifsproto.h
fs/cifs/cifssmb.c
fs/cifs/file.c

index 9e68340c7306e9caed0962661b05410ac59b3c5c..cbf09cdd42a78d11969d3c1ac661cadee824f98e 100644 (file)
@@ -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 */
index 61922142cf0d55602f2ef62eb58f900054fb679d..21ff4bff6c897737a2ecae2a208c5fd743ae82e9 100644 (file)
@@ -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;
index 5fedf6cb5a5673ce26a08edbf1bd4b8d32bd3796..f624c4d4a393cba940d14ea98c6e64976505f549 100644 (file)
@@ -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;