aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2009-09-21 14:08:18 -0400
committerSteve French <sfrench@us.ibm.com>2009-09-24 15:35:18 -0400
commit086f68bd97126618ecb2dcff5f766f3a21722df7 (patch)
tree25f5785dc4ce4ffdc8c852b6c04e52324dd334b0 /fs/cifs/file.c
parent3bc303c254335dbd7c7012cc1760b12f1d5514d3 (diff)
cifs: eliminate cifs_init_private
...it does the same thing as cifs_fill_fileinfo, but doesn't handle the flist ordering correctly. Also rename cifs_fill_fileinfo to a more descriptive name and have it take an open flags arg instead of just a write_only flag. That makes the logic in the callers a little simpler. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c31
1 files changed, 3 insertions, 28 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 90f61786f516..fee993c92f1a 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -40,29 +40,6 @@
40#include "cifs_debug.h" 40#include "cifs_debug.h"
41#include "cifs_fs_sb.h" 41#include "cifs_fs_sb.h"
42 42
43static inline struct cifsFileInfo *cifs_init_private(
44 struct cifsFileInfo *private_data, struct inode *inode,
45 struct file *file, __u16 netfid)
46{
47 memset(private_data, 0, sizeof(struct cifsFileInfo));
48 private_data->netfid = netfid;
49 private_data->pid = current->tgid;
50 mutex_init(&private_data->fh_mutex);
51 mutex_init(&private_data->lock_mutex);
52 INIT_LIST_HEAD(&private_data->llist);
53 private_data->pfile = file; /* needed for writepage */
54 private_data->pInode = igrab(inode);
55 private_data->mnt = file->f_path.mnt;
56 private_data->invalidHandle = false;
57 private_data->closePend = false;
58 /* Initialize reference count to one. The private data is
59 freed on the release of the last reference */
60 atomic_set(&private_data->count, 1);
61 slow_work_init(&private_data->oplock_break, &cifs_oplock_break_ops);
62
63 return private_data;
64}
65
66static inline int cifs_convert_flags(unsigned int flags) 43static inline int cifs_convert_flags(unsigned int flags)
67{ 44{
68 if ((flags & O_ACCMODE) == O_RDONLY) 45 if ((flags & O_ACCMODE) == O_RDONLY)
@@ -420,15 +397,13 @@ int cifs_open(struct inode *inode, struct file *file)
420 cFYI(1, ("cifs_open returned 0x%x", rc)); 397 cFYI(1, ("cifs_open returned 0x%x", rc));
421 goto out; 398 goto out;
422 } 399 }
423 file->private_data = 400 pCifsFile = cifs_new_fileinfo(inode, netfid, file, file->f_path.mnt,
424 kmalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); 401 file->f_flags);
402 file->private_data = pCifsFile;
425 if (file->private_data == NULL) { 403 if (file->private_data == NULL) {
426 rc = -ENOMEM; 404 rc = -ENOMEM;
427 goto out; 405 goto out;
428 } 406 }
429 pCifsFile = cifs_init_private(file->private_data, inode, file, netfid);
430 write_lock(&GlobalSMBSeslock);
431 list_add(&pCifsFile->tlist, &tcon->openFileList);
432 407
433 pCifsInode = CIFS_I(file->f_path.dentry->d_inode); 408 pCifsInode = CIFS_I(file->f_path.dentry->d_inode);
434 if (pCifsInode) { 409 if (pCifsInode) {