diff options
author | Mike Snitzer <snitzer@redhat.com> | 2012-12-21 15:23:41 -0500 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2012-12-21 15:23:41 -0500 |
commit | 45e621d45e24ffc4cb2b2935e8438987b860063a (patch) | |
tree | 96c49f06c5bb6b2f6f8d01dc354d59202a7954a5 /drivers/md/dm-stripe.c | |
parent | 7de3ee57da4b717050e79c9313a9bf66ccc72519 (diff) |
dm stripe: add WRITE SAME support
Rename stripe_map_discard to stripe_map_range and reuse it for WRITE
SAME bio processing.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-stripe.c')
-rw-r--r-- | drivers/md/dm-stripe.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index 6b0e5ea38027..c89cde86d400 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c | |||
@@ -162,6 +162,7 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
162 | 162 | ||
163 | ti->num_flush_requests = stripes; | 163 | ti->num_flush_requests = stripes; |
164 | ti->num_discard_requests = stripes; | 164 | ti->num_discard_requests = stripes; |
165 | ti->num_write_same_requests = stripes; | ||
165 | 166 | ||
166 | sc->chunk_size = chunk_size; | 167 | sc->chunk_size = chunk_size; |
167 | if (chunk_size & (chunk_size - 1)) | 168 | if (chunk_size & (chunk_size - 1)) |
@@ -251,8 +252,8 @@ static void stripe_map_range_sector(struct stripe_c *sc, sector_t sector, | |||
251 | *result += sc->chunk_size; /* next chunk */ | 252 | *result += sc->chunk_size; /* next chunk */ |
252 | } | 253 | } |
253 | 254 | ||
254 | static int stripe_map_discard(struct stripe_c *sc, struct bio *bio, | 255 | static int stripe_map_range(struct stripe_c *sc, struct bio *bio, |
255 | uint32_t target_stripe) | 256 | uint32_t target_stripe) |
256 | { | 257 | { |
257 | sector_t begin, end; | 258 | sector_t begin, end; |
258 | 259 | ||
@@ -283,10 +284,11 @@ static int stripe_map(struct dm_target *ti, struct bio *bio) | |||
283 | bio->bi_bdev = sc->stripe[target_request_nr].dev->bdev; | 284 | bio->bi_bdev = sc->stripe[target_request_nr].dev->bdev; |
284 | return DM_MAPIO_REMAPPED; | 285 | return DM_MAPIO_REMAPPED; |
285 | } | 286 | } |
286 | if (unlikely(bio->bi_rw & REQ_DISCARD)) { | 287 | if (unlikely(bio->bi_rw & REQ_DISCARD) || |
288 | unlikely(bio->bi_rw & REQ_WRITE_SAME)) { | ||
287 | target_request_nr = dm_bio_get_target_request_nr(bio); | 289 | target_request_nr = dm_bio_get_target_request_nr(bio); |
288 | BUG_ON(target_request_nr >= sc->stripes); | 290 | BUG_ON(target_request_nr >= sc->stripes); |
289 | return stripe_map_discard(sc, bio, target_request_nr); | 291 | return stripe_map_range(sc, bio, target_request_nr); |
290 | } | 292 | } |
291 | 293 | ||
292 | stripe_map_sector(sc, bio->bi_sector, &stripe, &bio->bi_sector); | 294 | stripe_map_sector(sc, bio->bi_sector, &stripe, &bio->bi_sector); |