diff options
author | Jeff Layton <jlayton@redhat.com> | 2010-10-15 15:33:58 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2010-10-17 21:04:16 -0400 |
commit | abfe1eedd682ea0f20e7035445982e6d371a2024 (patch) | |
tree | 70d5fe483cae0f782b8e78ea5c08ef2dbb45c2e7 /fs/cifs/dir.c | |
parent | f6a53460e2a105904deeada737b3f878d78517b3 (diff) |
cifs: eliminate the inode argument from cifs_new_fileinfo
It already takes a file pointer. The inode associated with that had damn
well better be the same one we're passing in anyway. Thus, there's no
need for a separate argument here.
Also, get rid of the bogus check for a null pCifsInode pointer. The
CIFS_I macro uses container_of(), and that will virtually never return a
NULL pointer anyway.
Finally, move the setting of the canCache* flags outside of the lock.
Other places in the code don't hold that lock when setting it, so I
assume it's not really needed here either.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Suresh Jayaraman <sjayaraman@suse.de>
Acked-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/dir.c')
-rw-r--r-- | fs/cifs/dir.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index ce1fa3027b23..36cf3e2ec252 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -131,12 +131,13 @@ cifs_bp_rename_retry: | |||
131 | } | 131 | } |
132 | 132 | ||
133 | struct cifsFileInfo * | 133 | struct cifsFileInfo * |
134 | cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, struct file *file, | 134 | cifs_new_fileinfo(__u16 fileHandle, struct file *file, |
135 | struct tcon_link *tlink, __u32 oplock) | 135 | struct tcon_link *tlink, __u32 oplock) |
136 | { | 136 | { |
137 | struct dentry *dentry = file->f_path.dentry; | 137 | struct dentry *dentry = file->f_path.dentry; |
138 | struct inode *inode = dentry->d_inode; | ||
139 | struct cifsInodeInfo *pCifsInode = CIFS_I(inode); | ||
138 | struct cifsFileInfo *pCifsFile; | 140 | struct cifsFileInfo *pCifsFile; |
139 | struct cifsInodeInfo *pCifsInode; | ||
140 | 141 | ||
141 | pCifsFile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); | 142 | pCifsFile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); |
142 | if (pCifsFile == NULL) | 143 | if (pCifsFile == NULL) |
@@ -158,24 +159,20 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, struct file *file, | |||
158 | 159 | ||
159 | write_lock(&GlobalSMBSeslock); | 160 | write_lock(&GlobalSMBSeslock); |
160 | list_add(&pCifsFile->tlist, &(tlink_tcon(tlink)->openFileList)); | 161 | list_add(&pCifsFile->tlist, &(tlink_tcon(tlink)->openFileList)); |
161 | pCifsInode = CIFS_I(newinode); | 162 | /* if readable file instance put first in list*/ |
162 | if (pCifsInode) { | 163 | if (file->f_mode & FMODE_READ) |
163 | /* if readable file instance put first in list*/ | 164 | list_add(&pCifsFile->flist, &pCifsInode->openFileList); |
164 | if (file->f_mode & FMODE_READ) | 165 | else |
165 | list_add(&pCifsFile->flist, &pCifsInode->openFileList); | 166 | list_add_tail(&pCifsFile->flist, &pCifsInode->openFileList); |
166 | else | ||
167 | list_add_tail(&pCifsFile->flist, | ||
168 | &pCifsInode->openFileList); | ||
169 | |||
170 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { | ||
171 | pCifsInode->clientCanCacheAll = true; | ||
172 | pCifsInode->clientCanCacheRead = true; | ||
173 | cFYI(1, "Exclusive Oplock inode %p", newinode); | ||
174 | } else if ((oplock & 0xF) == OPLOCK_READ) | ||
175 | pCifsInode->clientCanCacheRead = true; | ||
176 | } | ||
177 | write_unlock(&GlobalSMBSeslock); | 167 | write_unlock(&GlobalSMBSeslock); |
178 | 168 | ||
169 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { | ||
170 | pCifsInode->clientCanCacheAll = true; | ||
171 | pCifsInode->clientCanCacheRead = true; | ||
172 | cFYI(1, "Exclusive Oplock inode %p", inode); | ||
173 | } else if ((oplock & 0xF) == OPLOCK_READ) | ||
174 | pCifsInode->clientCanCacheRead = true; | ||
175 | |||
179 | file->private_data = pCifsFile; | 176 | file->private_data = pCifsFile; |
180 | 177 | ||
181 | return pCifsFile; | 178 | return pCifsFile; |
@@ -395,8 +392,7 @@ cifs_create_set_dentry: | |||
395 | goto cifs_create_out; | 392 | goto cifs_create_out; |
396 | } | 393 | } |
397 | 394 | ||
398 | pfile_info = cifs_new_fileinfo(newinode, fileHandle, filp, | 395 | pfile_info = cifs_new_fileinfo(fileHandle, filp, tlink, oplock); |
399 | tlink, oplock); | ||
400 | if (pfile_info == NULL) { | 396 | if (pfile_info == NULL) { |
401 | fput(filp); | 397 | fput(filp); |
402 | CIFSSMBClose(xid, tcon, fileHandle); | 398 | CIFSSMBClose(xid, tcon, fileHandle); |
@@ -669,8 +665,8 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
669 | goto lookup_out; | 665 | goto lookup_out; |
670 | } | 666 | } |
671 | 667 | ||
672 | cfile = cifs_new_fileinfo(newInode, fileHandle, filp, | 668 | cfile = cifs_new_fileinfo(fileHandle, filp, tlink, |
673 | tlink, oplock); | 669 | oplock); |
674 | if (cfile == NULL) { | 670 | if (cfile == NULL) { |
675 | fput(filp); | 671 | fput(filp); |
676 | CIFSSMBClose(xid, pTcon, fileHandle); | 672 | CIFSSMBClose(xid, pTcon, fileHandle); |