aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
authorSuresh Jayaraman <sjayaraman@suse.de>2010-07-05 08:43:25 -0400
committerSteve French <sfrench@us.ibm.com>2010-08-02 08:40:37 -0400
commit56698236e1294848c63d4768673865ae5a9c69e0 (patch)
treece6d43104a236595763759fe68c26ca3089abdd1 /fs/cifs/file.c
parent9dc06558c223bbc08290917ac44c25963bc09e43 (diff)
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.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index ff726c86b290..fa04a00d126d 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,
1977 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 1977 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
1978 pTcon = cifs_sb->tcon; 1978 pTcon = cifs_sb->tcon;
1979 1979
1980 /*
1981 * Reads as many pages as possible from fscache. Returns -ENOBUFS
1982 * immediately if the cookie is negative
1983 */
1984 rc = cifs_readpages_from_fscache(mapping->host, mapping, page_list,
1985 &num_pages);
1986 if (rc == 0)
1987 goto read_complete;
1988
1980 cFYI(DBG2, "rpages: num pages %d", num_pages); 1989 cFYI(DBG2, "rpages: num pages %d", num_pages);
1981 for (i = 0; i < num_pages; ) { 1990 for (i = 0; i < num_pages; ) {
1982 unsigned contig_pages; 1991 unsigned contig_pages;
@@ -2087,6 +2096,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
2087 smb_read_data = NULL; 2096 smb_read_data = NULL;
2088 } 2097 }
2089 2098
2099read_complete:
2090 FreeXid(xid); 2100 FreeXid(xid);
2091 return rc; 2101 return rc;
2092} 2102}
@@ -2097,6 +2107,11 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
2097 char *read_data; 2107 char *read_data;
2098 int rc; 2108 int rc;
2099 2109
2110 /* Is the page cached? */
2111 rc = cifs_readpage_from_fscache(file->f_path.dentry->d_inode, page);
2112 if (rc == 0)
2113 goto read_complete;
2114
2100 page_cache_get(page); 2115 page_cache_get(page);
2101 read_data = kmap(page); 2116 read_data = kmap(page);
2102 /* for reads over a certain size could initiate async read ahead */ 2117 /* 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,
2125io_error: 2140io_error:
2126 kunmap(page); 2141 kunmap(page);
2127 page_cache_release(page); 2142 page_cache_release(page);
2143
2144read_complete:
2128 return rc; 2145 return rc;
2129} 2146}
2130 2147