From 0471ca3fe481cf5ff0ae24c7003f4d9086a02791 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Wed, 16 May 2012 07:13:16 -0400 Subject: cifs: make cifs_readdata_alloc take a work_func_t arg We'll need different completion routines for an uncached read. Allow the caller to set the one he needs at allocation time. Also, move most of these functions to file.c so we can make more of them static. Signed-off-by: Jeff Layton --- fs/cifs/cifssmb.c | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) (limited to 'fs/cifs/cifssmb.c') diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index da2f5446fa7a..d263f98aab91 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -87,7 +87,6 @@ static struct { #endif /* CIFS_POSIX */ /* Forward declarations */ -static void cifs_readv_complete(struct work_struct *work); /* Mark as invalid, all open files on tree connections since they were closed when session to server was lost */ @@ -1385,28 +1384,6 @@ openRetry: return rc; } -struct cifs_readdata * -cifs_readdata_alloc(unsigned int nr_pages) -{ - struct cifs_readdata *rdata; - - /* readdata + 1 kvec for each page */ - rdata = kzalloc(sizeof(*rdata) + - sizeof(struct kvec) * nr_pages, GFP_KERNEL); - if (rdata != NULL) { - INIT_WORK(&rdata->work, cifs_readv_complete); - INIT_LIST_HEAD(&rdata->pages); - } - return rdata; -} - -void -cifs_readdata_free(struct cifs_readdata *rdata) -{ - cifsFileInfo_put(rdata->cfile); - kfree(rdata); -} - /* * Discard any remaining data in the current SMB. To do this, we borrow the * current bigbuf. @@ -1631,33 +1608,6 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) return length; } -static void -cifs_readv_complete(struct work_struct *work) -{ - struct cifs_readdata *rdata = container_of(work, - struct cifs_readdata, work); - struct page *page, *tpage; - - list_for_each_entry_safe(page, tpage, &rdata->pages, lru) { - list_del(&page->lru); - lru_cache_add_file(page); - - if (rdata->result == 0) { - kunmap(page); - flush_dcache_page(page); - SetPageUptodate(page); - } - - unlock_page(page); - - if (rdata->result == 0) - cifs_readpage_to_fscache(rdata->mapping->host, page); - - page_cache_release(page); - } - cifs_readdata_free(rdata); -} - static void cifs_readv_callback(struct mid_q_entry *mid) { -- cgit v1.2.3