Commit 9bc0c92e authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Mike Snitzer

dm writecache: return void from functions

The functions writecache_map_remap_origin and writecache_bio_copy_ssd
only return a single value, thus they can be made to return void.

This helps simplify the following IO accounting changes.
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
parent 949d49ec
...@@ -1329,8 +1329,8 @@ enum wc_map_op { ...@@ -1329,8 +1329,8 @@ enum wc_map_op {
WC_MAP_ERROR, WC_MAP_ERROR,
}; };
static enum wc_map_op writecache_map_remap_origin(struct dm_writecache *wc, struct bio *bio, static void writecache_map_remap_origin(struct dm_writecache *wc, struct bio *bio,
struct wc_entry *e) struct wc_entry *e)
{ {
if (e) { if (e) {
sector_t next_boundary = sector_t next_boundary =
...@@ -1338,8 +1338,6 @@ static enum wc_map_op writecache_map_remap_origin(struct dm_writecache *wc, stru ...@@ -1338,8 +1338,6 @@ static enum wc_map_op writecache_map_remap_origin(struct dm_writecache *wc, stru
if (next_boundary < bio->bi_iter.bi_size >> SECTOR_SHIFT) if (next_boundary < bio->bi_iter.bi_size >> SECTOR_SHIFT)
dm_accept_partial_bio(bio, next_boundary); dm_accept_partial_bio(bio, next_boundary);
} }
return WC_MAP_REMAP_ORIGIN;
} }
static enum wc_map_op writecache_map_read(struct dm_writecache *wc, struct bio *bio) static enum wc_map_op writecache_map_read(struct dm_writecache *wc, struct bio *bio)
...@@ -1366,14 +1364,15 @@ static enum wc_map_op writecache_map_read(struct dm_writecache *wc, struct bio * ...@@ -1366,14 +1364,15 @@ static enum wc_map_op writecache_map_read(struct dm_writecache *wc, struct bio *
map_op = WC_MAP_REMAP; map_op = WC_MAP_REMAP;
} }
} else { } else {
map_op = writecache_map_remap_origin(wc, bio, e); writecache_map_remap_origin(wc, bio, e);
map_op = WC_MAP_REMAP_ORIGIN;
} }
return map_op; return map_op;
} }
static enum wc_map_op writecache_bio_copy_ssd(struct dm_writecache *wc, struct bio *bio, static void writecache_bio_copy_ssd(struct dm_writecache *wc, struct bio *bio,
struct wc_entry *e, bool search_used) struct wc_entry *e, bool search_used)
{ {
unsigned bio_size = wc->block_size; unsigned bio_size = wc->block_size;
sector_t start_cache_sec = cache_sector(wc, e); sector_t start_cache_sec = cache_sector(wc, e);
...@@ -1419,8 +1418,6 @@ static enum wc_map_op writecache_bio_copy_ssd(struct dm_writecache *wc, struct b ...@@ -1419,8 +1418,6 @@ static enum wc_map_op writecache_bio_copy_ssd(struct dm_writecache *wc, struct b
} else { } else {
writecache_schedule_autocommit(wc); writecache_schedule_autocommit(wc);
} }
return WC_MAP_REMAP;
} }
static enum wc_map_op writecache_map_write(struct dm_writecache *wc, struct bio *bio) static enum wc_map_op writecache_map_write(struct dm_writecache *wc, struct bio *bio)
...@@ -1458,7 +1455,8 @@ static enum wc_map_op writecache_map_write(struct dm_writecache *wc, struct bio ...@@ -1458,7 +1455,8 @@ static enum wc_map_op writecache_map_write(struct dm_writecache *wc, struct bio
direct_write: direct_write:
wc->stats.writes_around++; wc->stats.writes_around++;
e = writecache_find_entry(wc, bio->bi_iter.bi_sector, WFE_RETURN_FOLLOWING); e = writecache_find_entry(wc, bio->bi_iter.bi_sector, WFE_RETURN_FOLLOWING);
return writecache_map_remap_origin(wc, bio, e); writecache_map_remap_origin(wc, bio, e);
return WC_MAP_REMAP_ORIGIN;
} }
wc->stats.writes_blocked_on_freelist++; wc->stats.writes_blocked_on_freelist++;
writecache_wait_on_freelist(wc); writecache_wait_on_freelist(wc);
...@@ -1469,10 +1467,12 @@ static enum wc_map_op writecache_map_write(struct dm_writecache *wc, struct bio ...@@ -1469,10 +1467,12 @@ static enum wc_map_op writecache_map_write(struct dm_writecache *wc, struct bio
wc->uncommitted_blocks++; wc->uncommitted_blocks++;
wc->stats.writes_allocate++; wc->stats.writes_allocate++;
bio_copy: bio_copy:
if (WC_MODE_PMEM(wc)) if (WC_MODE_PMEM(wc)) {
bio_copy_block(wc, bio, memory_data(wc, e)); bio_copy_block(wc, bio, memory_data(wc, e));
else } else {
return writecache_bio_copy_ssd(wc, bio, e, search_used); writecache_bio_copy_ssd(wc, bio, e, search_used);
return WC_MAP_REMAP;
}
} while (bio->bi_iter.bi_size); } while (bio->bi_iter.bi_size);
if (unlikely(bio->bi_opf & REQ_FUA || wc->uncommitted_blocks >= wc->autocommit_blocks)) if (unlikely(bio->bi_opf & REQ_FUA || wc->uncommitted_blocks >= wc->autocommit_blocks))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment