Messages in this thread Patch in this message | | | From | Joonsoo Kim <> | Subject | [RFC PATCH 4/5] readahead: remove end range check | Date | Wed, 3 Jul 2013 17:34:19 +0900 |
| |
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
diff --git a/mm/readahead.c b/mm/readahead.c index daed28d..3932f28 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -166,6 +166,8 @@ __do_page_cache_readahead(struct address_space *mapping, struct file *filp, goto out; end_index = ((isize - 1) >> PAGE_CACHE_SHIFT); + if (offset + nr_to_read > end_index + 1) + nr_to_read = end_index - offset + 1; /* * Preallocate as many pages as we will need. @@ -173,9 +175,6 @@ __do_page_cache_readahead(struct address_space *mapping, struct file *filp, for (page_idx = 0; page_idx < nr_to_read; page_idx++) { pgoff_t page_offset = offset + page_idx; - if (page_offset > end_index) - break; - rcu_read_lock(); page = radix_tree_lookup(&mapping->page_tree, page_offset); rcu_read_unlock(); -- 1.7.9.5
| |