aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifsfs.h1
-rw-r--r--fs/cifs/file.c16
-rw-r--r--fs/cifs/inode.c14
-rw-r--r--fs/cifs/readdir.c16
4 files changed, 35 insertions, 12 deletions
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 2fc6d6527f1..3011df988bd 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -33,6 +33,7 @@
33#endif 33#endif
34 34
35extern struct address_space_operations cifs_addr_ops; 35extern struct address_space_operations cifs_addr_ops;
36extern struct address_space_operations cifs_addr_ops_smallbuf;
36 37
37/* Functions related to super block operations */ 38/* Functions related to super block operations */
38extern struct super_operations cifs_super_ops; 39extern struct super_operations cifs_super_ops;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 379369ecda9..d62e29fe91f 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1959,3 +1959,19 @@ struct address_space_operations cifs_addr_ops = {
1959 /* .sync_page = cifs_sync_page, */ 1959 /* .sync_page = cifs_sync_page, */
1960 /* .direct_IO = */ 1960 /* .direct_IO = */
1961}; 1961};
1962
1963/*
1964 * cifs_readpages requires the server to support a buffer large enough to
1965 * contain the header plus one complete page of data. Otherwise, we need
1966 * to leave cifs_readpages out of the address space operations.
1967 */
1968struct address_space_operations cifs_addr_ops_smallbuf = {
1969 .readpage = cifs_readpage,
1970 .writepage = cifs_writepage,
1971 .writepages = cifs_writepages,
1972 .prepare_write = cifs_prepare_write,
1973 .commit_write = cifs_commit_write,
1974 .set_page_dirty = __set_page_dirty_nobuffers,
1975 /* .sync_page = cifs_sync_page, */
1976 /* .direct_IO = */
1977};
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index a609d266803..b88147c1dc2 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -180,11 +180,12 @@ int cifs_get_inode_info_unix(struct inode **pinode,
180 else /* not direct, send byte range locks */ 180 else /* not direct, send byte range locks */
181 inode->i_fop = &cifs_file_ops; 181 inode->i_fop = &cifs_file_ops;
182 182
183 inode->i_data.a_ops = &cifs_addr_ops;
184 /* check if server can support readpages */ 183 /* check if server can support readpages */
185 if(pTcon->ses->server->maxBuf < 184 if(pTcon->ses->server->maxBuf <
186 4096 + MAX_CIFS_HDR_SIZE) 185 PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE)
187 inode->i_data.a_ops->readpages = NULL; 186 inode->i_data.a_ops = &cifs_addr_ops_smallbuf;
187 else
188 inode->i_data.a_ops = &cifs_addr_ops;
188 } else if (S_ISDIR(inode->i_mode)) { 189 } else if (S_ISDIR(inode->i_mode)) {
189 cFYI(1, ("Directory inode")); 190 cFYI(1, ("Directory inode"));
190 inode->i_op = &cifs_dir_inode_ops; 191 inode->i_op = &cifs_dir_inode_ops;
@@ -519,10 +520,11 @@ int cifs_get_inode_info(struct inode **pinode,
519 else /* not direct, send byte range locks */ 520 else /* not direct, send byte range locks */
520 inode->i_fop = &cifs_file_ops; 521 inode->i_fop = &cifs_file_ops;
521 522
522 inode->i_data.a_ops = &cifs_addr_ops;
523 if(pTcon->ses->server->maxBuf < 523 if(pTcon->ses->server->maxBuf <
524 4096 + MAX_CIFS_HDR_SIZE) 524 PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE)
525 inode->i_data.a_ops->readpages = NULL; 525 inode->i_data.a_ops = &cifs_addr_ops_smallbuf;
526 else
527 inode->i_data.a_ops = &cifs_addr_ops;
526 } else if (S_ISDIR(inode->i_mode)) { 528 } else if (S_ISDIR(inode->i_mode)) {
527 cFYI(1, ("Directory inode")); 529 cFYI(1, ("Directory inode"));
528 inode->i_op = &cifs_dir_inode_ops; 530 inode->i_op = &cifs_dir_inode_ops;
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 53903a27f78..e3e762d774d 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -21,6 +21,7 @@
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 22 */
23#include <linux/fs.h> 23#include <linux/fs.h>
24#include <linux/pagemap.h>
24#include <linux/stat.h> 25#include <linux/stat.h>
25#include <linux/smp_lock.h> 26#include <linux/smp_lock.h>
26#include "cifspdu.h" 27#include "cifspdu.h"
@@ -216,11 +217,13 @@ static void fill_in_inode(struct inode *tmp_inode,
216 else 217 else
217 tmp_inode->i_fop = &cifs_file_ops; 218 tmp_inode->i_fop = &cifs_file_ops;
218 219
219 tmp_inode->i_data.a_ops = &cifs_addr_ops;
220 if((cifs_sb->tcon) && (cifs_sb->tcon->ses) && 220 if((cifs_sb->tcon) && (cifs_sb->tcon->ses) &&
221 (cifs_sb->tcon->ses->server->maxBuf < 221 (cifs_sb->tcon->ses->server->maxBuf <
222 4096 + MAX_CIFS_HDR_SIZE)) 222 PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE))
223 tmp_inode->i_data.a_ops->readpages = NULL; 223 tmp_inode->i_data.a_ops = &cifs_addr_ops_smallbuf;
224 else
225 tmp_inode->i_data.a_ops = &cifs_addr_ops;
226
224 if(isNewInode) 227 if(isNewInode)
225 return; /* No sense invalidating pages for new inode 228 return; /* No sense invalidating pages for new inode
226 since have not started caching readahead file 229 since have not started caching readahead file
@@ -339,11 +342,12 @@ static void unix_fill_in_inode(struct inode *tmp_inode,
339 else 342 else
340 tmp_inode->i_fop = &cifs_file_ops; 343 tmp_inode->i_fop = &cifs_file_ops;
341 344
342 tmp_inode->i_data.a_ops = &cifs_addr_ops;
343 if((cifs_sb->tcon) && (cifs_sb->tcon->ses) && 345 if((cifs_sb->tcon) && (cifs_sb->tcon->ses) &&
344 (cifs_sb->tcon->ses->server->maxBuf < 346 (cifs_sb->tcon->ses->server->maxBuf <
345 4096 + MAX_CIFS_HDR_SIZE)) 347 PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE))
346 tmp_inode->i_data.a_ops->readpages = NULL; 348 tmp_inode->i_data.a_ops = &cifs_addr_ops_smallbuf;
349 else
350 tmp_inode->i_data.a_ops = &cifs_addr_ops;
347 351
348 if(isNewInode) 352 if(isNewInode)
349 return; /* No sense invalidating pages for new inode since we 353 return; /* No sense invalidating pages for new inode since we