diff options
author | Dave Kleikamp <shaggy@austin.ibm.com> | 2006-06-01 15:41:23 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2006-06-01 15:41:23 -0400 |
commit | 273d81d6ada951ba99f10b755d6f849dbb352730 (patch) | |
tree | cfb22593741e71b5f311c4180c542d63f7bcc4df /fs | |
parent | 3856a9d443ee24248683c415e535f7a2b0fed0f3 (diff) |
[CIFS] Do not overwrite aops
cifs should not be overwriting an element of the aops structure, since the
structure is shared by all cifs inodes. Instead define a separate aops
structure to suit each purpose.
I also took the liberty of replacing a hard-coded 4096 with PAGE_CACHE_SIZE
Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Steven French <sfrench@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/cifsfs.h | 1 | ||||
-rw-r--r-- | fs/cifs/file.c | 16 | ||||
-rw-r--r-- | fs/cifs/inode.c | 14 | ||||
-rw-r--r-- | fs/cifs/readdir.c | 16 |
4 files changed, 35 insertions, 12 deletions
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 2fc6d6527f1e..3011df988bd5 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | extern struct address_space_operations cifs_addr_ops; | 35 | extern struct address_space_operations cifs_addr_ops; |
36 | extern struct address_space_operations cifs_addr_ops_smallbuf; | ||
36 | 37 | ||
37 | /* Functions related to super block operations */ | 38 | /* Functions related to super block operations */ |
38 | extern struct super_operations cifs_super_ops; | 39 | extern struct super_operations cifs_super_ops; |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 379369ecda96..d62e29fe91f2 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 | */ | ||
1968 | struct 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 a609d2668032..b88147c1dc27 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 53903a27f786..e3e762d774df 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 |