Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c33f8d32746db12ba353b0a05b25f7893a0ac344
Commit:     c33f8d32746db12ba353b0a05b25f7893a0ac344
Parent:     2e175a90047a2dbc76fde169c990164895b25dfc
Author:     Christoph Hellwig <[EMAIL PROTECTED]>
AuthorDate: Mon Apr 2 18:47:20 2007 +0000
Committer:  Steve French <[EMAIL PROTECTED]>
CommitDate: Mon Apr 2 18:47:20 2007 +0000

    [CIFS] Remove unnecessary checks
    
    file->f_path.dentry or file->f_path.dentry.d_inode can't be NULL since at
    least ten years, similar for all but very few arguments passed in from the
    VFS.
    
    Signed-off-by: Christoph Hellwig <[EMAIL PROTECTED]>
    Signed-off-by: Steve French <[EMAIL PROTECTED]>
---
 fs/cifs/cifsfs.c  |    3 +--
 fs/cifs/file.c    |   29 ++---------------------------
 fs/cifs/readdir.c |   27 +++------------------------
 3 files changed, 6 insertions(+), 53 deletions(-)

diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index faba4d6..dd03e68 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -529,8 +529,7 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, 
int origin)
                /* some applications poll for the file length in this strange
                   way so we must seek to end on non-oplocked files by
                   setting the revalidate time to zero */
-               if(file->f_path.dentry->d_inode)                
-                       CIFS_I(file->f_path.dentry->d_inode)->time = 0;
+               CIFS_I(file->f_path.dentry->d_inode)->time = 0;
 
                retval = cifs_revalidate(file->f_path.dentry);
                if (retval < 0)
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 2d3275b..914b449 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -792,12 +792,7 @@ ssize_t cifs_user_write(struct file *file, const char 
__user *write_data,
        int xid, long_op;
        struct cifsFileInfo *open_file;
 
-       if (file->f_path.dentry == NULL)
-               return -EBADF;
-
        cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
-       if (cifs_sb == NULL)
-               return -EBADF;
 
        pTcon = cifs_sb->tcon;
 
@@ -807,14 +802,9 @@ ssize_t cifs_user_write(struct file *file, const char 
__user *write_data,
 
        if (file->private_data == NULL)
                return -EBADF;
-       else
-               open_file = (struct cifsFileInfo *) file->private_data;
+       open_file = (struct cifsFileInfo *) file->private_data;
        
        xid = GetXid();
-       if (file->f_path.dentry->d_inode == NULL) {
-               FreeXid(xid);
-               return -EBADF;
-       }
 
        if (*poffset > file->f_path.dentry->d_inode->i_size)
                long_op = 2; /* writes past end of file can take a long time */
@@ -908,12 +898,7 @@ static ssize_t cifs_write(struct file *file, const char 
*write_data,
        int xid, long_op;
        struct cifsFileInfo *open_file;
 
-       if (file->f_path.dentry == NULL)
-               return -EBADF;
-
        cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
-       if (cifs_sb == NULL)
-               return -EBADF;
 
        pTcon = cifs_sb->tcon;
 
@@ -922,14 +907,9 @@ static ssize_t cifs_write(struct file *file, const char 
*write_data,
 
        if (file->private_data == NULL)
                return -EBADF;
-       else
-               open_file = (struct cifsFileInfo *)file->private_data;
+       open_file = (struct cifsFileInfo *)file->private_data;
        
        xid = GetXid();
-       if (file->f_path.dentry->d_inode == NULL) {
-               FreeXid(xid);
-               return -EBADF;
-       }
 
        if (*poffset > file->f_path.dentry->d_inode->i_size)
                long_op = 2; /* writes past end of file can take a long time */
@@ -957,11 +937,6 @@ static ssize_t cifs_write(struct file *file, const char 
*write_data,
                                        return -EBADF;
                        }
                        if (open_file->invalidHandle) {
-                               if ((file->f_path.dentry == NULL) ||
-                                  (file->f_path.dentry->d_inode == NULL)) {
-                                       FreeXid(xid);
-                                       return total_written;
-                               }
                                /* we could deadlock if we called
                                   filemap_fdatawait from here so tell
                                   reopen_file not to flush data to 
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 2a374d5..3fab8ed 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -444,9 +444,6 @@ static int initiate_cifs_search(const int xid, struct file 
*file)
        cifsFile->invalidHandle = TRUE;
        cifsFile->srch_inf.endOfSearch = FALSE;
 
-       if(file->f_path.dentry == NULL)
-               return -ENOENT;
-
        cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
        if(cifs_sb == NULL)
                return -EINVAL;
@@ -618,20 +615,10 @@ static int cifs_entry_is_dot(char *current_entry, struct 
cifsFileInfo *cfile)
    whether we can use the cached search results from the previous search */
 static int is_dir_changed(struct file * file)
 {
-       struct inode * inode;
-       struct cifsInodeInfo *cifsInfo;
-
-       if(file->f_path.dentry == NULL)
-               return 0;
-
-       inode = file->f_path.dentry->d_inode;
-
-       if(inode == NULL)
-               return 0;
-
-       cifsInfo = CIFS_I(inode);
+       struct inode *inode = file->f_path.dentry->d_inode;
+       struct cifsInodeInfo *cifsInfo = CIFS_I(inode);
 
-       if(cifsInfo->time == 0)
+       if (cifsInfo->time == 0)
                return 1; /* directory was changed, perhaps due to unlink */
        else
                return 0;
@@ -851,9 +838,6 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
        if((scratch_buf == NULL) || (pfindEntry == NULL) || (pCifsF == NULL))
                return -ENOENT;
 
-       if(file->f_path.dentry == NULL)
-               return -ENOENT;
-
        rc = cifs_entry_is_dot(pfindEntry,pCifsF);
        /* skip . and .. since we added them first */
        if(rc != 0) 
@@ -997,11 +981,6 @@ int cifs_readdir(struct file *file, void *direntry, 
filldir_t filldir)
 
        xid = GetXid();
 
-       if(file->f_path.dentry == NULL) {
-               FreeXid(xid);
-               return -EIO;
-       }
-
        cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
        pTcon = cifs_sb->tcon;
        if(pTcon == NULL)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to