mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
dm kcopyd: return void from dm_kcopyd_copy()
dm_kcopyd_copy() only ever returns 0 so there is no need for callers to account for possible failure. Same goes for dm_kcopyd_zero(). Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
parent
63c8ecb626
commit
7209049d40
@ -1188,9 +1188,8 @@ static void copy_complete(int read_err, unsigned long write_err, void *context)
|
||||
queue_continuation(mg->cache->wq, &mg->k);
|
||||
}
|
||||
|
||||
static int copy(struct dm_cache_migration *mg, bool promote)
|
||||
static void copy(struct dm_cache_migration *mg, bool promote)
|
||||
{
|
||||
int r;
|
||||
struct dm_io_region o_region, c_region;
|
||||
struct cache *cache = mg->cache;
|
||||
|
||||
@ -1203,11 +1202,9 @@ static int copy(struct dm_cache_migration *mg, bool promote)
|
||||
c_region.count = cache->sectors_per_block;
|
||||
|
||||
if (promote)
|
||||
r = dm_kcopyd_copy(cache->copier, &o_region, 1, &c_region, 0, copy_complete, &mg->k);
|
||||
dm_kcopyd_copy(cache->copier, &o_region, 1, &c_region, 0, copy_complete, &mg->k);
|
||||
else
|
||||
r = dm_kcopyd_copy(cache->copier, &c_region, 1, &o_region, 0, copy_complete, &mg->k);
|
||||
|
||||
return r;
|
||||
dm_kcopyd_copy(cache->copier, &c_region, 1, &o_region, 0, copy_complete, &mg->k);
|
||||
}
|
||||
|
||||
static void bio_drop_shared_lock(struct cache *cache, struct bio *bio)
|
||||
@ -1449,12 +1446,7 @@ static void mg_full_copy(struct work_struct *ws)
|
||||
}
|
||||
|
||||
init_continuation(&mg->k, mg_upgrade_lock);
|
||||
|
||||
if (copy(mg, is_policy_promote)) {
|
||||
DMERR_LIMIT("%s: migration copy failed", cache_device_name(cache));
|
||||
mg->k.input = BLK_STS_IOERR;
|
||||
mg_complete(mg, false);
|
||||
}
|
||||
copy(mg, is_policy_promote);
|
||||
}
|
||||
|
||||
static void mg_copy(struct work_struct *ws)
|
||||
|
@ -741,9 +741,9 @@ static void split_job(struct kcopyd_job *master_job)
|
||||
}
|
||||
}
|
||||
|
||||
int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
|
||||
unsigned int num_dests, struct dm_io_region *dests,
|
||||
unsigned int flags, dm_kcopyd_notify_fn fn, void *context)
|
||||
void dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
|
||||
unsigned int num_dests, struct dm_io_region *dests,
|
||||
unsigned int flags, dm_kcopyd_notify_fn fn, void *context)
|
||||
{
|
||||
struct kcopyd_job *job;
|
||||
int i;
|
||||
@ -818,16 +818,14 @@ int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
|
||||
job->progress = 0;
|
||||
split_job(job);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(dm_kcopyd_copy);
|
||||
|
||||
int dm_kcopyd_zero(struct dm_kcopyd_client *kc,
|
||||
unsigned num_dests, struct dm_io_region *dests,
|
||||
unsigned flags, dm_kcopyd_notify_fn fn, void *context)
|
||||
void dm_kcopyd_zero(struct dm_kcopyd_client *kc,
|
||||
unsigned num_dests, struct dm_io_region *dests,
|
||||
unsigned flags, dm_kcopyd_notify_fn fn, void *context)
|
||||
{
|
||||
return dm_kcopyd_copy(kc, NULL, num_dests, dests, flags, fn, context);
|
||||
dm_kcopyd_copy(kc, NULL, num_dests, dests, flags, fn, context);
|
||||
}
|
||||
EXPORT_SYMBOL(dm_kcopyd_zero);
|
||||
|
||||
|
@ -326,9 +326,8 @@ static void recovery_complete(int read_err, unsigned long write_err,
|
||||
dm_rh_recovery_end(reg, !(read_err || write_err));
|
||||
}
|
||||
|
||||
static int recover(struct mirror_set *ms, struct dm_region *reg)
|
||||
static void recover(struct mirror_set *ms, struct dm_region *reg)
|
||||
{
|
||||
int r;
|
||||
unsigned i;
|
||||
struct dm_io_region from, to[DM_KCOPYD_MAX_REGIONS], *dest;
|
||||
struct mirror *m;
|
||||
@ -367,10 +366,8 @@ static int recover(struct mirror_set *ms, struct dm_region *reg)
|
||||
if (!errors_handled(ms))
|
||||
set_bit(DM_KCOPYD_IGNORE_ERROR, &flags);
|
||||
|
||||
r = dm_kcopyd_copy(ms->kcopyd_client, &from, ms->nr_mirrors - 1, to,
|
||||
flags, recovery_complete, reg);
|
||||
|
||||
return r;
|
||||
dm_kcopyd_copy(ms->kcopyd_client, &from, ms->nr_mirrors - 1, to,
|
||||
flags, recovery_complete, reg);
|
||||
}
|
||||
|
||||
static void reset_ms_flags(struct mirror_set *ms)
|
||||
@ -388,7 +385,6 @@ static void do_recovery(struct mirror_set *ms)
|
||||
{
|
||||
struct dm_region *reg;
|
||||
struct dm_dirty_log *log = dm_rh_dirty_log(ms->rh);
|
||||
int r;
|
||||
|
||||
/*
|
||||
* Start quiescing some regions.
|
||||
@ -398,11 +394,8 @@ static void do_recovery(struct mirror_set *ms)
|
||||
/*
|
||||
* Copy any already quiesced regions.
|
||||
*/
|
||||
while ((reg = dm_rh_recovery_start(ms->rh))) {
|
||||
r = recover(ms, reg);
|
||||
if (r)
|
||||
dm_rh_recovery_end(reg, 0);
|
||||
}
|
||||
while ((reg = dm_rh_recovery_start(ms->rh)))
|
||||
recover(ms, reg);
|
||||
|
||||
/*
|
||||
* Update the in sync flag.
|
||||
|
@ -1220,18 +1220,13 @@ static struct dm_thin_new_mapping *get_next_mapping(struct pool *pool)
|
||||
static void ll_zero(struct thin_c *tc, struct dm_thin_new_mapping *m,
|
||||
sector_t begin, sector_t end)
|
||||
{
|
||||
int r;
|
||||
struct dm_io_region to;
|
||||
|
||||
to.bdev = tc->pool_dev->bdev;
|
||||
to.sector = begin;
|
||||
to.count = end - begin;
|
||||
|
||||
r = dm_kcopyd_zero(tc->pool->copier, 1, &to, 0, copy_complete, m);
|
||||
if (r < 0) {
|
||||
DMERR_LIMIT("dm_kcopyd_zero() failed");
|
||||
copy_complete(1, 1, m);
|
||||
}
|
||||
dm_kcopyd_zero(tc->pool->copier, 1, &to, 0, copy_complete, m);
|
||||
}
|
||||
|
||||
static void remap_and_issue_overwrite(struct thin_c *tc, struct bio *bio,
|
||||
@ -1257,7 +1252,6 @@ static void schedule_copy(struct thin_c *tc, dm_block_t virt_block,
|
||||
struct dm_bio_prison_cell *cell, struct bio *bio,
|
||||
sector_t len)
|
||||
{
|
||||
int r;
|
||||
struct pool *pool = tc->pool;
|
||||
struct dm_thin_new_mapping *m = get_next_mapping(pool);
|
||||
|
||||
@ -1296,19 +1290,8 @@ static void schedule_copy(struct thin_c *tc, dm_block_t virt_block,
|
||||
to.sector = data_dest * pool->sectors_per_block;
|
||||
to.count = len;
|
||||
|
||||
r = dm_kcopyd_copy(pool->copier, &from, 1, &to,
|
||||
0, copy_complete, m);
|
||||
if (r < 0) {
|
||||
DMERR_LIMIT("dm_kcopyd_copy() failed");
|
||||
copy_complete(1, 1, m);
|
||||
|
||||
/*
|
||||
* We allow the zero to be issued, to simplify the
|
||||
* error path. Otherwise we'd need to start
|
||||
* worrying about decrementing the prepare_actions
|
||||
* counter.
|
||||
*/
|
||||
}
|
||||
dm_kcopyd_copy(pool->copier, &from, 1, &to,
|
||||
0, copy_complete, m);
|
||||
|
||||
/*
|
||||
* Do we need to zero a tail region?
|
||||
|
@ -161,10 +161,8 @@ static int dmz_reclaim_copy(struct dmz_reclaim *zrc,
|
||||
|
||||
/* Copy the valid region */
|
||||
set_bit(DMZ_RECLAIM_KCOPY, &zrc->flags);
|
||||
ret = dm_kcopyd_copy(zrc->kc, &src, 1, &dst, flags,
|
||||
dmz_reclaim_kcopy_end, zrc);
|
||||
if (ret)
|
||||
return ret;
|
||||
dm_kcopyd_copy(zrc->kc, &src, 1, &dst, flags,
|
||||
dmz_reclaim_kcopy_end, zrc);
|
||||
|
||||
/* Wait for copy to complete */
|
||||
wait_on_bit_io(&zrc->flags, DMZ_RECLAIM_KCOPY,
|
||||
|
@ -62,9 +62,9 @@ void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc);
|
||||
typedef void (*dm_kcopyd_notify_fn)(int read_err, unsigned long write_err,
|
||||
void *context);
|
||||
|
||||
int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
|
||||
unsigned num_dests, struct dm_io_region *dests,
|
||||
unsigned flags, dm_kcopyd_notify_fn fn, void *context);
|
||||
void dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
|
||||
unsigned num_dests, struct dm_io_region *dests,
|
||||
unsigned flags, dm_kcopyd_notify_fn fn, void *context);
|
||||
|
||||
/*
|
||||
* Prepare a callback and submit it via the kcopyd thread.
|
||||
@ -81,9 +81,9 @@ void *dm_kcopyd_prepare_callback(struct dm_kcopyd_client *kc,
|
||||
dm_kcopyd_notify_fn fn, void *context);
|
||||
void dm_kcopyd_do_callback(void *job, int read_err, unsigned long write_err);
|
||||
|
||||
int dm_kcopyd_zero(struct dm_kcopyd_client *kc,
|
||||
unsigned num_dests, struct dm_io_region *dests,
|
||||
unsigned flags, dm_kcopyd_notify_fn fn, void *context);
|
||||
void dm_kcopyd_zero(struct dm_kcopyd_client *kc,
|
||||
unsigned num_dests, struct dm_io_region *dests,
|
||||
unsigned flags, dm_kcopyd_notify_fn fn, void *context);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _LINUX_DM_KCOPYD_H */
|
||||
|
Loading…
Reference in New Issue
Block a user