[dm-devel] [PATCH v2] dm ioctl: allow change device target type to error

Mike Snitzer snitzer at redhat.com
Thu Aug 22 20:19:00 UTC 2013


On Wed, Aug 21 2013 at 10:50pm -0400,
Joe Jin <joe.jin at oracle.com> wrote:

> Mikulas, thanks for you suggestions, I create new patch, can you please help
> review?
> 
> Subject: dm: add map_rq define for error
> 
> commit a5664da "dm ioctl: make bio or request based device type immutable"
> prevented "dmsetup wape_table" change the target type to "error" for there
> is not map_rq for error target type.
> 
> Signed-off-by: Joe Jin <joe.jin at oracle.com>
> ---
>  drivers/md/dm-target.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/md/dm-target.c b/drivers/md/dm-target.c
> index 37ba5db..b690910 100644
> --- a/drivers/md/dm-target.c
> +++ b/drivers/md/dm-target.c
> @@ -131,12 +131,19 @@ static int io_err_map(struct dm_target *tt, struct bio *bio)
>  	return -EIO;
>  }
>  
> +static int io_err_map_rq(struct dm_target *ti, struct request *clone,
> +			 union map_info *map_context)
> +{
> +	return -EIO;
> +}
> +
>  static struct target_type error_target = {
>  	.name = "error",
>  	.version = {1, 1, 0},
>  	.ctr  = io_err_ctr,
>  	.dtr  = io_err_dtr,
>  	.map  = io_err_map,
> +	.map_rq = io_err_map_rq,
>  };
>  
>  int __init dm_target_init(void)
> -- 
> 1.8.3.1

Hi Joe,

Unfortunately this isn't going to work properly.  Mikulas suggested a
new "error-rq" target.

I do like the idea of a single error target that is hybrid (supports
both bio-based and request-based) but the DM core would need to be
updated to support this.

Specifically, we'd need to check if the device (and active table) is
already bio-based or request-based and select the appropriate type.  If
it is a new device, default to selecting bio-based.

There are some wrappers and other logic thoughout DM core that will need
auditing too.

Mike




More information about the dm-devel mailing list