dm table: clean dm_get_device and move exports
There is no need for __table_get_device to be factored out. Also move the exports to the end of their respective functions. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
This commit is contained in:
parent
3e8dbb7f39
commit
0864901254
|
@ -157,6 +157,7 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size)
|
||||||
|
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(dm_vcalloc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* highs, and targets are managed as dynamic arrays during a
|
* highs, and targets are managed as dynamic arrays during a
|
||||||
|
@ -277,6 +278,7 @@ void dm_table_get(struct dm_table *t)
|
||||||
{
|
{
|
||||||
atomic_inc(&t->holders);
|
atomic_inc(&t->holders);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(dm_table_get);
|
||||||
|
|
||||||
void dm_table_put(struct dm_table *t)
|
void dm_table_put(struct dm_table *t)
|
||||||
{
|
{
|
||||||
|
@ -286,6 +288,7 @@ void dm_table_put(struct dm_table *t)
|
||||||
smp_mb__before_atomic_dec();
|
smp_mb__before_atomic_dec();
|
||||||
atomic_dec(&t->holders);
|
atomic_dec(&t->holders);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(dm_table_put);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Checks to see if we need to extend highs or targets.
|
* Checks to see if we need to extend highs or targets.
|
||||||
|
@ -451,13 +454,14 @@ static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode,
|
||||||
* Add a device to the list, or just increment the usage count if
|
* Add a device to the list, or just increment the usage count if
|
||||||
* it's already present.
|
* it's already present.
|
||||||
*/
|
*/
|
||||||
static int __table_get_device(struct dm_table *t, struct dm_target *ti,
|
int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
|
||||||
const char *path, fmode_t mode, struct dm_dev **result)
|
struct dm_dev **result)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
dev_t uninitialized_var(dev);
|
dev_t uninitialized_var(dev);
|
||||||
struct dm_dev_internal *dd;
|
struct dm_dev_internal *dd;
|
||||||
unsigned int major, minor;
|
unsigned int major, minor;
|
||||||
|
struct dm_table *t = ti->table;
|
||||||
|
|
||||||
BUG_ON(!t);
|
BUG_ON(!t);
|
||||||
|
|
||||||
|
@ -505,6 +509,7 @@ static int __table_get_device(struct dm_table *t, struct dm_target *ti,
|
||||||
*result = &dd->dm_dev;
|
*result = &dd->dm_dev;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(dm_get_device);
|
||||||
|
|
||||||
int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
|
int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
|
||||||
sector_t start, sector_t len, void *data)
|
sector_t start, sector_t len, void *data)
|
||||||
|
@ -543,15 +548,8 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(dm_set_device_limits);
|
EXPORT_SYMBOL_GPL(dm_set_device_limits);
|
||||||
|
|
||||||
int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
|
|
||||||
struct dm_dev **result)
|
|
||||||
{
|
|
||||||
return __table_get_device(ti->table, ti, path, mode, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Decrement a devices use count and remove it if necessary.
|
* Decrement a device's use count and remove it if necessary.
|
||||||
*/
|
*/
|
||||||
void dm_put_device(struct dm_target *ti, struct dm_dev *d)
|
void dm_put_device(struct dm_target *ti, struct dm_dev *d)
|
||||||
{
|
{
|
||||||
|
@ -564,6 +562,7 @@ void dm_put_device(struct dm_target *ti, struct dm_dev *d)
|
||||||
kfree(dd);
|
kfree(dd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(dm_put_device);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Checks to see if the target joins onto the end of the table.
|
* Checks to see if the target joins onto the end of the table.
|
||||||
|
@ -1074,11 +1073,13 @@ void dm_table_event(struct dm_table *t)
|
||||||
t->event_fn(t->event_context);
|
t->event_fn(t->event_context);
|
||||||
mutex_unlock(&_event_lock);
|
mutex_unlock(&_event_lock);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(dm_table_event);
|
||||||
|
|
||||||
sector_t dm_table_get_size(struct dm_table *t)
|
sector_t dm_table_get_size(struct dm_table *t)
|
||||||
{
|
{
|
||||||
return t->num_targets ? (t->highs[t->num_targets - 1] + 1) : 0;
|
return t->num_targets ? (t->highs[t->num_targets - 1] + 1) : 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(dm_table_get_size);
|
||||||
|
|
||||||
struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index)
|
struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index)
|
||||||
{
|
{
|
||||||
|
@ -1234,6 +1235,7 @@ fmode_t dm_table_get_mode(struct dm_table *t)
|
||||||
{
|
{
|
||||||
return t->mode;
|
return t->mode;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(dm_table_get_mode);
|
||||||
|
|
||||||
static void suspend_targets(struct dm_table *t, unsigned postsuspend)
|
static void suspend_targets(struct dm_table *t, unsigned postsuspend)
|
||||||
{
|
{
|
||||||
|
@ -1342,6 +1344,7 @@ struct mapped_device *dm_table_get_md(struct dm_table *t)
|
||||||
{
|
{
|
||||||
return t->md;
|
return t->md;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(dm_table_get_md);
|
||||||
|
|
||||||
static int device_discard_capable(struct dm_target *ti, struct dm_dev *dev,
|
static int device_discard_capable(struct dm_target *ti, struct dm_dev *dev,
|
||||||
sector_t start, sector_t len, void *data)
|
sector_t start, sector_t len, void *data)
|
||||||
|
@ -1379,13 +1382,3 @@ bool dm_table_supports_discards(struct dm_table *t)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(dm_vcalloc);
|
|
||||||
EXPORT_SYMBOL(dm_get_device);
|
|
||||||
EXPORT_SYMBOL(dm_put_device);
|
|
||||||
EXPORT_SYMBOL(dm_table_event);
|
|
||||||
EXPORT_SYMBOL(dm_table_get_size);
|
|
||||||
EXPORT_SYMBOL(dm_table_get_mode);
|
|
||||||
EXPORT_SYMBOL(dm_table_get_md);
|
|
||||||
EXPORT_SYMBOL(dm_table_put);
|
|
||||||
EXPORT_SYMBOL(dm_table_get);
|
|
||||||
|
|
Loading…
Reference in New Issue