Skip to content

Commit 64a1670

Browse files
David WoodhouseChris Mason
authored andcommitted
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 <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent 3c91160 commit 64a1670

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

fs/btrfs/compression.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
372372
page = compressed_pages[pg_index];
373373
page->mapping = inode->i_mapping;
374374
if (bio->bi_size)
375-
ret = io_tree->ops->merge_bio_hook(page, 0,
375+
ret = io_tree->ops->merge_bio_hook(WRITE, page, 0,
376376
PAGE_CACHE_SIZE,
377377
bio, 0);
378378
else
@@ -655,7 +655,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
655655
page->index = em_start >> PAGE_CACHE_SHIFT;
656656

657657
if (comp_bio->bi_size)
658-
ret = tree->ops->merge_bio_hook(page, 0,
658+
ret = tree->ops->merge_bio_hook(READ, page, 0,
659659
PAGE_CACHE_SIZE,
660660
comp_bio, 0);
661661
else

fs/btrfs/ctree.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,9 +3459,9 @@ int btrfs_writepages(struct address_space *mapping,
34593459
struct writeback_control *wbc);
34603460
int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
34613461
struct btrfs_root *new_root, u64 new_dirid);
3462-
int btrfs_merge_bio_hook(struct page *page, unsigned long offset,
3463-
size_t size, struct bio *bio, unsigned long bio_flags);
3464-
3462+
int btrfs_merge_bio_hook(int rw, struct page *page, unsigned long offset,
3463+
size_t size, struct bio *bio,
3464+
unsigned long bio_flags);
34653465
int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
34663466
int btrfs_readpage(struct file *file, struct page *page);
34673467
void btrfs_evict_inode(struct inode *inode);

fs/btrfs/extent_io.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,13 +2489,13 @@ static int __must_check submit_one_bio(int rw, struct bio *bio,
24892489
return ret;
24902490
}
24912491

2492-
static int merge_bio(struct extent_io_tree *tree, struct page *page,
2492+
static int merge_bio(int rw, struct extent_io_tree *tree, struct page *page,
24932493
unsigned long offset, size_t size, struct bio *bio,
24942494
unsigned long bio_flags)
24952495
{
24962496
int ret = 0;
24972497
if (tree->ops && tree->ops->merge_bio_hook)
2498-
ret = tree->ops->merge_bio_hook(page, offset, size, bio,
2498+
ret = tree->ops->merge_bio_hook(rw, page, offset, size, bio,
24992499
bio_flags);
25002500
BUG_ON(ret < 0);
25012501
return ret;
@@ -2530,7 +2530,7 @@ static int submit_extent_page(int rw, struct extent_io_tree *tree,
25302530
sector;
25312531

25322532
if (prev_bio_flags != bio_flags || !contig ||
2533-
merge_bio(tree, page, offset, page_size, bio, bio_flags) ||
2533+
merge_bio(rw, tree, page, offset, page_size, bio, bio_flags) ||
25342534
bio_add_page(bio, page, page_size, offset) < page_size) {
25352535
ret = submit_one_bio(rw, bio, mirror_num,
25362536
prev_bio_flags);

fs/btrfs/extent_io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct extent_io_ops {
7272
int (*writepage_start_hook)(struct page *page, u64 start, u64 end);
7373
int (*writepage_io_hook)(struct page *page, u64 start, u64 end);
7474
extent_submit_bio_hook_t *submit_bio_hook;
75-
int (*merge_bio_hook)(struct page *page, unsigned long offset,
75+
int (*merge_bio_hook)(int rw, struct page *page, unsigned long offset,
7676
size_t size, struct bio *bio,
7777
unsigned long bio_flags);
7878
int (*readpage_io_hook)(struct page *page, u64 start, u64 end);

fs/btrfs/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ static void btrfs_clear_bit_hook(struct inode *inode,
15661566
* extent_io.c merge_bio_hook, this must check the chunk tree to make sure
15671567
* we don't create bios that span stripes or chunks
15681568
*/
1569-
int btrfs_merge_bio_hook(struct page *page, unsigned long offset,
1569+
int btrfs_merge_bio_hook(int rw, struct page *page, unsigned long offset,
15701570
size_t size, struct bio *bio,
15711571
unsigned long bio_flags)
15721572
{
@@ -1581,7 +1581,7 @@ int btrfs_merge_bio_hook(struct page *page, unsigned long offset,
15811581

15821582
length = bio->bi_size;
15831583
map_length = length;
1584-
ret = btrfs_map_block(root->fs_info, READ, logical,
1584+
ret = btrfs_map_block(root->fs_info, rw, logical,
15851585
&map_length, NULL, 0);
15861586
/* Will always return 0 with map_multi == NULL */
15871587
BUG_ON(ret < 0);

0 commit comments

Comments
 (0)