Skip to content

Commit

Permalink
dm table: clean dm_get_device and move exports
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Alasdair G Kergon <[email protected]>
(cherry picked from commit 08649012545cfb116798260352547cf4d47064ec)

Change-Id: Ie82e8fa1daa1467d2eba7f0735f4554990ec2b34
  • Loading branch information
snitm authored and boype committed Dec 22, 2013
1 parent c5e6692 commit ee53b6f
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions drivers/md/dm-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size)

return addr;
}
EXPORT_SYMBOL(dm_vcalloc);

/*
* highs, and targets are managed as dynamic arrays during a
Expand Down Expand Up @@ -277,6 +278,7 @@ void dm_table_get(struct dm_table *t)
{
atomic_inc(&t->holders);
}
EXPORT_SYMBOL(dm_table_get);

void dm_table_put(struct dm_table *t)
{
Expand All @@ -286,6 +288,7 @@ void dm_table_put(struct dm_table *t)
smp_mb__before_atomic_dec();
atomic_dec(&t->holders);
}
EXPORT_SYMBOL(dm_table_put);

/*
* Checks to see if we need to extend highs or targets.
Expand Down Expand Up @@ -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
* it's already present.
*/
static int __table_get_device(struct dm_table *t, struct dm_target *ti,
const char *path, fmode_t mode, struct dm_dev **result)
int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
struct dm_dev **result)
{
int r;
dev_t uninitialized_var(dev);
struct dm_dev_internal *dd;
unsigned int major, minor;
struct dm_table *t = ti->table;

BUG_ON(!t);

Expand Down Expand Up @@ -505,6 +509,7 @@ static int __table_get_device(struct dm_table *t, struct dm_target *ti,
*result = &dd->dm_dev;
return 0;
}
EXPORT_SYMBOL(dm_get_device);

int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
sector_t start, sector_t len, void *data)
Expand Down Expand Up @@ -543,15 +548,8 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
}
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)
{
Expand All @@ -564,6 +562,7 @@ void dm_put_device(struct dm_target *ti, struct dm_dev *d)
kfree(dd);
}
}
EXPORT_SYMBOL(dm_put_device);

/*
* Checks to see if the target joins onto the end of the table.
Expand Down Expand Up @@ -1074,11 +1073,13 @@ void dm_table_event(struct dm_table *t)
t->event_fn(t->event_context);
mutex_unlock(&_event_lock);
}
EXPORT_SYMBOL(dm_table_event);

sector_t dm_table_get_size(struct dm_table *t)
{
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)
{
Expand Down Expand Up @@ -1235,6 +1236,7 @@ fmode_t dm_table_get_mode(struct dm_table *t)
{
return t->mode;
}
EXPORT_SYMBOL(dm_table_get_mode);

static void suspend_targets(struct dm_table *t, unsigned postsuspend)
{
Expand Down Expand Up @@ -1343,6 +1345,7 @@ struct mapped_device *dm_table_get_md(struct dm_table *t)
{
return t->md;
}
EXPORT_SYMBOL(dm_table_get_md);

static int device_discard_capable(struct dm_target *ti, struct dm_dev *dev,
sector_t start, sector_t len, void *data)
Expand Down Expand Up @@ -1380,13 +1383,3 @@ bool dm_table_supports_discards(struct dm_table *t)

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);

0 comments on commit ee53b6f

Please sign in to comment.