Commit db460242 authored by Jeff Layton's avatar Jeff Layton

cifs: clean up arguments to cifs_open_inode_helper

...which takes a ton of unneeded arguments and does a lot more pointer
dereferencing than is really needed.
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Reviewed-and-Tested-by: default avatarSuresh Jayaraman <sjayaraman@suse.de>
parent 6ca9f3ba
...@@ -163,11 +163,11 @@ cifs_posix_open_inode_helper(struct inode *inode, struct file *file, ...@@ -163,11 +163,11 @@ cifs_posix_open_inode_helper(struct inode *inode, struct file *file,
} }
/* all arguments to this function must be checked for validity in caller */ /* all arguments to this function must be checked for validity in caller */
static inline int cifs_open_inode_helper(struct inode *inode, struct file *file, static inline int cifs_open_inode_helper(struct inode *inode,
struct cifsInodeInfo *pCifsInode, struct cifsFileInfo *pCifsFile,
struct cifsTconInfo *pTcon, int *oplock, FILE_ALL_INFO *buf, struct cifsTconInfo *pTcon, int *oplock, FILE_ALL_INFO *buf,
char *full_path, int xid) char *full_path, int xid)
{ {
struct cifsInodeInfo *pCifsInode = CIFS_I(inode);
struct timespec temp; struct timespec temp;
int rc; int rc;
...@@ -181,36 +181,35 @@ static inline int cifs_open_inode_helper(struct inode *inode, struct file *file, ...@@ -181,36 +181,35 @@ static inline int cifs_open_inode_helper(struct inode *inode, struct file *file,
/* if not oplocked, invalidate inode pages if mtime or file /* if not oplocked, invalidate inode pages if mtime or file
size changed */ size changed */
temp = cifs_NTtimeToUnix(buf->LastWriteTime); temp = cifs_NTtimeToUnix(buf->LastWriteTime);
if (timespec_equal(&file->f_path.dentry->d_inode->i_mtime, &temp) && if (timespec_equal(&inode->i_mtime, &temp) &&
(file->f_path.dentry->d_inode->i_size == (inode->i_size ==
(loff_t)le64_to_cpu(buf->EndOfFile))) { (loff_t)le64_to_cpu(buf->EndOfFile))) {
cFYI(1, "inode unchanged on server"); cFYI(1, "inode unchanged on server");
} else { } else {
if (file->f_path.dentry->d_inode->i_mapping) { if (inode->i_mapping) {
/* BB no need to lock inode until after invalidate /* BB no need to lock inode until after invalidate
since namei code should already have it locked? */ since namei code should already have it locked? */
rc = filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping); rc = filemap_write_and_wait(inode->i_mapping);
if (rc != 0) if (rc != 0)
CIFS_I(file->f_path.dentry->d_inode)->write_behind_rc = rc; pCifsInode->write_behind_rc = rc;
} }
cFYI(1, "invalidating remote inode since open detected it " cFYI(1, "invalidating remote inode since open detected it "
"changed"); "changed");
invalidate_remote_inode(file->f_path.dentry->d_inode); invalidate_remote_inode(inode);
} }
client_can_cache: client_can_cache:
if (pTcon->unix_ext) if (pTcon->unix_ext)
rc = cifs_get_inode_info_unix(&file->f_path.dentry->d_inode, rc = cifs_get_inode_info_unix(&inode, full_path, inode->i_sb,
full_path, inode->i_sb, xid); xid);
else else
rc = cifs_get_inode_info(&file->f_path.dentry->d_inode, rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb,
full_path, buf, inode->i_sb, xid, NULL); xid, NULL);
if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) { if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) {
pCifsInode->clientCanCacheAll = true; pCifsInode->clientCanCacheAll = true;
pCifsInode->clientCanCacheRead = true; pCifsInode->clientCanCacheRead = true;
cFYI(1, "Exclusive Oplock granted on inode %p", cFYI(1, "Exclusive Oplock granted on inode %p", inode);
file->f_path.dentry->d_inode);
} else if ((*oplock & 0xF) == OPLOCK_READ) } else if ((*oplock & 0xF) == OPLOCK_READ)
pCifsInode->clientCanCacheRead = true; pCifsInode->clientCanCacheRead = true;
...@@ -367,8 +366,7 @@ int cifs_open(struct inode *inode, struct file *file) ...@@ -367,8 +366,7 @@ int cifs_open(struct inode *inode, struct file *file)
goto out; goto out;
} }
rc = cifs_open_inode_helper(inode, file, pCifsInode, pCifsFile, tcon, rc = cifs_open_inode_helper(inode, tcon, &oplock, buf, full_path, xid);
&oplock, buf, full_path, xid);
if (oplock & CIFS_CREATE_ACTION) { if (oplock & CIFS_CREATE_ACTION) {
/* time to set mode which we can not set earlier due to /* time to set mode which we can not set earlier due to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment