diff options
Diffstat (limited to 'drivers/md/dm-cache-target.c')
| -rw-r--r-- | drivers/md/dm-cache-target.c | 35 | 
1 files changed, 19 insertions, 16 deletions
| diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index ce14a3d1f609..a53413371725 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c @@ -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) @@ -2250,7 +2242,7 @@ static int parse_features(struct cache_args *ca, struct dm_arg_set *as,  		{0, 2, "Invalid number of cache feature arguments"},  	}; -	int r; +	int r, mode_ctr = 0;  	unsigned argc;  	const char *arg;  	struct cache_features *cf = &ca->features; @@ -2264,14 +2256,20 @@ static int parse_features(struct cache_args *ca, struct dm_arg_set *as,  	while (argc--) {  		arg = dm_shift_arg(as); -		if (!strcasecmp(arg, "writeback")) +		if (!strcasecmp(arg, "writeback")) {  			cf->io_mode = CM_IO_WRITEBACK; +			mode_ctr++; +		} -		else if (!strcasecmp(arg, "writethrough")) +		else if (!strcasecmp(arg, "writethrough")) {  			cf->io_mode = CM_IO_WRITETHROUGH; +			mode_ctr++; +		} -		else if (!strcasecmp(arg, "passthrough")) +		else if (!strcasecmp(arg, "passthrough")) {  			cf->io_mode = CM_IO_PASSTHROUGH; +			mode_ctr++; +		}  		else if (!strcasecmp(arg, "metadata2"))  			cf->metadata_version = 2; @@ -2282,6 +2280,11 @@ static int parse_features(struct cache_args *ca, struct dm_arg_set *as,  		}  	} +	if (mode_ctr > 1) { +		*error = "Duplicate cache io_mode features requested"; +		return -EINVAL; +	} +  	return 0;  } |