]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
cifs: make cifs_set_oplock_level() take a cifsInodeInfo pointer
authorPavel Shilovsky <piastryyy@gmail.com>
Wed, 3 Nov 2010 07:58:57 +0000 (10:58 +0300)
committerSteve French <sfrench@us.ibm.com>
Fri, 5 Nov 2010 17:39:01 +0000 (17:39 +0000)
All the callers already have a pointer to struct cifsInodeInfo. Use it.

Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/cifsfs.c
fs/cifs/cifsproto.h
fs/cifs/file.c
fs/cifs/misc.c

index 38526a6c4acf981a8e6d1aadceb00e7728d730b7..9c3789762ab7c4c92a7d67859c34b32cb196f1ab 100644 (file)
@@ -321,8 +321,7 @@ cifs_alloc_inode(struct super_block *sb)
        /* Until the file is open and we have gotten oplock
        info back from the server, can not assume caching of
        file data or metadata */
        /* Until the file is open and we have gotten oplock
        info back from the server, can not assume caching of
        file data or metadata */
-       cifs_inode->clientCanCacheRead = false;
-       cifs_inode->clientCanCacheAll = false;
+       cifs_set_oplock_level(cifs_inode, 0);
        cifs_inode->delete_pending = false;
        cifs_inode->invalid_mapping = false;
        cifs_inode->vfs_inode.i_blkbits = 14;  /* 2**14 = CIFS_MAX_MSGSIZE */
        cifs_inode->delete_pending = false;
        cifs_inode->invalid_mapping = false;
        cifs_inode->vfs_inode.i_blkbits = 14;  /* 2**14 = CIFS_MAX_MSGSIZE */
index 7f050f4fc3d94d898447731944f07dc80da2a9fb..7ed69b6b5fe6719f66ed5af0a0b38d2cda1aa352 100644 (file)
@@ -104,7 +104,7 @@ extern struct timespec cifs_NTtimeToUnix(__le64 utc_nanoseconds_since_1601);
 extern u64 cifs_UnixTimeToNT(struct timespec);
 extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time,
                                      int offset);
 extern u64 cifs_UnixTimeToNT(struct timespec);
 extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time,
                                      int offset);
-extern void cifs_set_oplock_level(struct inode *inode, __u32 oplock);
+extern void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock);
 
 extern struct cifsFileInfo *cifs_new_fileinfo(__u16 fileHandle,
                                struct file *file, struct tcon_link *tlink,
 
 extern struct cifsFileInfo *cifs_new_fileinfo(__u16 fileHandle,
                                struct file *file, struct tcon_link *tlink,
index 777e7f42b5b1cc63654691931df5cd0a64eb9e69..06c3e83fa387fecf63b93e33a0455dac6da45f6d 100644 (file)
@@ -146,7 +146,7 @@ client_can_cache:
                rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb,
                                         xid, NULL);
 
                rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb,
                                         xid, NULL);
 
-       cifs_set_oplock_level(inode, oplock);
+       cifs_set_oplock_level(pCifsInode, oplock);
 
        return rc;
 }
 
        return rc;
 }
@@ -248,7 +248,7 @@ cifs_new_fileinfo(__u16 fileHandle, struct file *file,
                list_add_tail(&pCifsFile->flist, &pCifsInode->openFileList);
        spin_unlock(&cifs_file_list_lock);
 
                list_add_tail(&pCifsFile->flist, &pCifsInode->openFileList);
        spin_unlock(&cifs_file_list_lock);
 
-       cifs_set_oplock_level(inode, oplock);
+       cifs_set_oplock_level(pCifsInode, oplock);
 
        file->private_data = pCifsFile;
        return pCifsFile;
 
        file->private_data = pCifsFile;
        return pCifsFile;
@@ -279,7 +279,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
        if (list_empty(&cifsi->openFileList)) {
                cFYI(1, "closing last open instance for inode %p",
                        cifs_file->dentry->d_inode);
        if (list_empty(&cifsi->openFileList)) {
                cFYI(1, "closing last open instance for inode %p",
                        cifs_file->dentry->d_inode);
-               cifs_set_oplock_level(inode, 0);
+               cifs_set_oplock_level(cifsi, 0);
        }
        spin_unlock(&cifs_file_list_lock);
 
        }
        spin_unlock(&cifs_file_list_lock);
 
@@ -611,7 +611,7 @@ reopen_success:
             we can not go to the server to get the new inod
             info */
 
             we can not go to the server to get the new inod
             info */
 
-       cifs_set_oplock_level(inode, oplock);
+       cifs_set_oplock_level(pCifsInode, oplock);
 
        cifs_relock_file(pCifsFile);
 
 
        cifs_relock_file(pCifsFile);
 
index d3b9ddebc17e4c0caa4d27ccba3365ed89298af2..43f10281bc19e80be48303e1bd9c974b4882cb37 100644 (file)
@@ -570,7 +570,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
                                cFYI(1, "file id match, oplock break");
                                pCifsInode = CIFS_I(netfile->dentry->d_inode);
 
                                cFYI(1, "file id match, oplock break");
                                pCifsInode = CIFS_I(netfile->dentry->d_inode);
 
-                               cifs_set_oplock_level(netfile->dentry->d_inode,
+                               cifs_set_oplock_level(pCifsInode,
                                                      pSMB->OplockLevel);
                                /*
                                 * cifs_oplock_break_put() can't be called
                                                      pSMB->OplockLevel);
                                /*
                                 * cifs_oplock_break_put() can't be called
@@ -722,18 +722,20 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
        }
 }
 
        }
 }
 
-void cifs_set_oplock_level(struct inode *inode, __u32 oplock)
+void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock)
 {
 {
-       struct cifsInodeInfo *cinode = CIFS_I(inode);
+       oplock &= 0xF;
 
 
-       if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
+       if (oplock == OPLOCK_EXCLUSIVE) {
                cinode->clientCanCacheAll = true;
                cinode->clientCanCacheRead = true;
                cinode->clientCanCacheAll = true;
                cinode->clientCanCacheRead = true;
-               cFYI(1, "Exclusive Oplock granted on inode %p", inode);
-       } else if ((oplock & 0xF) == OPLOCK_READ) {
+               cFYI(1, "Exclusive Oplock granted on inode %p",
+                    &cinode->vfs_inode);
+       } else if (oplock == OPLOCK_READ) {
                cinode->clientCanCacheAll = false;
                cinode->clientCanCacheRead = true;
                cinode->clientCanCacheAll = false;
                cinode->clientCanCacheRead = true;
-               cFYI(1, "Level II Oplock granted on inode %p", inode);
+               cFYI(1, "Level II Oplock granted on inode %p",
+                   &cinode->vfs_inode);
        } else {
                cinode->clientCanCacheAll = false;
                cinode->clientCanCacheRead = false;
        } else {
                cinode->clientCanCacheAll = false;
                cinode->clientCanCacheRead = false;