aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2016-09-02 15:40:03 -0400
committerDavid Sterba <dsterba@suse.com>2016-09-26 11:59:49 -0400
commit8436ea91a1c4fd8ed57ff0c0ca482ee3dbe744c7 (patch)
tree3f28586a9624aad931afc0a9bee8d3a739fd38ae
parentafcdd129e05a9210a5d19d4aa6e0afa475fc49e2 (diff)
Btrfs: kill the start argument to read_extent_buffer_pages
Nobody uses this, it makes no sense to do partial reads of extent buffers. Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/disk-io.c13
-rw-r--r--fs/btrfs/extent_io.c28
-rw-r--r--fs/btrfs/extent_io.h2
3 files changed, 15 insertions, 28 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index f92bfa8ffd41..e4c2428cee85 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -442,7 +442,7 @@ static int btrfs_check_super_csum(char *raw_disk_sb)
442 */ 442 */
443static int btree_read_extent_buffer_pages(struct btrfs_root *root, 443static int btree_read_extent_buffer_pages(struct btrfs_root *root,
444 struct extent_buffer *eb, 444 struct extent_buffer *eb,
445 u64 start, u64 parent_transid) 445 u64 parent_transid)
446{ 446{
447 struct extent_io_tree *io_tree; 447 struct extent_io_tree *io_tree;
448 int failed = 0; 448 int failed = 0;
@@ -454,8 +454,7 @@ static int btree_read_extent_buffer_pages(struct btrfs_root *root,
454 clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags); 454 clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags);
455 io_tree = &BTRFS_I(root->fs_info->btree_inode)->io_tree; 455 io_tree = &BTRFS_I(root->fs_info->btree_inode)->io_tree;
456 while (1) { 456 while (1) {
457 ret = read_extent_buffer_pages(io_tree, eb, start, 457 ret = read_extent_buffer_pages(io_tree, eb, WAIT_COMPLETE,
458 WAIT_COMPLETE,
459 btree_get_extent, mirror_num); 458 btree_get_extent, mirror_num);
460 if (!ret) { 459 if (!ret) {
461 if (!verify_parent_transid(io_tree, eb, 460 if (!verify_parent_transid(io_tree, eb,
@@ -1132,7 +1131,7 @@ void readahead_tree_block(struct btrfs_root *root, u64 bytenr)
1132 if (IS_ERR(buf)) 1131 if (IS_ERR(buf))
1133 return; 1132 return;
1134 read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, 1133 read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree,
1135 buf, 0, WAIT_NONE, btree_get_extent, 0); 1134 buf, WAIT_NONE, btree_get_extent, 0);
1136 free_extent_buffer(buf); 1135 free_extent_buffer(buf);
1137} 1136}
1138 1137
@@ -1150,7 +1149,7 @@ int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr,
1150 1149
1151 set_bit(EXTENT_BUFFER_READAHEAD, &buf->bflags); 1150 set_bit(EXTENT_BUFFER_READAHEAD, &buf->bflags);
1152 1151
1153 ret = read_extent_buffer_pages(io_tree, buf, 0, WAIT_PAGE_LOCK, 1152 ret = read_extent_buffer_pages(io_tree, buf, WAIT_PAGE_LOCK,
1154 btree_get_extent, mirror_num); 1153 btree_get_extent, mirror_num);
1155 if (ret) { 1154 if (ret) {
1156 free_extent_buffer(buf); 1155 free_extent_buffer(buf);
@@ -1206,7 +1205,7 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,
1206 if (IS_ERR(buf)) 1205 if (IS_ERR(buf))
1207 return buf; 1206 return buf;
1208 1207
1209 ret = btree_read_extent_buffer_pages(root, buf, 0, parent_transid); 1208 ret = btree_read_extent_buffer_pages(root, buf, parent_transid);
1210 if (ret) { 1209 if (ret) {
1211 free_extent_buffer(buf); 1210 free_extent_buffer(buf);
1212 return ERR_PTR(ret); 1211 return ERR_PTR(ret);
@@ -4081,7 +4080,7 @@ void btrfs_btree_balance_dirty_nodelay(struct btrfs_root *root)
4081int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid) 4080int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid)
4082{ 4081{
4083 struct btrfs_root *root = BTRFS_I(buf->pages[0]->mapping->host)->root; 4082 struct btrfs_root *root = BTRFS_I(buf->pages[0]->mapping->host)->root;
4084 return btree_read_extent_buffer_pages(root, buf, 0, parent_transid); 4083 return btree_read_extent_buffer_pages(root, buf, parent_transid);
4085} 4084}
4086 4085
4087static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info, 4086static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 14ab8576cc93..c046addd9917 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -5188,11 +5188,10 @@ int extent_buffer_uptodate(struct extent_buffer *eb)
5188} 5188}
5189 5189
5190int read_extent_buffer_pages(struct extent_io_tree *tree, 5190int read_extent_buffer_pages(struct extent_io_tree *tree,
5191 struct extent_buffer *eb, u64 start, int wait, 5191 struct extent_buffer *eb, int wait,
5192 get_extent_t *get_extent, int mirror_num) 5192 get_extent_t *get_extent, int mirror_num)
5193{ 5193{
5194 unsigned long i; 5194 unsigned long i;
5195 unsigned long start_i;
5196 struct page *page; 5195 struct page *page;
5197 int err; 5196 int err;
5198 int ret = 0; 5197 int ret = 0;
@@ -5206,16 +5205,8 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
5206 if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags)) 5205 if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags))
5207 return 0; 5206 return 0;
5208 5207
5209 if (start) {
5210 WARN_ON(start < eb->start);
5211 start_i = (start >> PAGE_SHIFT) -
5212 (eb->start >> PAGE_SHIFT);
5213 } else {
5214 start_i = 0;
5215 }
5216
5217 num_pages = num_extent_pages(eb->start, eb->len); 5208 num_pages = num_extent_pages(eb->start, eb->len);
5218 for (i = start_i; i < num_pages; i++) { 5209 for (i = 0; i < num_pages; i++) {
5219 page = eb->pages[i]; 5210 page = eb->pages[i];
5220 if (wait == WAIT_NONE) { 5211 if (wait == WAIT_NONE) {
5221 if (!trylock_page(page)) 5212 if (!trylock_page(page))
@@ -5230,7 +5221,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
5230 * the uptodate bit of our pages won't be affected by 5221 * the uptodate bit of our pages won't be affected by
5231 * clear_extent_buffer_uptodate(). 5222 * clear_extent_buffer_uptodate().
5232 */ 5223 */
5233 for (i = start_i; i < num_pages; i++) { 5224 for (i = 0; i < num_pages; i++) {
5234 page = eb->pages[i]; 5225 page = eb->pages[i];
5235 if (!PageUptodate(page)) { 5226 if (!PageUptodate(page)) {
5236 num_reads++; 5227 num_reads++;
@@ -5239,15 +5230,14 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
5239 } 5230 }
5240 5231
5241 if (all_uptodate) { 5232 if (all_uptodate) {
5242 if (start_i == 0) 5233 set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
5243 set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
5244 goto unlock_exit; 5234 goto unlock_exit;
5245 } 5235 }
5246 5236
5247 clear_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags); 5237 clear_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags);
5248 eb->read_mirror = 0; 5238 eb->read_mirror = 0;
5249 atomic_set(&eb->io_pages, num_reads); 5239 atomic_set(&eb->io_pages, num_reads);
5250 for (i = start_i; i < num_pages; i++) { 5240 for (i = 0; i < num_pages; i++) {
5251 page = eb->pages[i]; 5241 page = eb->pages[i];
5252 5242
5253 if (!PageUptodate(page)) { 5243 if (!PageUptodate(page)) {
@@ -5288,7 +5278,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
5288 if (ret || wait != WAIT_COMPLETE) 5278 if (ret || wait != WAIT_COMPLETE)
5289 return ret; 5279 return ret;
5290 5280
5291 for (i = start_i; i < num_pages; i++) { 5281 for (i = 0; i < num_pages; i++) {
5292 page = eb->pages[i]; 5282 page = eb->pages[i];
5293 wait_on_page_locked(page); 5283 wait_on_page_locked(page);
5294 if (!PageUptodate(page)) 5284 if (!PageUptodate(page))
@@ -5298,12 +5288,10 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
5298 return ret; 5288 return ret;
5299 5289
5300unlock_exit: 5290unlock_exit:
5301 i = start_i;
5302 while (locked_pages > 0) { 5291 while (locked_pages > 0) {
5303 page = eb->pages[i];
5304 i++;
5305 unlock_page(page);
5306 locked_pages--; 5292 locked_pages--;
5293 page = eb->pages[locked_pages];
5294 unlock_page(page);
5307 } 5295 }
5308 return ret; 5296 return ret;
5309} 5297}
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 60536f3bf434..4a094f1dc7ef 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -359,7 +359,7 @@ void free_extent_buffer_stale(struct extent_buffer *eb);
359#define WAIT_COMPLETE 1 359#define WAIT_COMPLETE 1
360#define WAIT_PAGE_LOCK 2 360#define WAIT_PAGE_LOCK 2
361int read_extent_buffer_pages(struct extent_io_tree *tree, 361int read_extent_buffer_pages(struct extent_io_tree *tree,
362 struct extent_buffer *eb, u64 start, int wait, 362 struct extent_buffer *eb, int wait,
363 get_extent_t *get_extent, int mirror_num); 363 get_extent_t *get_extent, int mirror_num);
364void wait_on_extent_buffer_writeback(struct extent_buffer *eb); 364void wait_on_extent_buffer_writeback(struct extent_buffer *eb);
365 365