Btrfs: add rw argument to merge_bio_hook()
We'll want to merge writes so they can fill a full RAID[56] stripe, but not necessarily reads. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
Родитель
3c91160808
Коммит
64a167011b
|
@ -372,7 +372,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
|
||||||
page = compressed_pages[pg_index];
|
page = compressed_pages[pg_index];
|
||||||
page->mapping = inode->i_mapping;
|
page->mapping = inode->i_mapping;
|
||||||
if (bio->bi_size)
|
if (bio->bi_size)
|
||||||
ret = io_tree->ops->merge_bio_hook(page, 0,
|
ret = io_tree->ops->merge_bio_hook(WRITE, page, 0,
|
||||||
PAGE_CACHE_SIZE,
|
PAGE_CACHE_SIZE,
|
||||||
bio, 0);
|
bio, 0);
|
||||||
else
|
else
|
||||||
|
@ -655,7 +655,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
|
||||||
page->index = em_start >> PAGE_CACHE_SHIFT;
|
page->index = em_start >> PAGE_CACHE_SHIFT;
|
||||||
|
|
||||||
if (comp_bio->bi_size)
|
if (comp_bio->bi_size)
|
||||||
ret = tree->ops->merge_bio_hook(page, 0,
|
ret = tree->ops->merge_bio_hook(READ, page, 0,
|
||||||
PAGE_CACHE_SIZE,
|
PAGE_CACHE_SIZE,
|
||||||
comp_bio, 0);
|
comp_bio, 0);
|
||||||
else
|
else
|
||||||
|
|
|
@ -3459,9 +3459,9 @@ int btrfs_writepages(struct address_space *mapping,
|
||||||
struct writeback_control *wbc);
|
struct writeback_control *wbc);
|
||||||
int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
|
int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *new_root, u64 new_dirid);
|
struct btrfs_root *new_root, u64 new_dirid);
|
||||||
int btrfs_merge_bio_hook(struct page *page, unsigned long offset,
|
int btrfs_merge_bio_hook(int rw, struct page *page, unsigned long offset,
|
||||||
size_t size, struct bio *bio, unsigned long bio_flags);
|
size_t size, struct bio *bio,
|
||||||
|
unsigned long bio_flags);
|
||||||
int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
|
int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
|
||||||
int btrfs_readpage(struct file *file, struct page *page);
|
int btrfs_readpage(struct file *file, struct page *page);
|
||||||
void btrfs_evict_inode(struct inode *inode);
|
void btrfs_evict_inode(struct inode *inode);
|
||||||
|
|
|
@ -2489,13 +2489,13 @@ static int __must_check submit_one_bio(int rw, struct bio *bio,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int merge_bio(struct extent_io_tree *tree, struct page *page,
|
static int merge_bio(int rw, struct extent_io_tree *tree, struct page *page,
|
||||||
unsigned long offset, size_t size, struct bio *bio,
|
unsigned long offset, size_t size, struct bio *bio,
|
||||||
unsigned long bio_flags)
|
unsigned long bio_flags)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (tree->ops && tree->ops->merge_bio_hook)
|
if (tree->ops && tree->ops->merge_bio_hook)
|
||||||
ret = tree->ops->merge_bio_hook(page, offset, size, bio,
|
ret = tree->ops->merge_bio_hook(rw, page, offset, size, bio,
|
||||||
bio_flags);
|
bio_flags);
|
||||||
BUG_ON(ret < 0);
|
BUG_ON(ret < 0);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -2530,7 +2530,7 @@ static int submit_extent_page(int rw, struct extent_io_tree *tree,
|
||||||
sector;
|
sector;
|
||||||
|
|
||||||
if (prev_bio_flags != bio_flags || !contig ||
|
if (prev_bio_flags != bio_flags || !contig ||
|
||||||
merge_bio(tree, page, offset, page_size, bio, bio_flags) ||
|
merge_bio(rw, tree, page, offset, page_size, bio, bio_flags) ||
|
||||||
bio_add_page(bio, page, page_size, offset) < page_size) {
|
bio_add_page(bio, page, page_size, offset) < page_size) {
|
||||||
ret = submit_one_bio(rw, bio, mirror_num,
|
ret = submit_one_bio(rw, bio, mirror_num,
|
||||||
prev_bio_flags);
|
prev_bio_flags);
|
||||||
|
|
|
@ -72,7 +72,7 @@ struct extent_io_ops {
|
||||||
int (*writepage_start_hook)(struct page *page, u64 start, u64 end);
|
int (*writepage_start_hook)(struct page *page, u64 start, u64 end);
|
||||||
int (*writepage_io_hook)(struct page *page, u64 start, u64 end);
|
int (*writepage_io_hook)(struct page *page, u64 start, u64 end);
|
||||||
extent_submit_bio_hook_t *submit_bio_hook;
|
extent_submit_bio_hook_t *submit_bio_hook;
|
||||||
int (*merge_bio_hook)(struct page *page, unsigned long offset,
|
int (*merge_bio_hook)(int rw, struct page *page, unsigned long offset,
|
||||||
size_t size, struct bio *bio,
|
size_t size, struct bio *bio,
|
||||||
unsigned long bio_flags);
|
unsigned long bio_flags);
|
||||||
int (*readpage_io_hook)(struct page *page, u64 start, u64 end);
|
int (*readpage_io_hook)(struct page *page, u64 start, u64 end);
|
||||||
|
|
|
@ -1566,7 +1566,7 @@ static void btrfs_clear_bit_hook(struct inode *inode,
|
||||||
* extent_io.c merge_bio_hook, this must check the chunk tree to make sure
|
* extent_io.c merge_bio_hook, this must check the chunk tree to make sure
|
||||||
* we don't create bios that span stripes or chunks
|
* we don't create bios that span stripes or chunks
|
||||||
*/
|
*/
|
||||||
int btrfs_merge_bio_hook(struct page *page, unsigned long offset,
|
int btrfs_merge_bio_hook(int rw, struct page *page, unsigned long offset,
|
||||||
size_t size, struct bio *bio,
|
size_t size, struct bio *bio,
|
||||||
unsigned long bio_flags)
|
unsigned long bio_flags)
|
||||||
{
|
{
|
||||||
|
@ -1581,7 +1581,7 @@ int btrfs_merge_bio_hook(struct page *page, unsigned long offset,
|
||||||
|
|
||||||
length = bio->bi_size;
|
length = bio->bi_size;
|
||||||
map_length = length;
|
map_length = length;
|
||||||
ret = btrfs_map_block(root->fs_info, READ, logical,
|
ret = btrfs_map_block(root->fs_info, rw, logical,
|
||||||
&map_length, NULL, 0);
|
&map_length, NULL, 0);
|
||||||
/* Will always return 0 with map_multi == NULL */
|
/* Will always return 0 with map_multi == NULL */
|
||||||
BUG_ON(ret < 0);
|
BUG_ON(ret < 0);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче