mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-17 22:41:25 +00:00
[PATCH] device-mapper: add dm_find_md
Abstract dm_find_md() from dm_get_mdptr() to allow use elsewhere. Signed-off-by: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
9f708e40fe
commit
637842cfdb
@ -902,10 +902,9 @@ int dm_create_with_minor(unsigned int minor, struct mapped_device **result)
|
|||||||
return create_aux(minor, 1, result);
|
return create_aux(minor, 1, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *dm_get_mdptr(dev_t dev)
|
static struct mapped_device *dm_find_md(dev_t dev)
|
||||||
{
|
{
|
||||||
struct mapped_device *md;
|
struct mapped_device *md;
|
||||||
void *mdptr = NULL;
|
|
||||||
unsigned minor = MINOR(dev);
|
unsigned minor = MINOR(dev);
|
||||||
|
|
||||||
if (MAJOR(dev) != _major || minor >= (1 << MINORBITS))
|
if (MAJOR(dev) != _major || minor >= (1 << MINORBITS))
|
||||||
@ -914,12 +913,22 @@ void *dm_get_mdptr(dev_t dev)
|
|||||||
down(&_minor_lock);
|
down(&_minor_lock);
|
||||||
|
|
||||||
md = idr_find(&_minor_idr, minor);
|
md = idr_find(&_minor_idr, minor);
|
||||||
|
if (!md || (dm_disk(md)->first_minor != minor))
|
||||||
if (md && (dm_disk(md)->first_minor == minor))
|
md = NULL;
|
||||||
mdptr = md->interface_ptr;
|
|
||||||
|
|
||||||
up(&_minor_lock);
|
up(&_minor_lock);
|
||||||
|
|
||||||
|
return md;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *dm_get_mdptr(dev_t dev)
|
||||||
|
{
|
||||||
|
struct mapped_device *md;
|
||||||
|
void *mdptr = NULL;
|
||||||
|
|
||||||
|
md = dm_find_md(dev);
|
||||||
|
if (md)
|
||||||
|
mdptr = md->interface_ptr;
|
||||||
return mdptr;
|
return mdptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user