diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-02-07 10:50:54 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:00 -0400 |
commit | a86c12c73d982c545a37a8ecdd66528ab260b770 (patch) | |
tree | d9e28c7d805c3d5ad0c885a46abe60b7d7aaec3d | |
parent | 961d023213b94861480f5d6533f7adc8332eb527 (diff) |
Btrfs: Create larger bios for btree blocks
Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r-- | fs/btrfs/disk-io.c | 10 | ||||
-rw-r--r-- | fs/btrfs/extent_io.c | 12 | ||||
-rw-r--r-- | fs/btrfs/extent_io.h | 3 |
3 files changed, 17 insertions, 8 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index dda8ad6c0077..6f0825b617d1 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -197,7 +197,8 @@ int csum_dirty_buffer(struct btrfs_root *root, struct page *page) | |||
197 | WARN_ON(1); | 197 | WARN_ON(1); |
198 | } | 198 | } |
199 | eb = alloc_extent_buffer(tree, start, len, page, GFP_NOFS); | 199 | eb = alloc_extent_buffer(tree, start, len, page, GFP_NOFS); |
200 | read_extent_buffer_pages(tree, eb, start + PAGE_CACHE_SIZE, 1); | 200 | read_extent_buffer_pages(tree, eb, start + PAGE_CACHE_SIZE, 1, |
201 | btree_get_extent); | ||
201 | btrfs_clear_buffer_defrag(eb); | 202 | btrfs_clear_buffer_defrag(eb); |
202 | found_start = btrfs_header_bytenr(eb); | 203 | found_start = btrfs_header_bytenr(eb); |
203 | if (found_start != start) { | 204 | if (found_start != start) { |
@@ -339,7 +340,7 @@ int readahead_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize) | |||
339 | if (!buf) | 340 | if (!buf) |
340 | return 0; | 341 | return 0; |
341 | read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, | 342 | read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, |
342 | buf, 0, 0); | 343 | buf, 0, 0, btree_get_extent); |
343 | free_extent_buffer(buf); | 344 | free_extent_buffer(buf); |
344 | return ret; | 345 | return ret; |
345 | } | 346 | } |
@@ -358,7 +359,8 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr, | |||
358 | buf = btrfs_find_create_tree_block(root, bytenr, blocksize); | 359 | buf = btrfs_find_create_tree_block(root, bytenr, blocksize); |
359 | if (!buf) | 360 | if (!buf) |
360 | return NULL; | 361 | return NULL; |
361 | read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, buf, 0, 1); | 362 | read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, buf, 0, 1, |
363 | btree_get_extent); | ||
362 | 364 | ||
363 | if (buf->flags & EXTENT_CSUM) | 365 | if (buf->flags & EXTENT_CSUM) |
364 | return buf; | 366 | return buf; |
@@ -1009,7 +1011,7 @@ int btrfs_read_buffer(struct extent_buffer *buf) | |||
1009 | struct btrfs_root *root = BTRFS_I(buf->first_page->mapping->host)->root; | 1011 | struct btrfs_root *root = BTRFS_I(buf->first_page->mapping->host)->root; |
1010 | struct inode *btree_inode = root->fs_info->btree_inode; | 1012 | struct inode *btree_inode = root->fs_info->btree_inode; |
1011 | return read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, | 1013 | return read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, |
1012 | buf, 0, 1); | 1014 | buf, 0, 1, btree_get_extent); |
1013 | } | 1015 | } |
1014 | 1016 | ||
1015 | static struct extent_io_ops btree_extent_io_ops = { | 1017 | static struct extent_io_ops btree_extent_io_ops = { |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index b68e57f66a96..fcae999ab712 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -2859,8 +2859,8 @@ EXPORT_SYMBOL(extent_buffer_uptodate); | |||
2859 | 2859 | ||
2860 | int read_extent_buffer_pages(struct extent_io_tree *tree, | 2860 | int read_extent_buffer_pages(struct extent_io_tree *tree, |
2861 | struct extent_buffer *eb, | 2861 | struct extent_buffer *eb, |
2862 | u64 start, | 2862 | u64 start, int wait, |
2863 | int wait) | 2863 | get_extent_t *get_extent) |
2864 | { | 2864 | { |
2865 | unsigned long i; | 2865 | unsigned long i; |
2866 | unsigned long start_i; | 2866 | unsigned long start_i; |
@@ -2868,6 +2868,8 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, | |||
2868 | int err; | 2868 | int err; |
2869 | int ret = 0; | 2869 | int ret = 0; |
2870 | unsigned long num_pages; | 2870 | unsigned long num_pages; |
2871 | struct bio *bio = NULL; | ||
2872 | |||
2871 | 2873 | ||
2872 | if (eb->flags & EXTENT_UPTODATE) | 2874 | if (eb->flags & EXTENT_UPTODATE) |
2873 | return 0; | 2875 | return 0; |
@@ -2899,7 +2901,8 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, | |||
2899 | lock_page(page); | 2901 | lock_page(page); |
2900 | } | 2902 | } |
2901 | if (!PageUptodate(page)) { | 2903 | if (!PageUptodate(page)) { |
2902 | err = page->mapping->a_ops->readpage(NULL, page); | 2904 | err = __extent_read_full_page(tree, page, |
2905 | get_extent, &bio); | ||
2903 | if (err) { | 2906 | if (err) { |
2904 | ret = err; | 2907 | ret = err; |
2905 | } | 2908 | } |
@@ -2908,6 +2911,9 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, | |||
2908 | } | 2911 | } |
2909 | } | 2912 | } |
2910 | 2913 | ||
2914 | if (bio) | ||
2915 | submit_one_bio(READ, bio); | ||
2916 | |||
2911 | if (ret || !wait) { | 2917 | if (ret || !wait) { |
2912 | return ret; | 2918 | return ret; |
2913 | } | 2919 | } |
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 160da3f9d78e..151fdada4dc4 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
@@ -157,7 +157,8 @@ struct extent_buffer *find_extent_buffer(struct extent_io_tree *tree, | |||
157 | gfp_t mask); | 157 | gfp_t mask); |
158 | void free_extent_buffer(struct extent_buffer *eb); | 158 | void free_extent_buffer(struct extent_buffer *eb); |
159 | int read_extent_buffer_pages(struct extent_io_tree *tree, | 159 | int read_extent_buffer_pages(struct extent_io_tree *tree, |
160 | struct extent_buffer *eb, u64 start, int wait); | 160 | struct extent_buffer *eb, u64 start, int wait, |
161 | get_extent_t *get_extent); | ||
161 | 162 | ||
162 | static inline void extent_buffer_get(struct extent_buffer *eb) | 163 | static inline void extent_buffer_get(struct extent_buffer *eb) |
163 | { | 164 | { |