Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 209165
b: refs/heads/master
c: 06a426c
h: refs/heads/master
i:
  209163: cf7b0eb
v: v3
  • Loading branch information
Mike Snitzer authored and Alasdair G Kergon committed Aug 12, 2010
1 parent f7016f9 commit 30a3c52
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 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: 5ae89a8720c28caf35c4e53711d77df2856c404e
refs/heads/master: 06a426cee9b35505aeb7516a67bd26496ca7ed08
30 changes: 22 additions & 8 deletions trunk/drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1182,30 +1182,42 @@ static struct dm_target_io *alloc_tio(struct clone_info *ci,
return tio;
}

static void __flush_target(struct clone_info *ci, struct dm_target *ti,
unsigned request_nr)
static void __issue_target_request(struct clone_info *ci, struct dm_target *ti,
unsigned request_nr)
{
struct dm_target_io *tio = alloc_tio(ci, ti);
struct bio *clone;

tio->info.target_request_nr = request_nr;

clone = bio_alloc_bioset(GFP_NOIO, 0, ci->md->bs);
/*
* Discard requests require the bio's inline iovecs be initialized.
* ci->bio->bi_max_vecs is BIO_INLINE_VECS anyway, for both flush
* and discard, so no need for concern about wasted bvec allocations.
*/
clone = bio_alloc_bioset(GFP_NOIO, ci->bio->bi_max_vecs, ci->md->bs);
__bio_clone(clone, ci->bio);
clone->bi_destructor = dm_bio_destructor;

__map_bio(ti, clone, tio);
}

static void __issue_target_requests(struct clone_info *ci, struct dm_target *ti,
unsigned num_requests)
{
unsigned request_nr;

for (request_nr = 0; request_nr < num_requests; request_nr++)
__issue_target_request(ci, ti, request_nr);
}

static int __clone_and_map_empty_barrier(struct clone_info *ci)
{
unsigned target_nr = 0, request_nr;
unsigned target_nr = 0;
struct dm_target *ti;

while ((ti = dm_table_get_target(ci->map, target_nr++)))
for (request_nr = 0; request_nr < ti->num_flush_requests;
request_nr++)
__flush_target(ci, ti, request_nr);
__issue_target_requests(ci, ti, ti->num_flush_requests);

ci->sector_count = 0;

Expand Down Expand Up @@ -1254,7 +1266,9 @@ static int __clone_and_map_discard(struct clone_info *ci)
*/
return -EOPNOTSUPP;

__clone_and_map_simple(ci, ti);
__issue_target_requests(ci, ti, ti->num_discard_requests);

ci->sector_count = 0;

return 0;
}
Expand Down

0 comments on commit 30a3c52

Please sign in to comment.