@@ -63,19 +63,15 @@ int btrfs_write_buffers(struct btrfs_fs_info *fs_info, struct list_head *list)
int btrfs_wait_buffers(struct btrfs_fs_info *fs_info, struct list_head *list)
{
- struct address_space *mapping = fs_info->btree_inode->i_mapping;
struct dirty_buffer *db;
- int werr = 0, err;
+ int werr = 0;
while ((db = list_first_entry_or_null(list, struct dirty_buffer,
wb_entry))) {
list_del_init(&db->wb_entry);
- err = filemap_fdatawait_range(mapping, db->eb->start,
- db->eb->start + db->eb->len - 1);
- if (err)
- werr = err;
- if (!werr && test_bit(EXTENT_BUFFER_WRITE_ERR, &db->eb->bflags))
+ wait_on_extent_buffer_writeback(db->eb);
+ if (test_bit(EXTENT_BUFFER_WRITE_ERR, &db->eb->bflags))
werr = -EIO;
free_extent_buffer(db->eb);
kfree(db);
Don't bother to got to filemap_fdatawait_range to look up each page in an extent_buffer and then wait for writeback completion on each page, but instead just call wait_on_extent_buffer_writeback on the buffer. All write errors are propagated through the EXTENT_BUFFER_WRITE_ERR bit on the extent_buffer itself, so there is no need to check for per-page errors either. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/btrfs/extent_buffer.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)