diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-03-23 14:40:55 -0400 |
---|---|---|
committer | Jeff Layton <jlayton@redhat.com> | 2012-03-23 14:40:55 -0400 |
commit | c2e8764009a0245fd24fcd2a63ffbf64236af016 (patch) | |
tree | 91f3a0503fda92f8c2cf06166adcd801ca98fe4a /fs/cifs | |
parent | fe5f5d2e908957392aebbb852a6fb22885860d4b (diff) |
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 <jlayton@redhat.com>
Reviewed-by: Pavel Shilovsky <piastry@etersoft.ru>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/cifsproto.h | 4 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 6 | ||||
-rw-r--r-- | fs/cifs/file.c | 3 |
3 files changed, 8 insertions, 5 deletions
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 { | |||
495 | }; | 495 | }; |
496 | 496 | ||
497 | int cifs_async_writev(struct cifs_writedata *wdata); | 497 | int cifs_async_writev(struct cifs_writedata *wdata); |
498 | struct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages); | 498 | void cifs_writev_complete(struct work_struct *work); |
499 | struct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages, | ||
500 | work_func_t complete); | ||
499 | void cifs_writedata_release(struct kref *refcount); | 501 | void cifs_writedata_release(struct kref *refcount); |
500 | 502 | ||
501 | #endif /* _CIFSPROTO_H */ | 503 | #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) | |||
2035 | kref_put(&wdata->refcount, cifs_writedata_release); | 2035 | kref_put(&wdata->refcount, cifs_writedata_release); |
2036 | } | 2036 | } |
2037 | 2037 | ||
2038 | static void | 2038 | void |
2039 | cifs_writev_complete(struct work_struct *work) | 2039 | cifs_writev_complete(struct work_struct *work) |
2040 | { | 2040 | { |
2041 | struct cifs_writedata *wdata = container_of(work, | 2041 | struct cifs_writedata *wdata = container_of(work, |
@@ -2065,7 +2065,7 @@ cifs_writev_complete(struct work_struct *work) | |||
2065 | } | 2065 | } |
2066 | 2066 | ||
2067 | struct cifs_writedata * | 2067 | struct cifs_writedata * |
2068 | cifs_writedata_alloc(unsigned int nr_pages) | 2068 | cifs_writedata_alloc(unsigned int nr_pages, work_func_t complete) |
2069 | { | 2069 | { |
2070 | struct cifs_writedata *wdata; | 2070 | struct cifs_writedata *wdata; |
2071 | 2071 | ||
@@ -2079,7 +2079,7 @@ cifs_writedata_alloc(unsigned int nr_pages) | |||
2079 | wdata = kzalloc(sizeof(*wdata) + | 2079 | wdata = kzalloc(sizeof(*wdata) + |
2080 | sizeof(struct page *) * (nr_pages - 1), GFP_NOFS); | 2080 | sizeof(struct page *) * (nr_pages - 1), GFP_NOFS); |
2081 | if (wdata != NULL) { | 2081 | if (wdata != NULL) { |
2082 | INIT_WORK(&wdata->work, cifs_writev_complete); | 2082 | INIT_WORK(&wdata->work, complete); |
2083 | kref_init(&wdata->refcount); | 2083 | kref_init(&wdata->refcount); |
2084 | } | 2084 | } |
2085 | return wdata; | 2085 | 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: | |||
1684 | tofind = min((cifs_sb->wsize / PAGE_CACHE_SIZE) - 1, | 1684 | tofind = min((cifs_sb->wsize / PAGE_CACHE_SIZE) - 1, |
1685 | end - index) + 1; | 1685 | end - index) + 1; |
1686 | 1686 | ||
1687 | wdata = cifs_writedata_alloc((unsigned int)tofind); | 1687 | wdata = cifs_writedata_alloc((unsigned int)tofind, |
1688 | cifs_writev_complete); | ||
1688 | if (!wdata) { | 1689 | if (!wdata) { |
1689 | rc = -ENOMEM; | 1690 | rc = -ENOMEM; |
1690 | break; | 1691 | break; |