diff options
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/bcache/request.c | 5 | ||||
-rw-r--r-- | drivers/md/dm-snap-persistent.c | 18 |
2 files changed, 14 insertions, 9 deletions
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 71eb233b9ace..2a7f0dd6abab 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c | |||
@@ -996,10 +996,11 @@ static void request_write(struct cached_dev *dc, struct search *s) | |||
996 | closure_bio_submit(bio, cl, s->d); | 996 | closure_bio_submit(bio, cl, s->d); |
997 | } else { | 997 | } else { |
998 | bch_writeback_add(dc); | 998 | bch_writeback_add(dc); |
999 | s->op.cache_bio = bio; | ||
999 | 1000 | ||
1000 | if (bio->bi_rw & REQ_FLUSH) { | 1001 | if (bio->bi_rw & REQ_FLUSH) { |
1001 | /* Also need to send a flush to the backing device */ | 1002 | /* Also need to send a flush to the backing device */ |
1002 | struct bio *flush = bio_alloc_bioset(0, GFP_NOIO, | 1003 | struct bio *flush = bio_alloc_bioset(GFP_NOIO, 0, |
1003 | dc->disk.bio_split); | 1004 | dc->disk.bio_split); |
1004 | 1005 | ||
1005 | flush->bi_rw = WRITE_FLUSH; | 1006 | flush->bi_rw = WRITE_FLUSH; |
@@ -1008,8 +1009,6 @@ static void request_write(struct cached_dev *dc, struct search *s) | |||
1008 | flush->bi_private = cl; | 1009 | flush->bi_private = cl; |
1009 | 1010 | ||
1010 | closure_bio_submit(flush, cl, s->d); | 1011 | closure_bio_submit(flush, cl, s->d); |
1011 | } else { | ||
1012 | s->op.cache_bio = bio; | ||
1013 | } | 1012 | } |
1014 | } | 1013 | } |
1015 | out: | 1014 | out: |
diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c index 4caa8e6d59d7..2d2b1b7588d7 100644 --- a/drivers/md/dm-snap-persistent.c +++ b/drivers/md/dm-snap-persistent.c | |||
@@ -269,6 +269,14 @@ static chunk_t area_location(struct pstore *ps, chunk_t area) | |||
269 | return NUM_SNAPSHOT_HDR_CHUNKS + ((ps->exceptions_per_area + 1) * area); | 269 | return NUM_SNAPSHOT_HDR_CHUNKS + ((ps->exceptions_per_area + 1) * area); |
270 | } | 270 | } |
271 | 271 | ||
272 | static void skip_metadata(struct pstore *ps) | ||
273 | { | ||
274 | uint32_t stride = ps->exceptions_per_area + 1; | ||
275 | chunk_t next_free = ps->next_free; | ||
276 | if (sector_div(next_free, stride) == NUM_SNAPSHOT_HDR_CHUNKS) | ||
277 | ps->next_free++; | ||
278 | } | ||
279 | |||
272 | /* | 280 | /* |
273 | * Read or write a metadata area. Remembering to skip the first | 281 | * Read or write a metadata area. Remembering to skip the first |
274 | * chunk which holds the header. | 282 | * chunk which holds the header. |
@@ -502,6 +510,8 @@ static int read_exceptions(struct pstore *ps, | |||
502 | 510 | ||
503 | ps->current_area--; | 511 | ps->current_area--; |
504 | 512 | ||
513 | skip_metadata(ps); | ||
514 | |||
505 | return 0; | 515 | return 0; |
506 | } | 516 | } |
507 | 517 | ||
@@ -616,8 +626,6 @@ static int persistent_prepare_exception(struct dm_exception_store *store, | |||
616 | struct dm_exception *e) | 626 | struct dm_exception *e) |
617 | { | 627 | { |
618 | struct pstore *ps = get_info(store); | 628 | struct pstore *ps = get_info(store); |
619 | uint32_t stride; | ||
620 | chunk_t next_free; | ||
621 | sector_t size = get_dev_size(dm_snap_cow(store->snap)->bdev); | 629 | sector_t size = get_dev_size(dm_snap_cow(store->snap)->bdev); |
622 | 630 | ||
623 | /* Is there enough room ? */ | 631 | /* Is there enough room ? */ |
@@ -630,10 +638,8 @@ static int persistent_prepare_exception(struct dm_exception_store *store, | |||
630 | * Move onto the next free pending, making sure to take | 638 | * Move onto the next free pending, making sure to take |
631 | * into account the location of the metadata chunks. | 639 | * into account the location of the metadata chunks. |
632 | */ | 640 | */ |
633 | stride = (ps->exceptions_per_area + 1); | 641 | ps->next_free++; |
634 | next_free = ++ps->next_free; | 642 | skip_metadata(ps); |
635 | if (sector_div(next_free, stride) == 1) | ||
636 | ps->next_free++; | ||
637 | 643 | ||
638 | atomic_inc(&ps->pending_count); | 644 | atomic_inc(&ps->pending_count); |
639 | return 0; | 645 | return 0; |