diff options
author | Suresh Jayaraman <sjayaraman@suse.de> | 2010-07-05 12:43:25 (GMT) |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2010-08-02 12:40:37 (GMT) |
commit | 56698236e1294848c63d4768673865ae5a9c69e0 (patch) | |
tree | ce6d43104a236595763759fe68c26ca3089abdd1 /fs/cifs/file.c | |
parent | 9dc06558c223bbc08290917ac44c25963bc09e43 (diff) | |
download | linux-fsl-qoriq-56698236e1294848c63d4768673865ae5a9c69e0.tar.xz |
cifs: read pages from FS-Cache
Read pages from a FS-Cache data storage object into a CIFS inode.
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r-- | fs/cifs/file.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index ff726c8..fa04a00d 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -1977,6 +1977,15 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); pTcon = cifs_sb->tcon; + /* + * Reads as many pages as possible from fscache. Returns -ENOBUFS + * immediately if the cookie is negative + */ + rc = cifs_readpages_from_fscache(mapping->host, mapping, page_list, + &num_pages); + if (rc == 0) + goto read_complete; + cFYI(DBG2, "rpages: num pages %d", num_pages); for (i = 0; i < num_pages; ) { unsigned contig_pages; @@ -2087,6 +2096,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, smb_read_data = NULL; } +read_complete: FreeXid(xid); return rc; } @@ -2097,6 +2107,11 @@ static int cifs_readpage_worker(struct file *file, struct page *page, char *read_data; int rc; + /* Is the page cached? */ + rc = cifs_readpage_from_fscache(file->f_path.dentry->d_inode, page); + if (rc == 0) + goto read_complete; + page_cache_get(page); read_data = kmap(page); /* for reads over a certain size could initiate async read ahead */ @@ -2125,6 +2140,8 @@ static int cifs_readpage_worker(struct file *file, struct page *page, io_error: kunmap(page); page_cache_release(page); + +read_complete: return rc; } |