rqbased-dm: dm_create()/alloc_dev() interface change
RFC PATCH 3/8 rqbased-dm: dm_create()/alloc_dev() interface change
This patch changes the interface of dm_create() and alloc_dev() so that the creator can specify whether the created device should be hooked at bio-level or request-level.
Actual implementation of request-based initialization is done in a separate patch.
Signed-off-by Kiyoshi Ueda <[email protected]>
Signed-off-by Jun'ichi Nomura <[email protected]>
drivers/md/dm.c +4 -3
@@ -923,7 +923,7 @@ static struct block_device_operations dm/* * Allocate and initialise a blank device with a given minor. */ -static struct mapped_device *alloc_dev (int minor) +static struct mapped_device *alloc_dev (int minor,int request_base) {int r;struct mapped_device *md =kmalloc (sizeof (*md),GFP_KERNEL );
@@ -1109,11 +1109,12 @@ static void __unbind(struct mapped_devic/* * Constructor for a new device. */ -int dm_create (int minor,struct mapped_device **result) +int dm_create (int minor,struct mapped_device **result,unsigned create_flags) {struct mapped_device *md; +int request_base = create_flags &DM_CREATE_REQUEST_BASE_FLAG ?1 :0 ; - md =alloc_dev (minor); + md =alloc_dev (minor, request_base);if (!md)return -ENXIO ;
drivers/md/dm-ioctl.c +2 -1
@@ -565,6 +565,7 @@ static int dev_create(struct dm_ioctl *p {int r, m =DM_ANY_MINOR ;struct mapped_device *md; +unsigned create_flags =0 ; r =check_name (param->name);if (r)
@@ -573,7 +574,7 @@ static int dev_create(struct dm_ioctl *pif (param->flags &DM_PERSISTENT_DEV_FLAG ) m =MINOR (huge_decode_dev (param->dev)); - r =dm_create (m, &md); + r =dm_create (m, &md, create_flags);if (r)return r;
include/linux/device-mapper.h +1 -1
@@ -155,7 +155,7 @@ int dm_unregister_target(struct target_t* DM_ANY_MINOR chooses the next available minor number. */ #define DM_ANY_MINOR (-1) -int dm_create (int minor,struct mapped_device **md); +int dm_create (int minor,struct mapped_device **md,unsigned create_flags);/* * Reference counting for md.