Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2e87640 authored by Jeff Layton's avatar Jeff Layton
Browse files

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: default avatarJeff Layton <jlayton@redhat.com>
Reviewed-by: default avatarPavel Shilovsky <piastry@etersoft.ru>
parent fe5f5d2e
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -495,7 +495,9 @@ struct cifs_writedata {
};
};


int cifs_async_writev(struct cifs_writedata *wdata);
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);
void cifs_writedata_release(struct kref *refcount);


#endif			/* _CIFSPROTO_H */
#endif			/* _CIFSPROTO_H */
+3 −3
Original line number Original line Diff line number Diff line
@@ -2035,7 +2035,7 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
	kref_put(&wdata->refcount, cifs_writedata_release);
	kref_put(&wdata->refcount, cifs_writedata_release);
}
}


static void
void
cifs_writev_complete(struct work_struct *work)
cifs_writev_complete(struct work_struct *work)
{
{
	struct cifs_writedata *wdata = container_of(work,
	struct cifs_writedata *wdata = container_of(work,
@@ -2065,7 +2065,7 @@ cifs_writev_complete(struct work_struct *work)
}
}


struct cifs_writedata *
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;
	struct cifs_writedata *wdata;


@@ -2079,7 +2079,7 @@ cifs_writedata_alloc(unsigned int nr_pages)
	wdata = kzalloc(sizeof(*wdata) +
	wdata = kzalloc(sizeof(*wdata) +
			sizeof(struct page *) * (nr_pages - 1), GFP_NOFS);
			sizeof(struct page *) * (nr_pages - 1), GFP_NOFS);
	if (wdata != NULL) {
	if (wdata != NULL) {
		INIT_WORK(&wdata->work, cifs_writev_complete);
		INIT_WORK(&wdata->work, complete);
		kref_init(&wdata->refcount);
		kref_init(&wdata->refcount);
	}
	}
	return wdata;
	return wdata;
+2 −1
Original line number Original line Diff line number Diff line
@@ -1684,7 +1684,8 @@ static int cifs_writepages(struct address_space *mapping,
		tofind = min((cifs_sb->wsize / PAGE_CACHE_SIZE) - 1,
		tofind = min((cifs_sb->wsize / PAGE_CACHE_SIZE) - 1,
				end - index) + 1;
				end - index) + 1;


		wdata = cifs_writedata_alloc((unsigned int)tofind);
		wdata = cifs_writedata_alloc((unsigned int)tofind,
					     cifs_writev_complete);
		if (!wdata) {
		if (!wdata) {
			rc = -ENOMEM;
			rc = -ENOMEM;
			break;
			break;