aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/filemap.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 6343f3c841b7..7675b91f4f63 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1197,7 +1197,6 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
1197 1197
1198 mapping = filp->f_mapping; 1198 mapping = filp->f_mapping;
1199 inode = mapping->host; 1199 inode = mapping->host;
1200 retval = 0;
1201 if (!count) 1200 if (!count)
1202 goto out; /* skip atime */ 1201 goto out; /* skip atime */
1203 size = i_size_read(inode); 1202 size = i_size_read(inode);
@@ -1209,33 +1208,30 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
1209 } 1208 }
1210 if (retval > 0) 1209 if (retval > 0)
1211 *ppos = pos + retval; 1210 *ppos = pos + retval;
1212 } 1211 if (retval) {
1213 if (likely(retval != 0)) { 1212 file_accessed(filp);
1214 file_accessed(filp); 1213 goto out;
1215 goto out; 1214 }
1216 } 1215 }
1217 } 1216 }
1218 1217
1219 retval = 0; 1218 for (seg = 0; seg < nr_segs; seg++) {
1220 if (count) { 1219 read_descriptor_t desc;
1221 for (seg = 0; seg < nr_segs; seg++) {
1222 read_descriptor_t desc;
1223 1220
1224 desc.written = 0; 1221 desc.written = 0;
1225 desc.arg.buf = iov[seg].iov_base; 1222 desc.arg.buf = iov[seg].iov_base;
1226 desc.count = iov[seg].iov_len; 1223 desc.count = iov[seg].iov_len;
1227 if (desc.count == 0) 1224 if (desc.count == 0)
1228 continue; 1225 continue;
1229 desc.error = 0; 1226 desc.error = 0;
1230 do_generic_file_read(filp,ppos,&desc,file_read_actor); 1227 do_generic_file_read(filp, ppos, &desc, file_read_actor);
1231 retval += desc.written; 1228 retval += desc.written;
1232 if (desc.error) { 1229 if (desc.error) {
1233 retval = retval ?: desc.error; 1230 retval = retval ?: desc.error;
1234 break; 1231 break;
1235 }
1236 if (desc.count > 0)
1237 break;
1238 } 1232 }
1233 if (desc.count > 0)
1234 break;
1239 } 1235 }
1240out: 1236out:
1241 return retval; 1237 return retval;