diff options
author | David Teigland <teigland@redhat.com> | 2006-01-06 03:20:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:33:59 -0500 |
commit | 637842cfdbe2b981f7088f7633e630570f58efaf (patch) | |
tree | 05b64c2f30612ab126df9e3ba8448d62101341d2 /drivers/md | |
parent | 9f708e40fe040e79f6c393a282f0701c9f8dc174 (diff) |
[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>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 930b9fc27953..27cd234cf682 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -902,10 +902,9 @@ int dm_create_with_minor(unsigned int minor, struct mapped_device **result) | |||
902 | return create_aux(minor, 1, result); | 902 | return create_aux(minor, 1, result); |
903 | } | 903 | } |
904 | 904 | ||
905 | void *dm_get_mdptr(dev_t dev) | 905 | static struct mapped_device *dm_find_md(dev_t dev) |
906 | { | 906 | { |
907 | struct mapped_device *md; | 907 | struct mapped_device *md; |
908 | void *mdptr = NULL; | ||
909 | unsigned minor = MINOR(dev); | 908 | unsigned minor = MINOR(dev); |
910 | 909 | ||
911 | if (MAJOR(dev) != _major || minor >= (1 << MINORBITS)) | 910 | if (MAJOR(dev) != _major || minor >= (1 << MINORBITS)) |
@@ -914,12 +913,22 @@ void *dm_get_mdptr(dev_t dev) | |||
914 | down(&_minor_lock); | 913 | down(&_minor_lock); |
915 | 914 | ||
916 | md = idr_find(&_minor_idr, minor); | 915 | md = idr_find(&_minor_idr, minor); |
917 | 916 | if (!md || (dm_disk(md)->first_minor != minor)) | |
918 | if (md && (dm_disk(md)->first_minor == minor)) | 917 | md = NULL; |
919 | mdptr = md->interface_ptr; | ||
920 | 918 | ||
921 | up(&_minor_lock); | 919 | up(&_minor_lock); |
922 | 920 | ||
921 | return md; | ||
922 | } | ||
923 | |||
924 | void *dm_get_mdptr(dev_t dev) | ||
925 | { | ||
926 | struct mapped_device *md; | ||
927 | void *mdptr = NULL; | ||
928 | |||
929 | md = dm_find_md(dev); | ||
930 | if (md) | ||
931 | mdptr = md->interface_ptr; | ||
923 | return mdptr; | 932 | return mdptr; |
924 | } | 933 | } |
925 | 934 | ||