block: switch bios to blk_status_t
Replace bi_error with a new bi_status to allow for a clear conversion. Note that device mapper overloaded bi_error with a private value, which we'll have to keep arround at least for now and thus propagate to a proper blk_status_t value. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:

committed by
Jens Axboe

parent
fc17b6534e
commit
4e4cbee93d
@@ -310,7 +310,8 @@ struct btrfs_dio_private {
|
||||
* The original bio may be split to several sub-bios, this is
|
||||
* done during endio of sub-bios
|
||||
*/
|
||||
int (*subio_endio)(struct inode *, struct btrfs_io_bio *, int);
|
||||
blk_status_t (*subio_endio)(struct inode *, struct btrfs_io_bio *,
|
||||
blk_status_t);
|
||||
};
|
||||
|
||||
/*
|
||||
|
@@ -2129,7 +2129,7 @@ static void btrfsic_bio_end_io(struct bio *bp)
|
||||
/* mutex is not held! This is not save if IO is not yet completed
|
||||
* on umount */
|
||||
iodone_w_error = 0;
|
||||
if (bp->bi_error)
|
||||
if (bp->bi_status)
|
||||
iodone_w_error = 1;
|
||||
|
||||
BUG_ON(NULL == block);
|
||||
@@ -2143,7 +2143,7 @@ static void btrfsic_bio_end_io(struct bio *bp)
|
||||
if ((dev_state->state->print_mask &
|
||||
BTRFSIC_PRINT_MASK_END_IO_BIO_BH))
|
||||
pr_info("bio_end_io(err=%d) for %c @%llu (%s/%llu/%d)\n",
|
||||
bp->bi_error,
|
||||
bp->bi_status,
|
||||
btrfsic_get_block_type(dev_state->state, block),
|
||||
block->logical_bytenr, dev_state->name,
|
||||
block->dev_bytenr, block->mirror_num);
|
||||
|
@@ -155,7 +155,7 @@ static void end_compressed_bio_read(struct bio *bio)
|
||||
unsigned long index;
|
||||
int ret;
|
||||
|
||||
if (bio->bi_error)
|
||||
if (bio->bi_status)
|
||||
cb->errors = 1;
|
||||
|
||||
/* if there are more bios still pending for this compressed
|
||||
@@ -268,7 +268,7 @@ static void end_compressed_bio_write(struct bio *bio)
|
||||
struct page *page;
|
||||
unsigned long index;
|
||||
|
||||
if (bio->bi_error)
|
||||
if (bio->bi_status)
|
||||
cb->errors = 1;
|
||||
|
||||
/* if there are more bios still pending for this compressed
|
||||
@@ -287,7 +287,7 @@ static void end_compressed_bio_write(struct bio *bio)
|
||||
cb->start,
|
||||
cb->start + cb->len - 1,
|
||||
NULL,
|
||||
bio->bi_error ? 0 : 1);
|
||||
bio->bi_status ? 0 : 1);
|
||||
cb->compressed_pages[0]->mapping = NULL;
|
||||
|
||||
end_compressed_writeback(inode, cb);
|
||||
@@ -320,7 +320,7 @@ out:
|
||||
* This also checksums the file bytes and gets things ready for
|
||||
* the end io hooks.
|
||||
*/
|
||||
int btrfs_submit_compressed_write(struct inode *inode, u64 start,
|
||||
blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
|
||||
unsigned long len, u64 disk_start,
|
||||
unsigned long compressed_len,
|
||||
struct page **compressed_pages,
|
||||
@@ -335,13 +335,13 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
|
||||
struct page *page;
|
||||
u64 first_byte = disk_start;
|
||||
struct block_device *bdev;
|
||||
int ret;
|
||||
blk_status_t ret;
|
||||
int skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;
|
||||
|
||||
WARN_ON(start & ((u64)PAGE_SIZE - 1));
|
||||
cb = kmalloc(compressed_bio_size(fs_info, compressed_len), GFP_NOFS);
|
||||
if (!cb)
|
||||
return -ENOMEM;
|
||||
return BLK_STS_RESOURCE;
|
||||
refcount_set(&cb->pending_bios, 0);
|
||||
cb->errors = 0;
|
||||
cb->inode = inode;
|
||||
@@ -358,7 +358,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
|
||||
bio = compressed_bio_alloc(bdev, first_byte, GFP_NOFS);
|
||||
if (!bio) {
|
||||
kfree(cb);
|
||||
return -ENOMEM;
|
||||
return BLK_STS_RESOURCE;
|
||||
}
|
||||
bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
|
||||
bio->bi_private = cb;
|
||||
@@ -368,17 +368,17 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
|
||||
/* create and submit bios for the compressed pages */
|
||||
bytes_left = compressed_len;
|
||||
for (pg_index = 0; pg_index < cb->nr_pages; pg_index++) {
|
||||
int submit = 0;
|
||||
|
||||
page = compressed_pages[pg_index];
|
||||
page->mapping = inode->i_mapping;
|
||||
if (bio->bi_iter.bi_size)
|
||||
ret = io_tree->ops->merge_bio_hook(page, 0,
|
||||
submit = io_tree->ops->merge_bio_hook(page, 0,
|
||||
PAGE_SIZE,
|
||||
bio, 0);
|
||||
else
|
||||
ret = 0;
|
||||
|
||||
page->mapping = NULL;
|
||||
if (ret || bio_add_page(bio, page, PAGE_SIZE, 0) <
|
||||
if (submit || bio_add_page(bio, page, PAGE_SIZE, 0) <
|
||||
PAGE_SIZE) {
|
||||
bio_get(bio);
|
||||
|
||||
@@ -400,7 +400,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
|
||||
|
||||
ret = btrfs_map_bio(fs_info, bio, 0, 1);
|
||||
if (ret) {
|
||||
bio->bi_error = ret;
|
||||
bio->bi_status = ret;
|
||||
bio_endio(bio);
|
||||
}
|
||||
|
||||
@@ -434,7 +434,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
|
||||
|
||||
ret = btrfs_map_bio(fs_info, bio, 0, 1);
|
||||
if (ret) {
|
||||
bio->bi_error = ret;
|
||||
bio->bi_status = ret;
|
||||
bio_endio(bio);
|
||||
}
|
||||
|
||||
@@ -569,7 +569,7 @@ next:
|
||||
* After the compressed pages are read, we copy the bytes into the
|
||||
* bio we were passed and then call the bio end_io calls
|
||||
*/
|
||||
int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
|
||||
blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
|
||||
int mirror_num, unsigned long bio_flags)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
|
||||
@@ -586,7 +586,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
|
||||
u64 em_len;
|
||||
u64 em_start;
|
||||
struct extent_map *em;
|
||||
int ret = -ENOMEM;
|
||||
blk_status_t ret = BLK_STS_RESOURCE;
|
||||
int faili = 0;
|
||||
u32 *sums;
|
||||
|
||||
@@ -600,7 +600,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
|
||||
PAGE_SIZE);
|
||||
read_unlock(&em_tree->lock);
|
||||
if (!em)
|
||||
return -EIO;
|
||||
return BLK_STS_IOERR;
|
||||
|
||||
compressed_len = em->block_len;
|
||||
cb = kmalloc(compressed_bio_size(fs_info, compressed_len), GFP_NOFS);
|
||||
@@ -659,19 +659,19 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
|
||||
refcount_set(&cb->pending_bios, 1);
|
||||
|
||||
for (pg_index = 0; pg_index < nr_pages; pg_index++) {
|
||||
int submit = 0;
|
||||
|
||||
page = cb->compressed_pages[pg_index];
|
||||
page->mapping = inode->i_mapping;
|
||||
page->index = em_start >> PAGE_SHIFT;
|
||||
|
||||
if (comp_bio->bi_iter.bi_size)
|
||||
ret = tree->ops->merge_bio_hook(page, 0,
|
||||
submit = tree->ops->merge_bio_hook(page, 0,
|
||||
PAGE_SIZE,
|
||||
comp_bio, 0);
|
||||
else
|
||||
ret = 0;
|
||||
|
||||
page->mapping = NULL;
|
||||
if (ret || bio_add_page(comp_bio, page, PAGE_SIZE, 0) <
|
||||
if (submit || bio_add_page(comp_bio, page, PAGE_SIZE, 0) <
|
||||
PAGE_SIZE) {
|
||||
bio_get(comp_bio);
|
||||
|
||||
@@ -697,7 +697,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
|
||||
|
||||
ret = btrfs_map_bio(fs_info, comp_bio, mirror_num, 0);
|
||||
if (ret) {
|
||||
comp_bio->bi_error = ret;
|
||||
comp_bio->bi_status = ret;
|
||||
bio_endio(comp_bio);
|
||||
}
|
||||
|
||||
@@ -726,7 +726,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
|
||||
|
||||
ret = btrfs_map_bio(fs_info, comp_bio, mirror_num, 0);
|
||||
if (ret) {
|
||||
comp_bio->bi_error = ret;
|
||||
comp_bio->bi_status = ret;
|
||||
bio_endio(comp_bio);
|
||||
}
|
||||
|
||||
|
@@ -48,12 +48,12 @@ int btrfs_decompress_buf2page(const char *buf, unsigned long buf_start,
|
||||
unsigned long total_out, u64 disk_start,
|
||||
struct bio *bio);
|
||||
|
||||
int btrfs_submit_compressed_write(struct inode *inode, u64 start,
|
||||
blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
|
||||
unsigned long len, u64 disk_start,
|
||||
unsigned long compressed_len,
|
||||
struct page **compressed_pages,
|
||||
unsigned long nr_pages);
|
||||
int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
|
||||
blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
|
||||
int mirror_num, unsigned long bio_flags);
|
||||
|
||||
enum btrfs_compression_type {
|
||||
|
@@ -3078,8 +3078,8 @@ int btrfs_find_name_in_ext_backref(struct btrfs_path *path,
|
||||
struct btrfs_dio_private;
|
||||
int btrfs_del_csums(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_fs_info *fs_info, u64 bytenr, u64 len);
|
||||
int btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio, u32 *dst);
|
||||
int btrfs_lookup_bio_sums_dio(struct inode *inode, struct bio *bio,
|
||||
blk_status_t btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio, u32 *dst);
|
||||
blk_status_t btrfs_lookup_bio_sums_dio(struct inode *inode, struct bio *bio,
|
||||
u64 logical_offset);
|
||||
int btrfs_insert_file_extent(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_root *root,
|
||||
@@ -3094,7 +3094,7 @@ int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans,
|
||||
int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_root *root,
|
||||
struct btrfs_ordered_sum *sums);
|
||||
int btrfs_csum_one_bio(struct inode *inode, struct bio *bio,
|
||||
blk_status_t btrfs_csum_one_bio(struct inode *inode, struct bio *bio,
|
||||
u64 file_start, int contig);
|
||||
int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
|
||||
struct list_head *list, int search_commit);
|
||||
|
@@ -87,7 +87,7 @@ struct btrfs_end_io_wq {
|
||||
bio_end_io_t *end_io;
|
||||
void *private;
|
||||
struct btrfs_fs_info *info;
|
||||
int error;
|
||||
blk_status_t status;
|
||||
enum btrfs_wq_endio_type metadata;
|
||||
struct list_head list;
|
||||
struct btrfs_work work;
|
||||
@@ -131,7 +131,7 @@ struct async_submit_bio {
|
||||
*/
|
||||
u64 bio_offset;
|
||||
struct btrfs_work work;
|
||||
int error;
|
||||
blk_status_t status;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -799,7 +799,7 @@ static void end_workqueue_bio(struct bio *bio)
|
||||
btrfs_work_func_t func;
|
||||
|
||||
fs_info = end_io_wq->info;
|
||||
end_io_wq->error = bio->bi_error;
|
||||
end_io_wq->status = bio->bi_status;
|
||||
|
||||
if (bio_op(bio) == REQ_OP_WRITE) {
|
||||
if (end_io_wq->metadata == BTRFS_WQ_ENDIO_METADATA) {
|
||||
@@ -836,19 +836,19 @@ static void end_workqueue_bio(struct bio *bio)
|
||||
btrfs_queue_work(wq, &end_io_wq->work);
|
||||
}
|
||||
|
||||
int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio,
|
||||
blk_status_t btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio,
|
||||
enum btrfs_wq_endio_type metadata)
|
||||
{
|
||||
struct btrfs_end_io_wq *end_io_wq;
|
||||
|
||||
end_io_wq = kmem_cache_alloc(btrfs_end_io_wq_cache, GFP_NOFS);
|
||||
if (!end_io_wq)
|
||||
return -ENOMEM;
|
||||
return BLK_STS_RESOURCE;
|
||||
|
||||
end_io_wq->private = bio->bi_private;
|
||||
end_io_wq->end_io = bio->bi_end_io;
|
||||
end_io_wq->info = info;
|
||||
end_io_wq->error = 0;
|
||||
end_io_wq->status = 0;
|
||||
end_io_wq->bio = bio;
|
||||
end_io_wq->metadata = metadata;
|
||||
|
||||
@@ -868,14 +868,14 @@ unsigned long btrfs_async_submit_limit(struct btrfs_fs_info *info)
|
||||
static void run_one_async_start(struct btrfs_work *work)
|
||||
{
|
||||
struct async_submit_bio *async;
|
||||
int ret;
|
||||
blk_status_t ret;
|
||||
|
||||
async = container_of(work, struct async_submit_bio, work);
|
||||
ret = async->submit_bio_start(async->inode, async->bio,
|
||||
async->mirror_num, async->bio_flags,
|
||||
async->bio_offset);
|
||||
if (ret)
|
||||
async->error = ret;
|
||||
async->status = ret;
|
||||
}
|
||||
|
||||
static void run_one_async_done(struct btrfs_work *work)
|
||||
@@ -898,8 +898,8 @@ static void run_one_async_done(struct btrfs_work *work)
|
||||
wake_up(&fs_info->async_submit_wait);
|
||||
|
||||
/* If an error occurred we just want to clean up the bio and move on */
|
||||
if (async->error) {
|
||||
async->bio->bi_error = async->error;
|
||||
if (async->status) {
|
||||
async->bio->bi_status = async->status;
|
||||
bio_endio(async->bio);
|
||||
return;
|
||||
}
|
||||
@@ -916,18 +916,17 @@ static void run_one_async_free(struct btrfs_work *work)
|
||||
kfree(async);
|
||||
}
|
||||
|
||||
int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode,
|
||||
struct bio *bio, int mirror_num,
|
||||
unsigned long bio_flags,
|
||||
u64 bio_offset,
|
||||
extent_submit_bio_hook_t *submit_bio_start,
|
||||
extent_submit_bio_hook_t *submit_bio_done)
|
||||
blk_status_t btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info,
|
||||
struct inode *inode, struct bio *bio, int mirror_num,
|
||||
unsigned long bio_flags, u64 bio_offset,
|
||||
extent_submit_bio_hook_t *submit_bio_start,
|
||||
extent_submit_bio_hook_t *submit_bio_done)
|
||||
{
|
||||
struct async_submit_bio *async;
|
||||
|
||||
async = kmalloc(sizeof(*async), GFP_NOFS);
|
||||
if (!async)
|
||||
return -ENOMEM;
|
||||
return BLK_STS_RESOURCE;
|
||||
|
||||
async->inode = inode;
|
||||
async->bio = bio;
|
||||
@@ -941,7 +940,7 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode,
|
||||
async->bio_flags = bio_flags;
|
||||
async->bio_offset = bio_offset;
|
||||
|
||||
async->error = 0;
|
||||
async->status = 0;
|
||||
|
||||
atomic_inc(&fs_info->nr_async_submits);
|
||||
|
||||
@@ -959,7 +958,7 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int btree_csum_one_bio(struct bio *bio)
|
||||
static blk_status_t btree_csum_one_bio(struct bio *bio)
|
||||
{
|
||||
struct bio_vec *bvec;
|
||||
struct btrfs_root *root;
|
||||
@@ -972,12 +971,12 @@ static int btree_csum_one_bio(struct bio *bio)
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return errno_to_blk_status(ret);
|
||||
}
|
||||
|
||||
static int __btree_submit_bio_start(struct inode *inode, struct bio *bio,
|
||||
int mirror_num, unsigned long bio_flags,
|
||||
u64 bio_offset)
|
||||
static blk_status_t __btree_submit_bio_start(struct inode *inode,
|
||||
struct bio *bio, int mirror_num, unsigned long bio_flags,
|
||||
u64 bio_offset)
|
||||
{
|
||||
/*
|
||||
* when we're called for a write, we're already in the async
|
||||
@@ -986,11 +985,11 @@ static int __btree_submit_bio_start(struct inode *inode, struct bio *bio,
|
||||
return btree_csum_one_bio(bio);
|
||||
}
|
||||
|
||||
static int __btree_submit_bio_done(struct inode *inode, struct bio *bio,
|
||||
int mirror_num, unsigned long bio_flags,
|
||||
u64 bio_offset)
|
||||
static blk_status_t __btree_submit_bio_done(struct inode *inode,
|
||||
struct bio *bio, int mirror_num, unsigned long bio_flags,
|
||||
u64 bio_offset)
|
||||
{
|
||||
int ret;
|
||||
blk_status_t ret;
|
||||
|
||||
/*
|
||||
* when we're called for a write, we're already in the async
|
||||
@@ -998,7 +997,7 @@ static int __btree_submit_bio_done(struct inode *inode, struct bio *bio,
|
||||
*/
|
||||
ret = btrfs_map_bio(btrfs_sb(inode->i_sb), bio, mirror_num, 1);
|
||||
if (ret) {
|
||||
bio->bi_error = ret;
|
||||
bio->bi_status = ret;
|
||||
bio_endio(bio);
|
||||
}
|
||||
return ret;
|
||||
@@ -1015,13 +1014,13 @@ static int check_async_write(unsigned long bio_flags)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int btree_submit_bio_hook(struct inode *inode, struct bio *bio,
|
||||
static blk_status_t btree_submit_bio_hook(struct inode *inode, struct bio *bio,
|
||||
int mirror_num, unsigned long bio_flags,
|
||||
u64 bio_offset)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
|
||||
int async = check_async_write(bio_flags);
|
||||
int ret;
|
||||
blk_status_t ret;
|
||||
|
||||
if (bio_op(bio) != REQ_OP_WRITE) {
|
||||
/*
|
||||
@@ -1054,7 +1053,7 @@ static int btree_submit_bio_hook(struct inode *inode, struct bio *bio,
|
||||
return 0;
|
||||
|
||||
out_w_error:
|
||||
bio->bi_error = ret;
|
||||
bio->bi_status = ret;
|
||||
bio_endio(bio);
|
||||
return ret;
|
||||
}
|
||||
@@ -1820,7 +1819,7 @@ static void end_workqueue_fn(struct btrfs_work *work)
|
||||
end_io_wq = container_of(work, struct btrfs_end_io_wq, work);
|
||||
bio = end_io_wq->bio;
|
||||
|
||||
bio->bi_error = end_io_wq->error;
|
||||
bio->bi_status = end_io_wq->status;
|
||||
bio->bi_private = end_io_wq->private;
|
||||
bio->bi_end_io = end_io_wq->end_io;
|
||||
kmem_cache_free(btrfs_end_io_wq_cache, end_io_wq);
|
||||
@@ -3495,11 +3494,11 @@ static void btrfs_end_empty_barrier(struct bio *bio)
|
||||
* any device where the flush fails with eopnotsupp are flagged as not-barrier
|
||||
* capable
|
||||
*/
|
||||
static int write_dev_flush(struct btrfs_device *device, int wait)
|
||||
static blk_status_t write_dev_flush(struct btrfs_device *device, int wait)
|
||||
{
|
||||
struct request_queue *q = bdev_get_queue(device->bdev);
|
||||
struct bio *bio;
|
||||
int ret = 0;
|
||||
blk_status_t ret = 0;
|
||||
|
||||
if (!test_bit(QUEUE_FLAG_WC, &q->queue_flags))
|
||||
return 0;
|
||||
@@ -3511,8 +3510,8 @@ static int write_dev_flush(struct btrfs_device *device, int wait)
|
||||
|
||||
wait_for_completion(&device->flush_wait);
|
||||
|
||||
if (bio->bi_error) {
|
||||
ret = bio->bi_error;
|
||||
if (bio->bi_status) {
|
||||
ret = bio->bi_status;
|
||||
btrfs_dev_stat_inc_and_print(device,
|
||||
BTRFS_DEV_STAT_FLUSH_ERRS);
|
||||
}
|
||||
@@ -3531,7 +3530,7 @@ static int write_dev_flush(struct btrfs_device *device, int wait)
|
||||
device->flush_bio = NULL;
|
||||
bio = btrfs_io_bio_alloc(GFP_NOFS, 0);
|
||||
if (!bio)
|
||||
return -ENOMEM;
|
||||
return BLK_STS_RESOURCE;
|
||||
|
||||
bio->bi_end_io = btrfs_end_empty_barrier;
|
||||
bio->bi_bdev = device->bdev;
|
||||
@@ -3556,7 +3555,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
|
||||
struct btrfs_device *dev;
|
||||
int errors_send = 0;
|
||||
int errors_wait = 0;
|
||||
int ret;
|
||||
blk_status_t ret;
|
||||
|
||||
/* send down all the barriers */
|
||||
head = &info->fs_devices->devices;
|
||||
|
@@ -118,13 +118,13 @@ int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid,
|
||||
int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid);
|
||||
u32 btrfs_csum_data(const char *data, u32 seed, size_t len);
|
||||
void btrfs_csum_final(u32 crc, u8 *result);
|
||||
int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio,
|
||||
blk_status_t btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio,
|
||||
enum btrfs_wq_endio_type metadata);
|
||||
int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode,
|
||||
struct bio *bio, int mirror_num,
|
||||
unsigned long bio_flags, u64 bio_offset,
|
||||
extent_submit_bio_hook_t *submit_bio_start,
|
||||
extent_submit_bio_hook_t *submit_bio_done);
|
||||
blk_status_t btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info,
|
||||
struct inode *inode, struct bio *bio, int mirror_num,
|
||||
unsigned long bio_flags, u64 bio_offset,
|
||||
extent_submit_bio_hook_t *submit_bio_start,
|
||||
extent_submit_bio_hook_t *submit_bio_done);
|
||||
unsigned long btrfs_async_submit_limit(struct btrfs_fs_info *info);
|
||||
int btrfs_write_tree_block(struct extent_buffer *buf);
|
||||
int btrfs_wait_tree_block_writeback(struct extent_buffer *buf);
|
||||
|
@@ -2399,6 +2399,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset,
|
||||
struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree;
|
||||
struct bio *bio;
|
||||
int read_mode = 0;
|
||||
blk_status_t status;
|
||||
int ret;
|
||||
|
||||
BUG_ON(bio_op(failed_bio) == REQ_OP_WRITE);
|
||||
@@ -2431,11 +2432,12 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset,
|
||||
"Repair Read Error: submitting new read[%#x] to this_mirror=%d, in_validation=%d",
|
||||
read_mode, failrec->this_mirror, failrec->in_validation);
|
||||
|
||||
ret = tree->ops->submit_bio_hook(inode, bio, failrec->this_mirror,
|
||||
status = tree->ops->submit_bio_hook(inode, bio, failrec->this_mirror,
|
||||
failrec->bio_flags, 0);
|
||||
if (ret) {
|
||||
if (status) {
|
||||
free_io_failure(BTRFS_I(inode), failrec);
|
||||
bio_put(bio);
|
||||
ret = blk_status_to_errno(status);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -2474,6 +2476,7 @@ void end_extent_writepage(struct page *page, int err, u64 start, u64 end)
|
||||
*/
|
||||
static void end_bio_extent_writepage(struct bio *bio)
|
||||
{
|
||||
int error = blk_status_to_errno(bio->bi_status);
|
||||
struct bio_vec *bvec;
|
||||
u64 start;
|
||||
u64 end;
|
||||
@@ -2503,7 +2506,7 @@ static void end_bio_extent_writepage(struct bio *bio)
|
||||
start = page_offset(page);
|
||||
end = start + bvec->bv_offset + bvec->bv_len - 1;
|
||||
|
||||
end_extent_writepage(page, bio->bi_error, start, end);
|
||||
end_extent_writepage(page, error, start, end);
|
||||
end_page_writeback(page);
|
||||
}
|
||||
|
||||
@@ -2536,7 +2539,7 @@ endio_readpage_release_extent(struct extent_io_tree *tree, u64 start, u64 len,
|
||||
static void end_bio_extent_readpage(struct bio *bio)
|
||||
{
|
||||
struct bio_vec *bvec;
|
||||
int uptodate = !bio->bi_error;
|
||||
int uptodate = !bio->bi_status;
|
||||
struct btrfs_io_bio *io_bio = btrfs_io_bio(bio);
|
||||
struct extent_io_tree *tree;
|
||||
u64 offset = 0;
|
||||
@@ -2556,7 +2559,7 @@ static void end_bio_extent_readpage(struct bio *bio)
|
||||
|
||||
btrfs_debug(fs_info,
|
||||
"end_bio_extent_readpage: bi_sector=%llu, err=%d, mirror=%u",
|
||||
(u64)bio->bi_iter.bi_sector, bio->bi_error,
|
||||
(u64)bio->bi_iter.bi_sector, bio->bi_status,
|
||||
io_bio->mirror_num);
|
||||
tree = &BTRFS_I(inode)->io_tree;
|
||||
|
||||
@@ -2615,7 +2618,7 @@ static void end_bio_extent_readpage(struct bio *bio)
|
||||
ret = bio_readpage_error(bio, offset, page,
|
||||
start, end, mirror);
|
||||
if (ret == 0) {
|
||||
uptodate = !bio->bi_error;
|
||||
uptodate = !bio->bi_status;
|
||||
offset += len;
|
||||
continue;
|
||||
}
|
||||
@@ -2673,7 +2676,7 @@ readpage_ok:
|
||||
endio_readpage_release_extent(tree, extent_start, extent_len,
|
||||
uptodate);
|
||||
if (io_bio->end_io)
|
||||
io_bio->end_io(io_bio, bio->bi_error);
|
||||
io_bio->end_io(io_bio, blk_status_to_errno(bio->bi_status));
|
||||
bio_put(bio);
|
||||
}
|
||||
|
||||
@@ -2743,7 +2746,7 @@ struct bio *btrfs_io_bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs)
|
||||
static int __must_check submit_one_bio(struct bio *bio, int mirror_num,
|
||||
unsigned long bio_flags)
|
||||
{
|
||||
int ret = 0;
|
||||
blk_status_t ret = 0;
|
||||
struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
|
||||
struct page *page = bvec->bv_page;
|
||||
struct extent_io_tree *tree = bio->bi_private;
|
||||
@@ -2761,7 +2764,7 @@ static int __must_check submit_one_bio(struct bio *bio, int mirror_num,
|
||||
btrfsic_submit_bio(bio);
|
||||
|
||||
bio_put(bio);
|
||||
return ret;
|
||||
return blk_status_to_errno(ret);
|
||||
}
|
||||
|
||||
static int merge_bio(struct extent_io_tree *tree, struct page *page,
|
||||
@@ -3707,7 +3710,7 @@ static void end_bio_extent_buffer_writepage(struct bio *bio)
|
||||
BUG_ON(!eb);
|
||||
done = atomic_dec_and_test(&eb->io_pages);
|
||||
|
||||
if (bio->bi_error ||
|
||||
if (bio->bi_status ||
|
||||
test_bit(EXTENT_BUFFER_WRITE_ERR, &eb->bflags)) {
|
||||
ClearPageUptodate(page);
|
||||
set_btree_ioerr(page);
|
||||
|
@@ -92,9 +92,9 @@ struct btrfs_inode;
|
||||
struct btrfs_io_bio;
|
||||
struct io_failure_record;
|
||||
|
||||
typedef int (extent_submit_bio_hook_t)(struct inode *inode, struct bio *bio,
|
||||
int mirror_num, unsigned long bio_flags,
|
||||
u64 bio_offset);
|
||||
typedef blk_status_t (extent_submit_bio_hook_t)(struct inode *inode,
|
||||
struct bio *bio, int mirror_num, unsigned long bio_flags,
|
||||
u64 bio_offset);
|
||||
struct extent_io_ops {
|
||||
/*
|
||||
* The following callbacks must be allways defined, the function
|
||||
|
@@ -160,7 +160,7 @@ static void btrfs_io_bio_endio_readpage(struct btrfs_io_bio *bio, int err)
|
||||
kfree(bio->csum_allocated);
|
||||
}
|
||||
|
||||
static int __btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio,
|
||||
static blk_status_t __btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio,
|
||||
u64 logical_offset, u32 *dst, int dio)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
|
||||
@@ -182,7 +182,7 @@ static int __btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio,
|
||||
|
||||
path = btrfs_alloc_path();
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
return BLK_STS_RESOURCE;
|
||||
|
||||
nblocks = bio->bi_iter.bi_size >> inode->i_sb->s_blocksize_bits;
|
||||
if (!dst) {
|
||||
@@ -191,7 +191,7 @@ static int __btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio,
|
||||
csum_size, GFP_NOFS);
|
||||
if (!btrfs_bio->csum_allocated) {
|
||||
btrfs_free_path(path);
|
||||
return -ENOMEM;
|
||||
return BLK_STS_RESOURCE;
|
||||
}
|
||||
btrfs_bio->csum = btrfs_bio->csum_allocated;
|
||||
btrfs_bio->end_io = btrfs_io_bio_endio_readpage;
|
||||
@@ -303,12 +303,12 @@ next:
|
||||
return 0;
|
||||
}
|
||||
|
||||
int btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio, u32 *dst)
|
||||
blk_status_t btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio, u32 *dst)
|
||||
{
|
||||
return __btrfs_lookup_bio_sums(inode, bio, 0, dst, 0);
|
||||
}
|
||||
|
||||
int btrfs_lookup_bio_sums_dio(struct inode *inode, struct bio *bio, u64 offset)
|
||||
blk_status_t btrfs_lookup_bio_sums_dio(struct inode *inode, struct bio *bio, u64 offset)
|
||||
{
|
||||
return __btrfs_lookup_bio_sums(inode, bio, offset, NULL, 1);
|
||||
}
|
||||
@@ -433,7 +433,7 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int btrfs_csum_one_bio(struct inode *inode, struct bio *bio,
|
||||
blk_status_t btrfs_csum_one_bio(struct inode *inode, struct bio *bio,
|
||||
u64 file_start, int contig)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
|
||||
@@ -452,7 +452,7 @@ int btrfs_csum_one_bio(struct inode *inode, struct bio *bio,
|
||||
sums = kzalloc(btrfs_ordered_sum_size(fs_info, bio->bi_iter.bi_size),
|
||||
GFP_NOFS);
|
||||
if (!sums)
|
||||
return -ENOMEM;
|
||||
return BLK_STS_RESOURCE;
|
||||
|
||||
sums->len = bio->bi_iter.bi_size;
|
||||
INIT_LIST_HEAD(&sums->list);
|
||||
|
@@ -842,13 +842,12 @@ retry:
|
||||
NULL, EXTENT_LOCKED | EXTENT_DELALLOC,
|
||||
PAGE_UNLOCK | PAGE_CLEAR_DIRTY |
|
||||
PAGE_SET_WRITEBACK);
|
||||
ret = btrfs_submit_compressed_write(inode,
|
||||
if (btrfs_submit_compressed_write(inode,
|
||||
async_extent->start,
|
||||
async_extent->ram_size,
|
||||
ins.objectid,
|
||||
ins.offset, async_extent->pages,
|
||||
async_extent->nr_pages);
|
||||
if (ret) {
|
||||
async_extent->nr_pages)) {
|
||||
struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree;
|
||||
struct page *p = async_extent->pages[0];
|
||||
const u64 start = async_extent->start;
|
||||
@@ -1901,11 +1900,11 @@ int btrfs_merge_bio_hook(struct page *page, unsigned long offset,
|
||||
* At IO completion time the cums attached on the ordered extent record
|
||||
* are inserted into the btree
|
||||
*/
|
||||
static int __btrfs_submit_bio_start(struct inode *inode, struct bio *bio,
|
||||
int mirror_num, unsigned long bio_flags,
|
||||
u64 bio_offset)
|
||||
static blk_status_t __btrfs_submit_bio_start(struct inode *inode,
|
||||
struct bio *bio, int mirror_num, unsigned long bio_flags,
|
||||
u64 bio_offset)
|
||||
{
|
||||
int ret = 0;
|
||||
blk_status_t ret = 0;
|
||||
|
||||
ret = btrfs_csum_one_bio(inode, bio, 0, 0);
|
||||
BUG_ON(ret); /* -ENOMEM */
|
||||
@@ -1920,16 +1919,16 @@ static int __btrfs_submit_bio_start(struct inode *inode, struct bio *bio,
|
||||
* At IO completion time the cums attached on the ordered extent record
|
||||
* are inserted into the btree
|
||||
*/
|
||||
static int __btrfs_submit_bio_done(struct inode *inode, struct bio *bio,
|
||||
int mirror_num, unsigned long bio_flags,
|
||||
u64 bio_offset)
|
||||
static blk_status_t __btrfs_submit_bio_done(struct inode *inode,
|
||||
struct bio *bio, int mirror_num, unsigned long bio_flags,
|
||||
u64 bio_offset)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
|
||||
int ret;
|
||||
blk_status_t ret;
|
||||
|
||||
ret = btrfs_map_bio(fs_info, bio, mirror_num, 1);
|
||||
if (ret) {
|
||||
bio->bi_error = ret;
|
||||
bio->bi_status = ret;
|
||||
bio_endio(bio);
|
||||
}
|
||||
return ret;
|
||||
@@ -1939,14 +1938,14 @@ static int __btrfs_submit_bio_done(struct inode *inode, struct bio *bio,
|
||||
* extent_io.c submission hook. This does the right thing for csum calculation
|
||||
* on write, or reading the csums from the tree before a read
|
||||
*/
|
||||
static int btrfs_submit_bio_hook(struct inode *inode, struct bio *bio,
|
||||
static blk_status_t btrfs_submit_bio_hook(struct inode *inode, struct bio *bio,
|
||||
int mirror_num, unsigned long bio_flags,
|
||||
u64 bio_offset)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
enum btrfs_wq_endio_type metadata = BTRFS_WQ_ENDIO_DATA;
|
||||
int ret = 0;
|
||||
blk_status_t ret = 0;
|
||||
int skip_sum;
|
||||
int async = !atomic_read(&BTRFS_I(inode)->sync_writers);
|
||||
|
||||
@@ -1991,8 +1990,8 @@ mapit:
|
||||
ret = btrfs_map_bio(fs_info, bio, mirror_num, 0);
|
||||
|
||||
out:
|
||||
if (ret < 0) {
|
||||
bio->bi_error = ret;
|
||||
if (ret) {
|
||||
bio->bi_status = ret;
|
||||
bio_endio(bio);
|
||||
}
|
||||
return ret;
|
||||
@@ -8037,7 +8036,7 @@ static void btrfs_retry_endio_nocsum(struct bio *bio)
|
||||
struct bio_vec *bvec;
|
||||
int i;
|
||||
|
||||
if (bio->bi_error)
|
||||
if (bio->bi_status)
|
||||
goto end;
|
||||
|
||||
ASSERT(bio->bi_vcnt == 1);
|
||||
@@ -8116,7 +8115,7 @@ static void btrfs_retry_endio(struct bio *bio)
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
if (bio->bi_error)
|
||||
if (bio->bi_status)
|
||||
goto end;
|
||||
|
||||
uptodate = 1;
|
||||
@@ -8141,8 +8140,8 @@ end:
|
||||
bio_put(bio);
|
||||
}
|
||||
|
||||
static int __btrfs_subio_endio_read(struct inode *inode,
|
||||
struct btrfs_io_bio *io_bio, int err)
|
||||
static blk_status_t __btrfs_subio_endio_read(struct inode *inode,
|
||||
struct btrfs_io_bio *io_bio, blk_status_t err)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info;
|
||||
struct bio_vec *bvec;
|
||||
@@ -8184,7 +8183,7 @@ try_again:
|
||||
io_bio->mirror_num,
|
||||
btrfs_retry_endio, &done);
|
||||
if (ret) {
|
||||
err = ret;
|
||||
err = errno_to_blk_status(ret);
|
||||
goto next;
|
||||
}
|
||||
|
||||
@@ -8211,8 +8210,8 @@ next:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int btrfs_subio_endio_read(struct inode *inode,
|
||||
struct btrfs_io_bio *io_bio, int err)
|
||||
static blk_status_t btrfs_subio_endio_read(struct inode *inode,
|
||||
struct btrfs_io_bio *io_bio, blk_status_t err)
|
||||
{
|
||||
bool skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;
|
||||
|
||||
@@ -8232,7 +8231,7 @@ static void btrfs_endio_direct_read(struct bio *bio)
|
||||
struct inode *inode = dip->inode;
|
||||
struct bio *dio_bio;
|
||||
struct btrfs_io_bio *io_bio = btrfs_io_bio(bio);
|
||||
int err = bio->bi_error;
|
||||
blk_status_t err = bio->bi_status;
|
||||
|
||||
if (dip->flags & BTRFS_DIO_ORIG_BIO_SUBMITTED)
|
||||
err = btrfs_subio_endio_read(inode, io_bio, err);
|
||||
@@ -8243,11 +8242,11 @@ static void btrfs_endio_direct_read(struct bio *bio)
|
||||
|
||||
kfree(dip);
|
||||
|
||||
dio_bio->bi_error = bio->bi_error;
|
||||
dio_bio->bi_status = bio->bi_status;
|
||||
dio_end_io(dio_bio);
|
||||
|
||||
if (io_bio->end_io)
|
||||
io_bio->end_io(io_bio, err);
|
||||
io_bio->end_io(io_bio, blk_status_to_errno(err));
|
||||
bio_put(bio);
|
||||
}
|
||||
|
||||
@@ -8299,20 +8298,20 @@ static void btrfs_endio_direct_write(struct bio *bio)
|
||||
struct bio *dio_bio = dip->dio_bio;
|
||||
|
||||
__endio_write_update_ordered(dip->inode, dip->logical_offset,
|
||||
dip->bytes, !bio->bi_error);
|
||||
dip->bytes, !bio->bi_status);
|
||||
|
||||
kfree(dip);
|
||||
|
||||
dio_bio->bi_error = bio->bi_error;
|
||||
dio_bio->bi_status = bio->bi_status;
|
||||
dio_end_io(dio_bio);
|
||||
bio_put(bio);
|
||||
}
|
||||
|
||||
static int __btrfs_submit_bio_start_direct_io(struct inode *inode,
|
||||
static blk_status_t __btrfs_submit_bio_start_direct_io(struct inode *inode,
|
||||
struct bio *bio, int mirror_num,
|
||||
unsigned long bio_flags, u64 offset)
|
||||
{
|
||||
int ret;
|
||||
blk_status_t ret;
|
||||
ret = btrfs_csum_one_bio(inode, bio, offset, 1);
|
||||
BUG_ON(ret); /* -ENOMEM */
|
||||
return 0;
|
||||
@@ -8321,7 +8320,7 @@ static int __btrfs_submit_bio_start_direct_io(struct inode *inode,
|
||||
static void btrfs_end_dio_bio(struct bio *bio)
|
||||
{
|
||||
struct btrfs_dio_private *dip = bio->bi_private;
|
||||
int err = bio->bi_error;
|
||||
blk_status_t err = bio->bi_status;
|
||||
|
||||
if (err)
|
||||
btrfs_warn(BTRFS_I(dip->inode)->root->fs_info,
|
||||
@@ -8351,7 +8350,7 @@ static void btrfs_end_dio_bio(struct bio *bio)
|
||||
if (dip->errors) {
|
||||
bio_io_error(dip->orig_bio);
|
||||
} else {
|
||||
dip->dio_bio->bi_error = 0;
|
||||
dip->dio_bio->bi_status = 0;
|
||||
bio_endio(dip->orig_bio);
|
||||
}
|
||||
out:
|
||||
@@ -8368,14 +8367,14 @@ static struct bio *btrfs_dio_bio_alloc(struct block_device *bdev,
|
||||
return bio;
|
||||
}
|
||||
|
||||
static inline int btrfs_lookup_and_bind_dio_csum(struct inode *inode,
|
||||
static inline blk_status_t btrfs_lookup_and_bind_dio_csum(struct inode *inode,
|
||||
struct btrfs_dio_private *dip,
|
||||
struct bio *bio,
|
||||
u64 file_offset)
|
||||
{
|
||||
struct btrfs_io_bio *io_bio = btrfs_io_bio(bio);
|
||||
struct btrfs_io_bio *orig_io_bio = btrfs_io_bio(dip->orig_bio);
|
||||
int ret;
|
||||
blk_status_t ret;
|
||||
|
||||
/*
|
||||
* We load all the csum data we need when we submit
|
||||
@@ -8406,7 +8405,7 @@ static inline int __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode,
|
||||
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
|
||||
struct btrfs_dio_private *dip = bio->bi_private;
|
||||
bool write = bio_op(bio) == REQ_OP_WRITE;
|
||||
int ret;
|
||||
blk_status_t ret;
|
||||
|
||||
if (async_submit)
|
||||
async_submit = !atomic_read(&BTRFS_I(inode)->sync_writers);
|
||||
@@ -8649,7 +8648,7 @@ free_ordered:
|
||||
* callbacks - they require an allocated dip and a clone of dio_bio.
|
||||
*/
|
||||
if (io_bio && dip) {
|
||||
io_bio->bi_error = -EIO;
|
||||
io_bio->bi_status = BLK_STS_IOERR;
|
||||
bio_endio(io_bio);
|
||||
/*
|
||||
* The end io callbacks free our dip, do the final put on io_bio
|
||||
@@ -8668,7 +8667,7 @@ free_ordered:
|
||||
unlock_extent(&BTRFS_I(inode)->io_tree, file_offset,
|
||||
file_offset + dio_bio->bi_iter.bi_size - 1);
|
||||
|
||||
dio_bio->bi_error = -EIO;
|
||||
dio_bio->bi_status = BLK_STS_IOERR;
|
||||
/*
|
||||
* Releases and cleans up our dio_bio, no need to bio_put()
|
||||
* nor bio_endio()/bio_io_error() against dio_bio.
|
||||
|
@@ -871,7 +871,7 @@ static void free_raid_bio(struct btrfs_raid_bio *rbio)
|
||||
* this frees the rbio and runs through all the bios in the
|
||||
* bio_list and calls end_io on them
|
||||
*/
|
||||
static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, int err)
|
||||
static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, blk_status_t err)
|
||||
{
|
||||
struct bio *cur = bio_list_get(&rbio->bio_list);
|
||||
struct bio *next;
|
||||
@@ -884,7 +884,7 @@ static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, int err)
|
||||
while (cur) {
|
||||
next = cur->bi_next;
|
||||
cur->bi_next = NULL;
|
||||
cur->bi_error = err;
|
||||
cur->bi_status = err;
|
||||
bio_endio(cur);
|
||||
cur = next;
|
||||
}
|
||||
@@ -897,7 +897,7 @@ static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, int err)
|
||||
static void raid_write_end_io(struct bio *bio)
|
||||
{
|
||||
struct btrfs_raid_bio *rbio = bio->bi_private;
|
||||
int err = bio->bi_error;
|
||||
blk_status_t err = bio->bi_status;
|
||||
int max_errors;
|
||||
|
||||
if (err)
|
||||
@@ -914,7 +914,7 @@ static void raid_write_end_io(struct bio *bio)
|
||||
max_errors = (rbio->operation == BTRFS_RBIO_PARITY_SCRUB) ?
|
||||
0 : rbio->bbio->max_errors;
|
||||
if (atomic_read(&rbio->error) > max_errors)
|
||||
err = -EIO;
|
||||
err = BLK_STS_IOERR;
|
||||
|
||||
rbio_orig_end_io(rbio, err);
|
||||
}
|
||||
@@ -1092,7 +1092,7 @@ static int rbio_add_io_page(struct btrfs_raid_bio *rbio,
|
||||
* devices or if they are not contiguous
|
||||
*/
|
||||
if (last_end == disk_start && stripe->dev->bdev &&
|
||||
!last->bi_error &&
|
||||
!last->bi_status &&
|
||||
last->bi_bdev == stripe->dev->bdev) {
|
||||
ret = bio_add_page(last, page, PAGE_SIZE, 0);
|
||||
if (ret == PAGE_SIZE)
|
||||
@@ -1448,7 +1448,7 @@ static void raid_rmw_end_io(struct bio *bio)
|
||||
{
|
||||
struct btrfs_raid_bio *rbio = bio->bi_private;
|
||||
|
||||
if (bio->bi_error)
|
||||
if (bio->bi_status)
|
||||
fail_bio_stripe(rbio, bio);
|
||||
else
|
||||
set_bio_pages_uptodate(bio);
|
||||
@@ -1991,7 +1991,7 @@ static void raid_recover_end_io(struct bio *bio)
|
||||
* we only read stripe pages off the disk, set them
|
||||
* up to date if there were no errors
|
||||
*/
|
||||
if (bio->bi_error)
|
||||
if (bio->bi_status)
|
||||
fail_bio_stripe(rbio, bio);
|
||||
else
|
||||
set_bio_pages_uptodate(bio);
|
||||
@@ -2530,7 +2530,7 @@ static void raid56_parity_scrub_end_io(struct bio *bio)
|
||||
{
|
||||
struct btrfs_raid_bio *rbio = bio->bi_private;
|
||||
|
||||
if (bio->bi_error)
|
||||
if (bio->bi_status)
|
||||
fail_bio_stripe(rbio, bio);
|
||||
else
|
||||
set_bio_pages_uptodate(bio);
|
||||
|
@@ -95,7 +95,7 @@ struct scrub_bio {
|
||||
struct scrub_ctx *sctx;
|
||||
struct btrfs_device *dev;
|
||||
struct bio *bio;
|
||||
int err;
|
||||
blk_status_t status;
|
||||
u64 logical;
|
||||
u64 physical;
|
||||
#if SCRUB_PAGES_PER_WR_BIO >= SCRUB_PAGES_PER_RD_BIO
|
||||
@@ -1668,14 +1668,14 @@ leave_nomem:
|
||||
|
||||
struct scrub_bio_ret {
|
||||
struct completion event;
|
||||
int error;
|
||||
blk_status_t status;
|
||||
};
|
||||
|
||||
static void scrub_bio_wait_endio(struct bio *bio)
|
||||
{
|
||||
struct scrub_bio_ret *ret = bio->bi_private;
|
||||
|
||||
ret->error = bio->bi_error;
|
||||
ret->status = bio->bi_status;
|
||||
complete(&ret->event);
|
||||
}
|
||||
|
||||
@@ -1693,7 +1693,7 @@ static int scrub_submit_raid56_bio_wait(struct btrfs_fs_info *fs_info,
|
||||
int ret;
|
||||
|
||||
init_completion(&done.event);
|
||||
done.error = 0;
|
||||
done.status = 0;
|
||||
bio->bi_iter.bi_sector = page->logical >> 9;
|
||||
bio->bi_private = &done;
|
||||
bio->bi_end_io = scrub_bio_wait_endio;
|
||||
@@ -1705,7 +1705,7 @@ static int scrub_submit_raid56_bio_wait(struct btrfs_fs_info *fs_info,
|
||||
return ret;
|
||||
|
||||
wait_for_completion(&done.event);
|
||||
if (done.error)
|
||||
if (done.status)
|
||||
return -EIO;
|
||||
|
||||
return 0;
|
||||
@@ -1937,7 +1937,7 @@ again:
|
||||
bio->bi_bdev = sbio->dev->bdev;
|
||||
bio->bi_iter.bi_sector = sbio->physical >> 9;
|
||||
bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
|
||||
sbio->err = 0;
|
||||
sbio->status = 0;
|
||||
} else if (sbio->physical + sbio->page_count * PAGE_SIZE !=
|
||||
spage->physical_for_dev_replace ||
|
||||
sbio->logical + sbio->page_count * PAGE_SIZE !=
|
||||
@@ -1992,7 +1992,7 @@ static void scrub_wr_bio_end_io(struct bio *bio)
|
||||
struct scrub_bio *sbio = bio->bi_private;
|
||||
struct btrfs_fs_info *fs_info = sbio->dev->fs_info;
|
||||
|
||||
sbio->err = bio->bi_error;
|
||||
sbio->status = bio->bi_status;
|
||||
sbio->bio = bio;
|
||||
|
||||
btrfs_init_work(&sbio->work, btrfs_scrubwrc_helper,
|
||||
@@ -2007,7 +2007,7 @@ static void scrub_wr_bio_end_io_worker(struct btrfs_work *work)
|
||||
int i;
|
||||
|
||||
WARN_ON(sbio->page_count > SCRUB_PAGES_PER_WR_BIO);
|
||||
if (sbio->err) {
|
||||
if (sbio->status) {
|
||||
struct btrfs_dev_replace *dev_replace =
|
||||
&sbio->sctx->fs_info->dev_replace;
|
||||
|
||||
@@ -2341,7 +2341,7 @@ again:
|
||||
bio->bi_bdev = sbio->dev->bdev;
|
||||
bio->bi_iter.bi_sector = sbio->physical >> 9;
|
||||
bio_set_op_attrs(bio, REQ_OP_READ, 0);
|
||||
sbio->err = 0;
|
||||
sbio->status = 0;
|
||||
} else if (sbio->physical + sbio->page_count * PAGE_SIZE !=
|
||||
spage->physical ||
|
||||
sbio->logical + sbio->page_count * PAGE_SIZE !=
|
||||
@@ -2377,7 +2377,7 @@ static void scrub_missing_raid56_end_io(struct bio *bio)
|
||||
struct scrub_block *sblock = bio->bi_private;
|
||||
struct btrfs_fs_info *fs_info = sblock->sctx->fs_info;
|
||||
|
||||
if (bio->bi_error)
|
||||
if (bio->bi_status)
|
||||
sblock->no_io_error_seen = 0;
|
||||
|
||||
bio_put(bio);
|
||||
@@ -2588,7 +2588,7 @@ static void scrub_bio_end_io(struct bio *bio)
|
||||
struct scrub_bio *sbio = bio->bi_private;
|
||||
struct btrfs_fs_info *fs_info = sbio->dev->fs_info;
|
||||
|
||||
sbio->err = bio->bi_error;
|
||||
sbio->status = bio->bi_status;
|
||||
sbio->bio = bio;
|
||||
|
||||
btrfs_queue_work(fs_info->scrub_workers, &sbio->work);
|
||||
@@ -2601,7 +2601,7 @@ static void scrub_bio_end_io_worker(struct btrfs_work *work)
|
||||
int i;
|
||||
|
||||
BUG_ON(sbio->page_count > SCRUB_PAGES_PER_RD_BIO);
|
||||
if (sbio->err) {
|
||||
if (sbio->status) {
|
||||
for (i = 0; i < sbio->page_count; i++) {
|
||||
struct scrub_page *spage = sbio->pagev[i];
|
||||
|
||||
@@ -3004,7 +3004,7 @@ static void scrub_parity_bio_endio(struct bio *bio)
|
||||
struct scrub_parity *sparity = (struct scrub_parity *)bio->bi_private;
|
||||
struct btrfs_fs_info *fs_info = sparity->sctx->fs_info;
|
||||
|
||||
if (bio->bi_error)
|
||||
if (bio->bi_status)
|
||||
bitmap_or(sparity->ebitmap, sparity->ebitmap, sparity->dbitmap,
|
||||
sparity->nsectors);
|
||||
|
||||
|
@@ -6042,9 +6042,10 @@ static void btrfs_end_bio(struct bio *bio)
|
||||
struct btrfs_bio *bbio = bio->bi_private;
|
||||
int is_orig_bio = 0;
|
||||
|
||||
if (bio->bi_error) {
|
||||
if (bio->bi_status) {
|
||||
atomic_inc(&bbio->error);
|
||||
if (bio->bi_error == -EIO || bio->bi_error == -EREMOTEIO) {
|
||||
if (bio->bi_status == BLK_STS_IOERR ||
|
||||
bio->bi_status == BLK_STS_TARGET) {
|
||||
unsigned int stripe_index =
|
||||
btrfs_io_bio(bio)->stripe_index;
|
||||
struct btrfs_device *dev;
|
||||
@@ -6082,13 +6083,13 @@ static void btrfs_end_bio(struct bio *bio)
|
||||
* beyond the tolerance of the btrfs bio
|
||||
*/
|
||||
if (atomic_read(&bbio->error) > bbio->max_errors) {
|
||||
bio->bi_error = -EIO;
|
||||
bio->bi_status = BLK_STS_IOERR;
|
||||
} else {
|
||||
/*
|
||||
* this bio is actually up to date, we didn't
|
||||
* go over the max number of errors
|
||||
*/
|
||||
bio->bi_error = 0;
|
||||
bio->bi_status = 0;
|
||||
}
|
||||
|
||||
btrfs_end_bbio(bbio, bio);
|
||||
@@ -6199,7 +6200,7 @@ static void bbio_error(struct btrfs_bio *bbio, struct bio *bio, u64 logical)
|
||||
|
||||
btrfs_io_bio(bio)->mirror_num = bbio->mirror_num;
|
||||
bio->bi_iter.bi_sector = logical >> 9;
|
||||
bio->bi_error = -EIO;
|
||||
bio->bi_status = BLK_STS_IOERR;
|
||||
btrfs_end_bbio(bbio, bio);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user