diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2009-07-15 18:29:37 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-02-01 11:49:47 -0500 |
commit | 64a167011bcabc1e855658387c8a4464b71f3138 (patch) | |
tree | 768b39580c96931f1a47fdc0a8959e3e473df5a6 | |
parent | 3c911608085bf2d5a0822c418129f96a2a89d1b5 (diff) |
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>
-rw-r--r-- | fs/btrfs/compression.c | 4 | ||||
-rw-r--r-- | fs/btrfs/ctree.h | 6 | ||||
-rw-r--r-- | fs/btrfs/extent_io.c | 6 | ||||
-rw-r--r-- | fs/btrfs/extent_io.h | 2 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 4 |
5 files changed, 11 insertions, 11 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 94ab2f80e7e3..15b94089abc4 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
@@ -372,7 +372,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
372 | page = compressed_pages[pg_index]; | 372 | page = compressed_pages[pg_index]; |
373 | page->mapping = inode->i_mapping; | 373 | page->mapping = inode->i_mapping; |
374 | if (bio->bi_size) | 374 | 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, |
376 | PAGE_CACHE_SIZE, | 376 | PAGE_CACHE_SIZE, |
377 | bio, 0); | 377 | bio, 0); |
378 | else | 378 | else |
@@ -655,7 +655,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
655 | page->index = em_start >> PAGE_CACHE_SHIFT; | 655 | page->index = em_start >> PAGE_CACHE_SHIFT; |
656 | 656 | ||
657 | if (comp_bio->bi_size) | 657 | if (comp_bio->bi_size) |
658 | ret = tree->ops->merge_bio_hook(page, 0, | 658 | ret = tree->ops->merge_bio_hook(READ, page, 0, |
659 | PAGE_CACHE_SIZE, | 659 | PAGE_CACHE_SIZE, |
660 | comp_bio, 0); | 660 | comp_bio, 0); |
661 | else | 661 | else |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 547b7b05727f..0ab51be6879f 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -3459,9 +3459,9 @@ int btrfs_writepages(struct address_space *mapping, | |||
3459 | struct writeback_control *wbc); | 3459 | struct writeback_control *wbc); |
3460 | int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, | 3460 | int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, |
3461 | struct btrfs_root *new_root, u64 new_dirid); | 3461 | struct btrfs_root *new_root, u64 new_dirid); |
3462 | int btrfs_merge_bio_hook(struct page *page, unsigned long offset, | 3462 | int btrfs_merge_bio_hook(int rw, struct page *page, unsigned long offset, |
3463 | size_t size, struct bio *bio, unsigned long bio_flags); | 3463 | size_t size, struct bio *bio, |
3464 | 3464 | unsigned long bio_flags); | |
3465 | int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); | 3465 | int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); |
3466 | int btrfs_readpage(struct file *file, struct page *page); | 3466 | int btrfs_readpage(struct file *file, struct page *page); |
3467 | void btrfs_evict_inode(struct inode *inode); | 3467 | void btrfs_evict_inode(struct inode *inode); |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 1b319df29eee..86ecca48c604 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -2489,13 +2489,13 @@ static int __must_check submit_one_bio(int rw, struct bio *bio, | |||
2489 | return ret; | 2489 | return ret; |
2490 | } | 2490 | } |
2491 | 2491 | ||
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, |
2493 | unsigned long offset, size_t size, struct bio *bio, | 2493 | unsigned long offset, size_t size, struct bio *bio, |
2494 | unsigned long bio_flags) | 2494 | unsigned long bio_flags) |
2495 | { | 2495 | { |
2496 | int ret = 0; | 2496 | int ret = 0; |
2497 | if (tree->ops && tree->ops->merge_bio_hook) | 2497 | 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, |
2499 | bio_flags); | 2499 | bio_flags); |
2500 | BUG_ON(ret < 0); | 2500 | BUG_ON(ret < 0); |
2501 | return ret; | 2501 | return ret; |
@@ -2530,7 +2530,7 @@ static int submit_extent_page(int rw, struct extent_io_tree *tree, | |||
2530 | sector; | 2530 | sector; |
2531 | 2531 | ||
2532 | if (prev_bio_flags != bio_flags || !contig || | 2532 | 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) || |
2534 | bio_add_page(bio, page, page_size, offset) < page_size) { | 2534 | bio_add_page(bio, page, page_size, offset) < page_size) { |
2535 | ret = submit_one_bio(rw, bio, mirror_num, | 2535 | ret = submit_one_bio(rw, bio, mirror_num, |
2536 | prev_bio_flags); | 2536 | prev_bio_flags); |
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 2eacfabd3263..b14b36a80eba 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
@@ -72,7 +72,7 @@ struct extent_io_ops { | |||
72 | int (*writepage_start_hook)(struct page *page, u64 start, u64 end); | 72 | int (*writepage_start_hook)(struct page *page, u64 start, u64 end); |
73 | int (*writepage_io_hook)(struct page *page, u64 start, u64 end); | 73 | int (*writepage_io_hook)(struct page *page, u64 start, u64 end); |
74 | extent_submit_bio_hook_t *submit_bio_hook; | 74 | 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, |
76 | size_t size, struct bio *bio, | 76 | size_t size, struct bio *bio, |
77 | unsigned long bio_flags); | 77 | unsigned long bio_flags); |
78 | int (*readpage_io_hook)(struct page *page, u64 start, u64 end); | 78 | int (*readpage_io_hook)(struct page *page, u64 start, u64 end); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 67ed24ae86bb..1b98c4ce3c6f 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1566,7 +1566,7 @@ static void btrfs_clear_bit_hook(struct inode *inode, | |||
1566 | * extent_io.c merge_bio_hook, this must check the chunk tree to make sure | 1566 | * extent_io.c merge_bio_hook, this must check the chunk tree to make sure |
1567 | * we don't create bios that span stripes or chunks | 1567 | * we don't create bios that span stripes or chunks |
1568 | */ | 1568 | */ |
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, |
1570 | size_t size, struct bio *bio, | 1570 | size_t size, struct bio *bio, |
1571 | unsigned long bio_flags) | 1571 | unsigned long bio_flags) |
1572 | { | 1572 | { |
@@ -1581,7 +1581,7 @@ int btrfs_merge_bio_hook(struct page *page, unsigned long offset, | |||
1581 | 1581 | ||
1582 | length = bio->bi_size; | 1582 | length = bio->bi_size; |
1583 | map_length = length; | 1583 | map_length = length; |
1584 | ret = btrfs_map_block(root->fs_info, READ, logical, | 1584 | ret = btrfs_map_block(root->fs_info, rw, logical, |
1585 | &map_length, NULL, 0); | 1585 | &map_length, NULL, 0); |
1586 | /* Will always return 0 with map_multi == NULL */ | 1586 | /* Will always return 0 with map_multi == NULL */ |
1587 | BUG_ON(ret < 0); | 1587 | BUG_ON(ret < 0); |