Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213197
b: refs/heads/master
c: b372d36
h: refs/heads/master
i:
  213195: 9e61a35
v: v3
  • Loading branch information
Mike Snitzer authored and Jens Axboe committed Sep 10, 2010
1 parent 65a3cb2 commit ca394dd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 05447420f99c1c44063c7f00054667c022cc1365
refs/heads/master: b372d360df6deaf79a58a02fa0cc0d7e0aa3e92f
34 changes: 15 additions & 19 deletions trunk/drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,16 +621,17 @@ static void dec_pending(struct dm_io *io, int error)
if (io_error == DM_ENDIO_REQUEUE)
return;

if (!(bio->bi_rw & REQ_FLUSH) || !bio->bi_size) {
trace_block_bio_complete(md->queue, bio);
bio_endio(bio, io_error);
} else {
if ((bio->bi_rw & REQ_FLUSH) && bio->bi_size) {
/*
* Preflush done for flush with data, reissue
* without REQ_FLUSH.
*/
bio->bi_rw &= ~REQ_FLUSH;
queue_io(md, bio);
} else {
/* done with normal IO or empty flush */
trace_block_bio_complete(md->queue, bio);
bio_endio(bio, io_error);
}
}
}
Expand Down Expand Up @@ -1132,16 +1133,15 @@ static void __issue_target_requests(struct clone_info *ci, struct dm_target *ti,
__issue_target_request(ci, ti, request_nr, len);
}

static int __clone_and_map_flush(struct clone_info *ci)
static int __clone_and_map_empty_flush(struct clone_info *ci)
{
unsigned target_nr = 0;
struct dm_target *ti;

BUG_ON(bio_has_data(ci->bio));
while ((ti = dm_table_get_target(ci->map, target_nr++)))
__issue_target_requests(ci, ti, ti->num_flush_requests, 0);

ci->sector_count = 0;

return 0;
}

Expand Down Expand Up @@ -1282,7 +1282,6 @@ static int __clone_and_map(struct clone_info *ci)
*/
static void __split_and_process_bio(struct mapped_device *md, struct bio *bio)
{
bool is_flush = bio->bi_rw & REQ_FLUSH;
struct clone_info ci;
int error = 0;

Expand All @@ -1302,20 +1301,17 @@ static void __split_and_process_bio(struct mapped_device *md, struct bio *bio)
ci.sector = bio->bi_sector;
ci.idx = bio->bi_idx;

if (!is_flush) {
start_io_acct(ci.io);
if (bio->bi_rw & REQ_FLUSH) {
ci.bio = &ci.md->flush_bio;
ci.sector_count = 0;
error = __clone_and_map_empty_flush(&ci);
/* dec_pending submits any data associated with flush */
} else {
ci.bio = bio;
ci.sector_count = bio_sectors(bio);
} else {
ci.bio = &ci.md->flush_bio;
ci.sector_count = 1;
}

start_io_acct(ci.io);
while (ci.sector_count && !error) {
if (!is_flush)
while (ci.sector_count && !error)
error = __clone_and_map(&ci);
else
error = __clone_and_map_flush(&ci);
}

/* drop the extra reference count */
Expand Down

0 comments on commit ca394dd

Please sign in to comment.