btrfs: use only inline_pages from extent buffer
The nodesize is capped at 64k and there are enough pages preallocated in extent_buffer::inline_pages. The fallback to kmalloc never happened because even on the smallest page size considered (4k) inline_pages covered the needs. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
This commit is contained in:
parent
c58aaad2ac
commit
b8dae31388
|
@ -3981,8 +3981,6 @@ static void __free_extent_buffer(struct extent_buffer *eb)
|
||||||
list_del(&eb->leak_list);
|
list_del(&eb->leak_list);
|
||||||
spin_unlock_irqrestore(&leak_lock, flags);
|
spin_unlock_irqrestore(&leak_lock, flags);
|
||||||
#endif
|
#endif
|
||||||
if (eb->pages && eb->pages != eb->inline_pages)
|
|
||||||
kfree(eb->pages);
|
|
||||||
kmem_cache_free(extent_buffer_cache, eb);
|
kmem_cache_free(extent_buffer_cache, eb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4023,19 +4021,12 @@ static struct extent_buffer *__alloc_extent_buffer(struct extent_io_tree *tree,
|
||||||
atomic_set(&eb->refs, 1);
|
atomic_set(&eb->refs, 1);
|
||||||
atomic_set(&eb->io_pages, 0);
|
atomic_set(&eb->io_pages, 0);
|
||||||
|
|
||||||
if (len > MAX_INLINE_EXTENT_BUFFER_SIZE) {
|
/*
|
||||||
struct page **pages;
|
* Sanity checks, currently the maximum is 64k covered by 16x 4k pages
|
||||||
int num_pages = (len + PAGE_CACHE_SIZE - 1) >>
|
*/
|
||||||
PAGE_CACHE_SHIFT;
|
BUILD_BUG_ON(BTRFS_MAX_METADATA_BLOCKSIZE
|
||||||
pages = kzalloc(num_pages, mask);
|
> MAX_INLINE_EXTENT_BUFFER_SIZE);
|
||||||
if (!pages) {
|
BUG_ON(len > MAX_INLINE_EXTENT_BUFFER_SIZE);
|
||||||
__free_extent_buffer(eb);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
eb->pages = pages;
|
|
||||||
} else {
|
|
||||||
eb->pages = eb->inline_pages;
|
|
||||||
}
|
|
||||||
|
|
||||||
return eb;
|
return eb;
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,8 +158,7 @@ struct extent_buffer {
|
||||||
*/
|
*/
|
||||||
wait_queue_head_t read_lock_wq;
|
wait_queue_head_t read_lock_wq;
|
||||||
wait_queue_head_t lock_wq;
|
wait_queue_head_t lock_wq;
|
||||||
struct page *inline_pages[INLINE_EXTENT_BUFFER_PAGES];
|
struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
|
||||||
struct page **pages;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void extent_set_compress_type(unsigned long *bio_flags,
|
static inline void extent_set_compress_type(unsigned long *bio_flags,
|
||||||
|
|
Loading…
Reference in New Issue