diff options
author | Jeff Layton <jlayton@redhat.com> | 2011-01-11 07:24:23 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2011-01-20 13:07:55 -0500 |
commit | 7749981ec31aa40e28a1ef5687e46bc1aa278fae (patch) | |
tree | 7c5f75916f55cfe5130e88534c48678155974adf /fs/cifs/file.c | |
parent | fda3594362184383e73f0a2a5fa5b38ac0e04fd8 (diff) |
cifs: remove code for setting timeouts on requests
Since we don't time out individual requests anymore, remove the code
that we used to use for setting timeouts on different requests.
Reviewed-by: Pavel Shilovsky <piastryyy@gmail.com>
Reviewed-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r-- | fs/cifs/file.c | 44 |
1 files changed, 7 insertions, 37 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index cfa2e5ebcafe..bd2a028af833 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -839,29 +839,6 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
839 | return rc; | 839 | return rc; |
840 | } | 840 | } |
841 | 841 | ||
842 | /* | ||
843 | * Set the timeout on write requests past EOF. For some servers (Windows) | ||
844 | * these calls can be very long. | ||
845 | * | ||
846 | * If we're writing >10M past the EOF we give a 180s timeout. Anything less | ||
847 | * than that gets a 45s timeout. Writes not past EOF get 15s timeouts. | ||
848 | * The 10M cutoff is totally arbitrary. A better scheme for this would be | ||
849 | * welcome if someone wants to suggest one. | ||
850 | * | ||
851 | * We may be able to do a better job with this if there were some way to | ||
852 | * declare that a file should be sparse. | ||
853 | */ | ||
854 | static int | ||
855 | cifs_write_timeout(struct cifsInodeInfo *cifsi, loff_t offset) | ||
856 | { | ||
857 | if (offset <= cifsi->server_eof) | ||
858 | return CIFS_STD_OP; | ||
859 | else if (offset > (cifsi->server_eof + (10 * 1024 * 1024))) | ||
860 | return CIFS_VLONG_OP; | ||
861 | else | ||
862 | return CIFS_LONG_OP; | ||
863 | } | ||
864 | |||
865 | /* update the file size (if needed) after a write */ | 842 | /* update the file size (if needed) after a write */ |
866 | static void | 843 | static void |
867 | cifs_update_eof(struct cifsInodeInfo *cifsi, loff_t offset, | 844 | cifs_update_eof(struct cifsInodeInfo *cifsi, loff_t offset, |
@@ -882,7 +859,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data, | |||
882 | unsigned int total_written; | 859 | unsigned int total_written; |
883 | struct cifs_sb_info *cifs_sb; | 860 | struct cifs_sb_info *cifs_sb; |
884 | struct cifsTconInfo *pTcon; | 861 | struct cifsTconInfo *pTcon; |
885 | int xid, long_op; | 862 | int xid; |
886 | struct cifsFileInfo *open_file; | 863 | struct cifsFileInfo *open_file; |
887 | struct cifsInodeInfo *cifsi = CIFS_I(inode); | 864 | struct cifsInodeInfo *cifsi = CIFS_I(inode); |
888 | 865 | ||
@@ -903,7 +880,6 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data, | |||
903 | 880 | ||
904 | xid = GetXid(); | 881 | xid = GetXid(); |
905 | 882 | ||
906 | long_op = cifs_write_timeout(cifsi, *poffset); | ||
907 | for (total_written = 0; write_size > total_written; | 883 | for (total_written = 0; write_size > total_written; |
908 | total_written += bytes_written) { | 884 | total_written += bytes_written) { |
909 | rc = -EAGAIN; | 885 | rc = -EAGAIN; |
@@ -931,7 +907,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data, | |||
931 | min_t(const int, cifs_sb->wsize, | 907 | min_t(const int, cifs_sb->wsize, |
932 | write_size - total_written), | 908 | write_size - total_written), |
933 | *poffset, &bytes_written, | 909 | *poffset, &bytes_written, |
934 | NULL, write_data + total_written, long_op); | 910 | NULL, write_data + total_written, 0); |
935 | } | 911 | } |
936 | if (rc || (bytes_written == 0)) { | 912 | if (rc || (bytes_written == 0)) { |
937 | if (total_written) | 913 | if (total_written) |
@@ -944,8 +920,6 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data, | |||
944 | cifs_update_eof(cifsi, *poffset, bytes_written); | 920 | cifs_update_eof(cifsi, *poffset, bytes_written); |
945 | *poffset += bytes_written; | 921 | *poffset += bytes_written; |
946 | } | 922 | } |
947 | long_op = CIFS_STD_OP; /* subsequent writes fast - | ||
948 | 15 seconds is plenty */ | ||
949 | } | 923 | } |
950 | 924 | ||
951 | cifs_stats_bytes_written(pTcon, total_written); | 925 | cifs_stats_bytes_written(pTcon, total_written); |
@@ -974,7 +948,7 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file, | |||
974 | unsigned int total_written; | 948 | unsigned int total_written; |
975 | struct cifs_sb_info *cifs_sb; | 949 | struct cifs_sb_info *cifs_sb; |
976 | struct cifsTconInfo *pTcon; | 950 | struct cifsTconInfo *pTcon; |
977 | int xid, long_op; | 951 | int xid; |
978 | struct dentry *dentry = open_file->dentry; | 952 | struct dentry *dentry = open_file->dentry; |
979 | struct cifsInodeInfo *cifsi = CIFS_I(dentry->d_inode); | 953 | struct cifsInodeInfo *cifsi = CIFS_I(dentry->d_inode); |
980 | 954 | ||
@@ -987,7 +961,6 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file, | |||
987 | 961 | ||
988 | xid = GetXid(); | 962 | xid = GetXid(); |
989 | 963 | ||
990 | long_op = cifs_write_timeout(cifsi, *poffset); | ||
991 | for (total_written = 0; write_size > total_written; | 964 | for (total_written = 0; write_size > total_written; |
992 | total_written += bytes_written) { | 965 | total_written += bytes_written) { |
993 | rc = -EAGAIN; | 966 | rc = -EAGAIN; |
@@ -1017,7 +990,7 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file, | |||
1017 | rc = CIFSSMBWrite2(xid, pTcon, | 990 | rc = CIFSSMBWrite2(xid, pTcon, |
1018 | open_file->netfid, len, | 991 | open_file->netfid, len, |
1019 | *poffset, &bytes_written, | 992 | *poffset, &bytes_written, |
1020 | iov, 1, long_op); | 993 | iov, 1, 0); |
1021 | } else | 994 | } else |
1022 | rc = CIFSSMBWrite(xid, pTcon, | 995 | rc = CIFSSMBWrite(xid, pTcon, |
1023 | open_file->netfid, | 996 | open_file->netfid, |
@@ -1025,7 +998,7 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file, | |||
1025 | write_size - total_written), | 998 | write_size - total_written), |
1026 | *poffset, &bytes_written, | 999 | *poffset, &bytes_written, |
1027 | write_data + total_written, | 1000 | write_data + total_written, |
1028 | NULL, long_op); | 1001 | NULL, 0); |
1029 | } | 1002 | } |
1030 | if (rc || (bytes_written == 0)) { | 1003 | if (rc || (bytes_written == 0)) { |
1031 | if (total_written) | 1004 | if (total_written) |
@@ -1038,8 +1011,6 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file, | |||
1038 | cifs_update_eof(cifsi, *poffset, bytes_written); | 1011 | cifs_update_eof(cifsi, *poffset, bytes_written); |
1039 | *poffset += bytes_written; | 1012 | *poffset += bytes_written; |
1040 | } | 1013 | } |
1041 | long_op = CIFS_STD_OP; /* subsequent writes fast - | ||
1042 | 15 seconds is plenty */ | ||
1043 | } | 1014 | } |
1044 | 1015 | ||
1045 | cifs_stats_bytes_written(pTcon, total_written); | 1016 | cifs_stats_bytes_written(pTcon, total_written); |
@@ -1239,7 +1210,7 @@ static int cifs_writepages(struct address_space *mapping, | |||
1239 | struct pagevec pvec; | 1210 | struct pagevec pvec; |
1240 | int rc = 0; | 1211 | int rc = 0; |
1241 | int scanned = 0; | 1212 | int scanned = 0; |
1242 | int xid, long_op; | 1213 | int xid; |
1243 | 1214 | ||
1244 | cifs_sb = CIFS_SB(mapping->host->i_sb); | 1215 | cifs_sb = CIFS_SB(mapping->host->i_sb); |
1245 | 1216 | ||
@@ -1384,11 +1355,10 @@ retry_write: | |||
1384 | cERROR(1, "No writable handles for inode"); | 1355 | cERROR(1, "No writable handles for inode"); |
1385 | rc = -EBADF; | 1356 | rc = -EBADF; |
1386 | } else { | 1357 | } else { |
1387 | long_op = cifs_write_timeout(cifsi, offset); | ||
1388 | rc = CIFSSMBWrite2(xid, tcon, open_file->netfid, | 1358 | rc = CIFSSMBWrite2(xid, tcon, open_file->netfid, |
1389 | bytes_to_write, offset, | 1359 | bytes_to_write, offset, |
1390 | &bytes_written, iov, n_iov, | 1360 | &bytes_written, iov, n_iov, |
1391 | long_op); | 1361 | 0); |
1392 | cifsFileInfo_put(open_file); | 1362 | cifsFileInfo_put(open_file); |
1393 | } | 1363 | } |
1394 | 1364 | ||