diff options
author | Jeff Layton <jlayton@redhat.com> | 2010-09-20 19:01:36 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2010-09-29 15:04:33 -0400 |
commit | f7a40689fd1e963cb1006349e050c07584895db5 (patch) | |
tree | 32c0275bde5c7c2a9cb36c672648bb19e392171f /fs/cifs/dir.c | |
parent | 0d424ad0a4b8c08e45928bccfa5b4b240097b01b (diff) |
cifs: have cifs_new_fileinfo take a tcon arg
To minimize calls to cifs_sb_tcon and to allow for a clear error path if
a tcon can't be acquired.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/dir.c')
-rw-r--r-- | fs/cifs/dir.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index fe02435acb3c..23ec28a4c11f 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -131,9 +131,9 @@ cifs_bp_rename_retry: | |||
131 | } | 131 | } |
132 | 132 | ||
133 | struct cifsFileInfo * | 133 | struct cifsFileInfo * |
134 | cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, | 134 | cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, struct file *file, |
135 | struct file *file, struct vfsmount *mnt, unsigned int oflags, | 135 | struct vfsmount *mnt, struct cifsTconInfo *tcon, |
136 | __u32 oplock) | 136 | unsigned int oflags, __u32 oplock) |
137 | { | 137 | { |
138 | struct cifsFileInfo *pCifsFile; | 138 | struct cifsFileInfo *pCifsFile; |
139 | struct cifsInodeInfo *pCifsInode; | 139 | struct cifsInodeInfo *pCifsInode; |
@@ -150,7 +150,7 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, | |||
150 | pCifsFile->pfile = file; | 150 | pCifsFile->pfile = file; |
151 | pCifsFile->invalidHandle = false; | 151 | pCifsFile->invalidHandle = false; |
152 | pCifsFile->closePend = false; | 152 | pCifsFile->closePend = false; |
153 | pCifsFile->tcon = cifs_sb_tcon(cifs_sb); | 153 | pCifsFile->tcon = tcon; |
154 | mutex_init(&pCifsFile->fh_mutex); | 154 | mutex_init(&pCifsFile->fh_mutex); |
155 | mutex_init(&pCifsFile->lock_mutex); | 155 | mutex_init(&pCifsFile->lock_mutex); |
156 | INIT_LIST_HEAD(&pCifsFile->llist); | 156 | INIT_LIST_HEAD(&pCifsFile->llist); |
@@ -158,7 +158,7 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, | |||
158 | INIT_WORK(&pCifsFile->oplock_break, cifs_oplock_break); | 158 | INIT_WORK(&pCifsFile->oplock_break, cifs_oplock_break); |
159 | 159 | ||
160 | write_lock(&GlobalSMBSeslock); | 160 | write_lock(&GlobalSMBSeslock); |
161 | list_add(&pCifsFile->tlist, &cifs_sb_tcon(cifs_sb)->openFileList); | 161 | list_add(&pCifsFile->tlist, &tcon->openFileList); |
162 | pCifsInode = CIFS_I(newinode); | 162 | pCifsInode = CIFS_I(newinode); |
163 | if (pCifsInode) { | 163 | if (pCifsInode) { |
164 | /* if readable file instance put first in list*/ | 164 | /* if readable file instance put first in list*/ |
@@ -191,6 +191,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode, | |||
191 | __u32 posix_flags = 0; | 191 | __u32 posix_flags = 0; |
192 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | 192 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
193 | struct cifs_fattr fattr; | 193 | struct cifs_fattr fattr; |
194 | struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb); | ||
194 | 195 | ||
195 | cFYI(1, "posix open %s", full_path); | 196 | cFYI(1, "posix open %s", full_path); |
196 | 197 | ||
@@ -225,9 +226,9 @@ int cifs_posix_open(char *full_path, struct inode **pinode, | |||
225 | posix_flags |= SMB_O_DIRECT; | 226 | posix_flags |= SMB_O_DIRECT; |
226 | 227 | ||
227 | mode &= ~current_umask(); | 228 | mode &= ~current_umask(); |
228 | rc = CIFSPOSIXCreate(xid, cifs_sb_tcon(cifs_sb), posix_flags, mode, | 229 | rc = CIFSPOSIXCreate(xid, tcon, posix_flags, mode, pnetfid, presp_data, |
229 | pnetfid, presp_data, poplock, full_path, | 230 | poplock, full_path, cifs_sb->local_nls, |
230 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & | 231 | cifs_sb->mnt_cifs_flags & |
231 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 232 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
232 | if (rc) | 233 | if (rc) |
233 | goto posix_open_ret; | 234 | goto posix_open_ret; |
@@ -466,7 +467,8 @@ cifs_create_set_dentry: | |||
466 | } | 467 | } |
467 | 468 | ||
468 | pfile_info = cifs_new_fileinfo(newinode, fileHandle, filp, | 469 | pfile_info = cifs_new_fileinfo(newinode, fileHandle, filp, |
469 | nd->path.mnt, oflags, oplock); | 470 | nd->path.mnt, tcon, oflags, |
471 | oplock); | ||
470 | if (pfile_info == NULL) { | 472 | if (pfile_info == NULL) { |
471 | fput(filp); | 473 | fput(filp); |
472 | CIFSSMBClose(xid, tcon, fileHandle); | 474 | CIFSSMBClose(xid, tcon, fileHandle); |
@@ -726,7 +728,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
726 | } | 728 | } |
727 | 729 | ||
728 | cfile = cifs_new_fileinfo(newInode, fileHandle, filp, | 730 | cfile = cifs_new_fileinfo(newInode, fileHandle, filp, |
729 | nd->path.mnt, | 731 | nd->path.mnt, pTcon, |
730 | nd->intent.open.flags, | 732 | nd->intent.open.flags, |
731 | oplock); | 733 | oplock); |
732 | if (cfile == NULL) { | 734 | if (cfile == NULL) { |