Commit 8436ea91 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

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: default avatarJosef Bacik <jbacik@fb.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent afcdd129
...@@ -442,7 +442,7 @@ static int btrfs_check_super_csum(char *raw_disk_sb) ...@@ -442,7 +442,7 @@ static int btrfs_check_super_csum(char *raw_disk_sb)
*/ */
static int btree_read_extent_buffer_pages(struct btrfs_root *root, static int btree_read_extent_buffer_pages(struct btrfs_root *root,
struct extent_buffer *eb, struct extent_buffer *eb,
u64 start, u64 parent_transid) u64 parent_transid)
{ {
struct extent_io_tree *io_tree; struct extent_io_tree *io_tree;
int failed = 0; int failed = 0;
...@@ -454,8 +454,7 @@ static int btree_read_extent_buffer_pages(struct btrfs_root *root, ...@@ -454,8 +454,7 @@ static int btree_read_extent_buffer_pages(struct btrfs_root *root,
clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags); clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags);
io_tree = &BTRFS_I(root->fs_info->btree_inode)->io_tree; io_tree = &BTRFS_I(root->fs_info->btree_inode)->io_tree;
while (1) { while (1) {
ret = read_extent_buffer_pages(io_tree, eb, start, ret = read_extent_buffer_pages(io_tree, eb, WAIT_COMPLETE,
WAIT_COMPLETE,
btree_get_extent, mirror_num); btree_get_extent, mirror_num);
if (!ret) { if (!ret) {
if (!verify_parent_transid(io_tree, eb, if (!verify_parent_transid(io_tree, eb,
...@@ -1132,7 +1131,7 @@ void readahead_tree_block(struct btrfs_root *root, u64 bytenr) ...@@ -1132,7 +1131,7 @@ void readahead_tree_block(struct btrfs_root *root, u64 bytenr)
if (IS_ERR(buf)) if (IS_ERR(buf))
return; return;
read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree,
buf, 0, WAIT_NONE, btree_get_extent, 0); buf, WAIT_NONE, btree_get_extent, 0);
free_extent_buffer(buf); free_extent_buffer(buf);
} }
...@@ -1150,7 +1149,7 @@ int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr, ...@@ -1150,7 +1149,7 @@ int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr,
set_bit(EXTENT_BUFFER_READAHEAD, &buf->bflags); set_bit(EXTENT_BUFFER_READAHEAD, &buf->bflags);
ret = read_extent_buffer_pages(io_tree, buf, 0, WAIT_PAGE_LOCK, ret = read_extent_buffer_pages(io_tree, buf, WAIT_PAGE_LOCK,
btree_get_extent, mirror_num); btree_get_extent, mirror_num);
if (ret) { if (ret) {
free_extent_buffer(buf); free_extent_buffer(buf);
...@@ -1206,7 +1205,7 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr, ...@@ -1206,7 +1205,7 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,
if (IS_ERR(buf)) if (IS_ERR(buf))
return buf; return buf;
ret = btree_read_extent_buffer_pages(root, buf, 0, parent_transid); ret = btree_read_extent_buffer_pages(root, buf, parent_transid);
if (ret) { if (ret) {
free_extent_buffer(buf); free_extent_buffer(buf);
return ERR_PTR(ret); return ERR_PTR(ret);
...@@ -4081,7 +4080,7 @@ void btrfs_btree_balance_dirty_nodelay(struct btrfs_root *root) ...@@ -4081,7 +4080,7 @@ void btrfs_btree_balance_dirty_nodelay(struct btrfs_root *root)
int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid) int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid)
{ {
struct btrfs_root *root = BTRFS_I(buf->pages[0]->mapping->host)->root; struct btrfs_root *root = BTRFS_I(buf->pages[0]->mapping->host)->root;
return btree_read_extent_buffer_pages(root, buf, 0, parent_transid); return btree_read_extent_buffer_pages(root, buf, parent_transid);
} }
static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info, static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
......
...@@ -5188,11 +5188,10 @@ int extent_buffer_uptodate(struct extent_buffer *eb) ...@@ -5188,11 +5188,10 @@ int extent_buffer_uptodate(struct extent_buffer *eb)
} }
int read_extent_buffer_pages(struct extent_io_tree *tree, int read_extent_buffer_pages(struct extent_io_tree *tree,
struct extent_buffer *eb, u64 start, int wait, struct extent_buffer *eb, int wait,
get_extent_t *get_extent, int mirror_num) get_extent_t *get_extent, int mirror_num)
{ {
unsigned long i; unsigned long i;
unsigned long start_i;
struct page *page; struct page *page;
int err; int err;
int ret = 0; int ret = 0;
...@@ -5206,16 +5205,8 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, ...@@ -5206,16 +5205,8 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags)) if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags))
return 0; return 0;
if (start) {
WARN_ON(start < eb->start);
start_i = (start >> PAGE_SHIFT) -
(eb->start >> PAGE_SHIFT);
} else {
start_i = 0;
}
num_pages = num_extent_pages(eb->start, eb->len); num_pages = num_extent_pages(eb->start, eb->len);
for (i = start_i; i < num_pages; i++) { for (i = 0; i < num_pages; i++) {
page = eb->pages[i]; page = eb->pages[i];
if (wait == WAIT_NONE) { if (wait == WAIT_NONE) {
if (!trylock_page(page)) if (!trylock_page(page))
...@@ -5230,7 +5221,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, ...@@ -5230,7 +5221,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
* the uptodate bit of our pages won't be affected by * the uptodate bit of our pages won't be affected by
* clear_extent_buffer_uptodate(). * clear_extent_buffer_uptodate().
*/ */
for (i = start_i; i < num_pages; i++) { for (i = 0; i < num_pages; i++) {
page = eb->pages[i]; page = eb->pages[i];
if (!PageUptodate(page)) { if (!PageUptodate(page)) {
num_reads++; num_reads++;
...@@ -5239,15 +5230,14 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, ...@@ -5239,15 +5230,14 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
} }
if (all_uptodate) { if (all_uptodate) {
if (start_i == 0) set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
goto unlock_exit; goto unlock_exit;
} }
clear_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags); clear_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags);
eb->read_mirror = 0; eb->read_mirror = 0;
atomic_set(&eb->io_pages, num_reads); atomic_set(&eb->io_pages, num_reads);
for (i = start_i; i < num_pages; i++) { for (i = 0; i < num_pages; i++) {
page = eb->pages[i]; page = eb->pages[i];
if (!PageUptodate(page)) { if (!PageUptodate(page)) {
...@@ -5288,7 +5278,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, ...@@ -5288,7 +5278,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
if (ret || wait != WAIT_COMPLETE) if (ret || wait != WAIT_COMPLETE)
return ret; return ret;
for (i = start_i; i < num_pages; i++) { for (i = 0; i < num_pages; i++) {
page = eb->pages[i]; page = eb->pages[i];
wait_on_page_locked(page); wait_on_page_locked(page);
if (!PageUptodate(page)) if (!PageUptodate(page))
...@@ -5298,12 +5288,10 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, ...@@ -5298,12 +5288,10 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
return ret; return ret;
unlock_exit: unlock_exit:
i = start_i;
while (locked_pages > 0) { while (locked_pages > 0) {
page = eb->pages[i];
i++;
unlock_page(page);
locked_pages--; locked_pages--;
page = eb->pages[locked_pages];
unlock_page(page);
} }
return ret; return ret;
} }
......
...@@ -359,7 +359,7 @@ void free_extent_buffer_stale(struct extent_buffer *eb); ...@@ -359,7 +359,7 @@ void free_extent_buffer_stale(struct extent_buffer *eb);
#define WAIT_COMPLETE 1 #define WAIT_COMPLETE 1
#define WAIT_PAGE_LOCK 2 #define WAIT_PAGE_LOCK 2
int read_extent_buffer_pages(struct extent_io_tree *tree, int read_extent_buffer_pages(struct extent_io_tree *tree,
struct extent_buffer *eb, u64 start, int wait, struct extent_buffer *eb, int wait,
get_extent_t *get_extent, int mirror_num); get_extent_t *get_extent, int mirror_num);
void wait_on_extent_buffer_writeback(struct extent_buffer *eb); void wait_on_extent_buffer_writeback(struct extent_buffer *eb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment