while(!list_empty(&tree->buffer_lru)) {
eb = list_entry(tree->buffer_lru.next, struct extent_buffer,
lru);
- list_del(&eb->lru);
+ list_del_init(&eb->lru);
free_extent_buffer(eb);
}
}
node = tree_search(&tree->state, start);
while (node && start <= end) {
state = rb_entry(node, struct extent_state, rb_node);
- if (state->start > end)
- break;
if (filled && state->start > start) {
bitset = 0;
break;
}
+
+ if (state->start > end)
+ break;
+
if (state->state & bits) {
bitset = 1;
if (!filled)
page_cache_get(page0);
mark_page_accessed(page0);
set_page_extent_mapped(page0);
+ WARN_ON(!PageUptodate(page0));
set_page_private(page0, EXTENT_PAGE_PRIVATE_FIRST_PAGE |
len << 2);
} else {
spin_unlock(&tree->lru_lock);
if (!atomic_dec_and_test(&eb->refs))
return NULL;
- for (index = 0; index < i; index++) {
+ for (index = 1; index < i; index++) {
page_cache_release(extent_buffer_page(eb, index));
}
+ if (i > 0)
+ page_cache_release(extent_buffer_page(eb, 0));
__free_extent_buffer(eb);
return NULL;
}
spin_unlock(&tree->lru_lock);
if (!atomic_dec_and_test(&eb->refs))
return NULL;
- for (index = 0; index < i; index++) {
+ for (index = 1; index < i; index++) {
page_cache_release(extent_buffer_page(eb, index));
}
+ if (i > 0)
+ page_cache_release(extent_buffer_page(eb, 0));
__free_extent_buffer(eb);
return NULL;
}
if (!atomic_dec_and_test(&eb->refs))
return;
+ WARN_ON(!list_empty(&eb->lru));
num_pages = num_extent_pages(eb->start, eb->len);
- for (i = 0; i < num_pages; i++) {
+ for (i = 1; i < num_pages; i++) {
page_cache_release(extent_buffer_page(eb, i));
}
+ page_cache_release(extent_buffer_page(eb, 0));
__free_extent_buffer(eb);
}
EXPORT_SYMBOL(free_extent_buffer);
EXTENT_UPTODATE, 1)) {
return 0;
}
+
if (start) {
WARN_ON(start < eb->start);
start_i = (start >> PAGE_CACHE_SHIFT) -
*map_start = 0;
} else {
offset = 0;
- *map_start = (i << PAGE_CACHE_SHIFT) - start_offset;
+ *map_start = ((u64)i << PAGE_CACHE_SHIFT) - start_offset;
}
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);