aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-04-02 14:47:20 -0400
committerSteve French <sfrench@us.ibm.com>2007-04-02 14:47:20 -0400
commitc33f8d32746db12ba353b0a05b25f7893a0ac344 (patch)
tree874d9ae5afa5c1d1688105974b7ef8e8c3335302 /fs/cifs/file.c
parent2e175a90047a2dbc76fde169c990164895b25dfc (diff)
[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 <hch@lst.de> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c29
1 files changed, 2 insertions, 27 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 2d3275bedb55..914b449f202e 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,
792 int xid, long_op; 792 int xid, long_op;
793 struct cifsFileInfo *open_file; 793 struct cifsFileInfo *open_file;
794 794
795 if (file->f_path.dentry == NULL)
796 return -EBADF;
797
798 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 795 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
799 if (cifs_sb == NULL)
800 return -EBADF;
801 796
802 pTcon = cifs_sb->tcon; 797 pTcon = cifs_sb->tcon;
803 798
@@ -807,14 +802,9 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
807 802
808 if (file->private_data == NULL) 803 if (file->private_data == NULL)
809 return -EBADF; 804 return -EBADF;
810 else 805 open_file = (struct cifsFileInfo *) file->private_data;
811 open_file = (struct cifsFileInfo *) file->private_data;
812 806
813 xid = GetXid(); 807 xid = GetXid();
814 if (file->f_path.dentry->d_inode == NULL) {
815 FreeXid(xid);
816 return -EBADF;
817 }
818 808
819 if (*poffset > file->f_path.dentry->d_inode->i_size) 809 if (*poffset > file->f_path.dentry->d_inode->i_size)
820 long_op = 2; /* writes past end of file can take a long time */ 810 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,
908 int xid, long_op; 898 int xid, long_op;
909 struct cifsFileInfo *open_file; 899 struct cifsFileInfo *open_file;
910 900
911 if (file->f_path.dentry == NULL)
912 return -EBADF;
913
914 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 901 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
915 if (cifs_sb == NULL)
916 return -EBADF;
917 902
918 pTcon = cifs_sb->tcon; 903 pTcon = cifs_sb->tcon;
919 904
@@ -922,14 +907,9 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
922 907
923 if (file->private_data == NULL) 908 if (file->private_data == NULL)
924 return -EBADF; 909 return -EBADF;
925 else 910 open_file = (struct cifsFileInfo *)file->private_data;
926 open_file = (struct cifsFileInfo *)file->private_data;
927 911
928 xid = GetXid(); 912 xid = GetXid();
929 if (file->f_path.dentry->d_inode == NULL) {
930 FreeXid(xid);
931 return -EBADF;
932 }
933 913
934 if (*poffset > file->f_path.dentry->d_inode->i_size) 914 if (*poffset > file->f_path.dentry->d_inode->i_size)
935 long_op = 2; /* writes past end of file can take a long time */ 915 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,
957 return -EBADF; 937 return -EBADF;
958 } 938 }
959 if (open_file->invalidHandle) { 939 if (open_file->invalidHandle) {
960 if ((file->f_path.dentry == NULL) ||
961 (file->f_path.dentry->d_inode == NULL)) {
962 FreeXid(xid);
963 return total_written;
964 }
965 /* we could deadlock if we called 940 /* we could deadlock if we called
966 filemap_fdatawait from here so tell 941 filemap_fdatawait from here so tell
967 reopen_file not to flush data to 942 reopen_file not to flush data to