diff options
author | Zach Brown <zach.brown@oracle.com> | 2005-09-30 14:58:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-30 15:41:17 -0400 |
commit | 353fb07e2043d2df12dddf4e2c39552d0ab9b026 (patch) | |
tree | a93c6f5a88bf9c7382ccc7a08424e58ed1fec2e3 | |
parent | 897f15fb587fd2772b9e7ff6ec0265057f3c3975 (diff) |
[PATCH] aio: avoid extra aio_{read,write} call when ki_left == 0
Recently aio_p{read,write} changed to perform retries internally rather
than returning -EIOCBRETRY. This inadvertantly resulted in always calling
aio_{read,write} with ki_left at 0 which would in turn immediately return
0. Harmless, but we can avoid this call by checking in the caller.
Signed-off-by: Zach Brown <zach.brown@oracle.com>
Signed-off-by: Benjamin LaHaise <bcrl@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/aio.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1347,7 +1347,7 @@ static ssize_t aio_pread(struct kiocb *iocb) | |||
1347 | * regular files we retry till we complete the entire read or | 1347 | * regular files we retry till we complete the entire read or |
1348 | * find that we can't read any more data (e.g short reads). | 1348 | * find that we can't read any more data (e.g short reads). |
1349 | */ | 1349 | */ |
1350 | } while (ret > 0 && | 1350 | } while (ret > 0 && iocb->ki_left > 0 && |
1351 | !S_ISFIFO(inode->i_mode) && !S_ISSOCK(inode->i_mode)); | 1351 | !S_ISFIFO(inode->i_mode) && !S_ISSOCK(inode->i_mode)); |
1352 | 1352 | ||
1353 | /* This means we must have transferred all that we could */ | 1353 | /* This means we must have transferred all that we could */ |
@@ -1371,7 +1371,7 @@ static ssize_t aio_pwrite(struct kiocb *iocb) | |||
1371 | iocb->ki_buf += ret; | 1371 | iocb->ki_buf += ret; |
1372 | iocb->ki_left -= ret; | 1372 | iocb->ki_left -= ret; |
1373 | } | 1373 | } |
1374 | } while (ret > 0); | 1374 | } while (ret > 0 && iocb->ki_left > 0); |
1375 | 1375 | ||
1376 | if ((ret == 0) || (iocb->ki_left == 0)) | 1376 | if ((ret == 0) || (iocb->ki_left == 0)) |
1377 | ret = iocb->ki_nbytes - iocb->ki_left; | 1377 | ret = iocb->ki_nbytes - iocb->ki_left; |