提交 f0b9a450 编写于 作者: M Mikulas Patocka 提交者: Alasdair G Kergon

dm: move bio_io_error into __split_and_process_bio

Move the bio_io_error() calls directly into __split_and_process_bio().

This avoids some code duplication in later patches.
Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
上级 8a53c28d
...@@ -828,18 +828,20 @@ static int __clone_and_map(struct clone_info *ci) ...@@ -828,18 +828,20 @@ static int __clone_and_map(struct clone_info *ci)
/* /*
* Split the bio into several clones and submit it to targets. * Split the bio into several clones and submit it to targets.
*/ */
static int __split_and_process_bio(struct mapped_device *md, struct bio *bio) static void __split_and_process_bio(struct mapped_device *md, struct bio *bio)
{ {
struct clone_info ci; struct clone_info ci;
int error = 0; int error = 0;
ci.map = dm_get_table(md); ci.map = dm_get_table(md);
if (unlikely(!ci.map)) if (unlikely(!ci.map)) {
return -EIO; bio_io_error(bio);
return;
}
if (unlikely(bio_barrier(bio) && !dm_table_barrier_ok(ci.map))) { if (unlikely(bio_barrier(bio) && !dm_table_barrier_ok(ci.map))) {
dm_table_put(ci.map); dm_table_put(ci.map);
bio_endio(bio, -EOPNOTSUPP); bio_endio(bio, -EOPNOTSUPP);
return 0; return;
} }
ci.md = md; ci.md = md;
ci.bio = bio; ci.bio = bio;
...@@ -859,8 +861,6 @@ static int __split_and_process_bio(struct mapped_device *md, struct bio *bio) ...@@ -859,8 +861,6 @@ static int __split_and_process_bio(struct mapped_device *md, struct bio *bio)
/* drop the extra reference count */ /* drop the extra reference count */
dec_pending(ci.io, error); dec_pending(ci.io, error);
dm_table_put(ci.map); dm_table_put(ci.map);
return 0;
} }
/*----------------------------------------------------------------- /*-----------------------------------------------------------------
* CRUD END * CRUD END
...@@ -951,8 +951,9 @@ static int dm_request(struct request_queue *q, struct bio *bio) ...@@ -951,8 +951,9 @@ static int dm_request(struct request_queue *q, struct bio *bio)
down_read(&md->io_lock); down_read(&md->io_lock);
} }
r = __split_and_process_bio(md, bio); __split_and_process_bio(md, bio);
up_read(&md->io_lock); up_read(&md->io_lock);
return 0;
out_req: out_req:
if (r < 0) if (r < 0)
...@@ -1404,10 +1405,8 @@ static void __flush_deferred_io(struct mapped_device *md) ...@@ -1404,10 +1405,8 @@ static void __flush_deferred_io(struct mapped_device *md)
{ {
struct bio *c; struct bio *c;
while ((c = bio_list_pop(&md->deferred))) { while ((c = bio_list_pop(&md->deferred)))
if (__split_and_process_bio(md, c)) __split_and_process_bio(md, c);
bio_io_error(c);
}
clear_bit(DMF_BLOCK_IO, &md->flags); clear_bit(DMF_BLOCK_IO, &md->flags);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册