#include "blk.h"
-static DEFINE_MUTEX(block_class_lock);
static struct kobject *block_depr;
struct bdev_map {
int (*lock)(dev_t, void *);
void *data;
} *bdev_map[255];
+static DEFINE_MUTEX(bdev_map_lock);
/* for extended dynamic devt allocation, currently only one major is used */
#define NR_EXT_DEVT (1 << MINORBITS)
int major;
char name[16];
} *major_names[BLKDEV_MAJOR_HASH_SIZE];
+static DEFINE_MUTEX(major_names_lock);
/* index in the above - for now: assume no multimajor ranges */
static inline int major_to_index(unsigned major)
{
struct blk_major_name *dp;
- mutex_lock(&block_class_lock);
+ mutex_lock(&major_names_lock);
for (dp = major_names[major_to_index(offset)]; dp; dp = dp->next)
if (dp->major == offset)
seq_printf(seqf, "%3d %s\n", dp->major, dp->name);
- mutex_unlock(&block_class_lock);
+ mutex_unlock(&major_names_lock);
}
#endif /* CONFIG_PROC_FS */
struct blk_major_name **n, *p;
int index, ret = 0;
- mutex_lock(&block_class_lock);
+ mutex_lock(&major_names_lock);
/* temporary */
if (major == 0) {
kfree(p);
}
out:
- mutex_unlock(&block_class_lock);
+ mutex_unlock(&major_names_lock);
return ret;
}
struct blk_major_name *p = NULL;
int index = major_to_index(major);
- mutex_lock(&block_class_lock);
+ mutex_lock(&major_names_lock);
for (n = &major_names[index]; *n; n = &(*n)->next)
if ((*n)->major == major)
break;
p = *n;
*n = p->next;
}
- mutex_unlock(&block_class_lock);
+ mutex_unlock(&major_names_lock);
kfree(p);
}
p->data = data;
}
- mutex_lock(&block_class_lock);
+ mutex_lock(&bdev_map_lock);
for (i = 0, p -= n; i < n; i++, p++, index++) {
struct bdev_map **s = &bdev_map[index % 255];
while (*s && (*s)->range < range)
p->next = *s;
*s = p;
}
- mutex_unlock(&block_class_lock);
+ mutex_unlock(&bdev_map_lock);
}
EXPORT_SYMBOL(blk_register_region);
unsigned i;
struct bdev_map *found = NULL;
- mutex_lock(&block_class_lock);
+ mutex_lock(&bdev_map_lock);
for (i = 0; i < min(n, 255u); i++, index++) {
struct bdev_map **s;
for (s = &bdev_map[index % 255]; *s; s = &(*s)->next) {
}
}
}
- mutex_unlock(&block_class_lock);
+ mutex_unlock(&bdev_map_lock);
kfree(found);
}
EXPORT_SYMBOL(blk_unregister_region);
unsigned long best = ~0UL;
retry:
- mutex_lock(&block_class_lock);
+ mutex_lock(&bdev_map_lock);
for (p = bdev_map[MAJOR(dev) % 255]; p; p = p->next) {
struct kobject *(*probe)(dev_t, int *, void *);
struct module *owner;
module_put(owner);
continue;
}
- mutex_unlock(&block_class_lock);
+ mutex_unlock(&bdev_map_lock);
kobj = probe(dev, partno, data);
/* Currently ->owner protects _only_ ->probe() itself. */
module_put(owner);
return dev_to_disk(kobj_to_dev(kobj));
goto retry;
}
- mutex_unlock(&block_class_lock);
+ mutex_unlock(&bdev_map_lock);
return NULL;
}