struct extent_buffer *eb;
struct page *p;
struct address_space *mapping = tree->mapping;
- int uptodate = 0;
+ int uptodate = 1;
eb = __alloc_extent_buffer(tree, start, len, mask);
if (!eb || IS_ERR(eb))
*/
if ((i == 0 && (eb->start & (PAGE_CACHE_SIZE - 1))) ||
((i == num_pages - 1) &&
- ((eb->start + eb->len - 1) & (PAGE_CACHE_SIZE - 1)))) {
+ ((eb->start + eb->len) & (PAGE_CACHE_SIZE - 1)))) {
start = page->index << PAGE_CACHE_SHIFT;
end = start + PAGE_CACHE_SIZE - 1;
if (test_range_bit(tree, start, end,
page = extent_buffer_page(eb, i);
if ((i == 0 && (eb->start & (PAGE_CACHE_SIZE - 1))) ||
((i == num_pages - 1) &&
- ((eb->start + eb->len - 1) & (PAGE_CACHE_SIZE - 1)))) {
+ ((eb->start + eb->len) & (PAGE_CACHE_SIZE - 1)))) {
check_page_uptodate(tree, page);
continue;
}
struct page *p;
size_t start_offset = eb->start & ((u64)PAGE_CACHE_SIZE - 1);
unsigned long i = (start_offset + start) >> PAGE_CACHE_SHIFT;
- unsigned long end_i = (start_offset + start + min_len) >>
+ unsigned long end_i = (start_offset + start + min_len - 1) >>
PAGE_CACHE_SHIFT;
if (i != end_i)
offset = 0;
*map_start = (i << PAGE_CACHE_SHIFT) - start_offset;
}
- if (start + min_len >= eb->len) {
+ if (start + min_len > eb->len) {
printk("bad mapping eb start %Lu len %lu, wanted %lu %lu\n", eb->start, eb->len, start, min_len);
WARN_ON(1);
}