aboutsummaryrefslogtreecommitdiffstats
path: root/fs/direct-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/direct-io.c')
-rw-r--r--fs/direct-io.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 98040ba388ac..194d0d122cae 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -198,9 +198,8 @@ static inline int dio_refill_pages(struct dio *dio, struct dio_submit *sdio)
198 * L1 cache. 198 * L1 cache.
199 */ 199 */
200static inline struct page *dio_get_page(struct dio *dio, 200static inline struct page *dio_get_page(struct dio *dio,
201 struct dio_submit *sdio, size_t *from, size_t *to) 201 struct dio_submit *sdio)
202{ 202{
203 int n;
204 if (dio_pages_present(sdio) == 0) { 203 if (dio_pages_present(sdio) == 0) {
205 int ret; 204 int ret;
206 205
@@ -209,10 +208,7 @@ static inline struct page *dio_get_page(struct dio *dio,
209 return ERR_PTR(ret); 208 return ERR_PTR(ret);
210 BUG_ON(dio_pages_present(sdio) == 0); 209 BUG_ON(dio_pages_present(sdio) == 0);
211 } 210 }
212 n = sdio->head++; 211 return dio->pages[sdio->head];
213 *from = n ? 0 : sdio->from;
214 *to = (n == sdio->tail - 1) ? sdio->to : PAGE_SIZE;
215 return dio->pages[n];
216} 212}
217 213
218/** 214/**
@@ -911,11 +907,15 @@ static int do_direct_IO(struct dio *dio, struct dio_submit *sdio,
911 while (sdio->block_in_file < sdio->final_block_in_request) { 907 while (sdio->block_in_file < sdio->final_block_in_request) {
912 struct page *page; 908 struct page *page;
913 size_t from, to; 909 size_t from, to;
914 page = dio_get_page(dio, sdio, &from, &to); 910
911 page = dio_get_page(dio, sdio);
915 if (IS_ERR(page)) { 912 if (IS_ERR(page)) {
916 ret = PTR_ERR(page); 913 ret = PTR_ERR(page);
917 goto out; 914 goto out;
918 } 915 }
916 from = sdio->head ? 0 : sdio->from;
917 to = (sdio->head == sdio->tail - 1) ? sdio->to : PAGE_SIZE;
918 sdio->head++;
919 919
920 while (from < to) { 920 while (from < to) {
921 unsigned this_chunk_bytes; /* # of bytes mapped */ 921 unsigned this_chunk_bytes; /* # of bytes mapped */