aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-table.c
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2011-08-02 07:32:04 -0400
committerAlasdair G Kergon <agk@redhat.com>2011-08-02 07:32:04 -0400
commit08649012545cfb116798260352547cf4d47064ec (patch)
tree8aa7eac4b53a07a9bdcb01ed2da11e250c823187 /drivers/md/dm-table.c
parent3e8dbb7f3966c80d77272f8b4f430babc99f6595 (diff)
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>
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r--drivers/md/dm-table.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 8dc67555e736..d58b200a3531 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -157,6 +157,7 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size)
157 157
158 return addr; 158 return addr;
159} 159}
160EXPORT_SYMBOL(dm_vcalloc);
160 161
161/* 162/*
162 * highs, and targets are managed as dynamic arrays during a 163 * highs, and targets are managed as dynamic arrays during a
@@ -277,6 +278,7 @@ void dm_table_get(struct dm_table *t)
277{ 278{
278 atomic_inc(&t->holders); 279 atomic_inc(&t->holders);
279} 280}
281EXPORT_SYMBOL(dm_table_get);
280 282
281void dm_table_put(struct dm_table *t) 283void dm_table_put(struct dm_table *t)
282{ 284{
@@ -286,6 +288,7 @@ void dm_table_put(struct dm_table *t)
286 smp_mb__before_atomic_dec(); 288 smp_mb__before_atomic_dec();
287 atomic_dec(&t->holders); 289 atomic_dec(&t->holders);
288} 290}
291EXPORT_SYMBOL(dm_table_put);
289 292
290/* 293/*
291 * Checks to see if we need to extend highs or targets. 294 * 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,
451 * Add a device to the list, or just increment the usage count if 454 * Add a device to the list, or just increment the usage count if
452 * it's already present. 455 * it's already present.
453 */ 456 */
454static int __table_get_device(struct dm_table *t, struct dm_target *ti, 457int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
455 const char *path, fmode_t mode, struct dm_dev **result) 458 struct dm_dev **result)
456{ 459{
457 int r; 460 int r;
458 dev_t uninitialized_var(dev); 461 dev_t uninitialized_var(dev);
459 struct dm_dev_internal *dd; 462 struct dm_dev_internal *dd;
460 unsigned int major, minor; 463 unsigned int major, minor;
464 struct dm_table *t = ti->table;
461 465
462 BUG_ON(!t); 466 BUG_ON(!t);
463 467
@@ -505,6 +509,7 @@ static int __table_get_device(struct dm_table *t, struct dm_target *ti,
505 *result = &dd->dm_dev; 509 *result = &dd->dm_dev;
506 return 0; 510 return 0;
507} 511}
512EXPORT_SYMBOL(dm_get_device);
508 513
509int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, 514int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
510 sector_t start, sector_t len, void *data) 515 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,
543} 548}
544EXPORT_SYMBOL_GPL(dm_set_device_limits); 549EXPORT_SYMBOL_GPL(dm_set_device_limits);
545 550
546int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
547 struct dm_dev **result)
548{
549 return __table_get_device(ti->table, ti, path, mode, result);
550}
551
552
553/* 551/*
554 * Decrement a devices use count and remove it if necessary. 552 * Decrement a device's use count and remove it if necessary.
555 */ 553 */
556void dm_put_device(struct dm_target *ti, struct dm_dev *d) 554void dm_put_device(struct dm_target *ti, struct dm_dev *d)
557{ 555{
@@ -564,6 +562,7 @@ void dm_put_device(struct dm_target *ti, struct dm_dev *d)
564 kfree(dd); 562 kfree(dd);
565 } 563 }
566} 564}
565EXPORT_SYMBOL(dm_put_device);
567 566
568/* 567/*
569 * Checks to see if the target joins onto the end of the table. 568 * 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)
1074 t->event_fn(t->event_context); 1073 t->event_fn(t->event_context);
1075 mutex_unlock(&_event_lock); 1074 mutex_unlock(&_event_lock);
1076} 1075}
1076EXPORT_SYMBOL(dm_table_event);
1077 1077
1078sector_t dm_table_get_size(struct dm_table *t) 1078sector_t dm_table_get_size(struct dm_table *t)
1079{ 1079{
1080 return t->num_targets ? (t->highs[t->num_targets - 1] + 1) : 0; 1080 return t->num_targets ? (t->highs[t->num_targets - 1] + 1) : 0;
1081} 1081}
1082EXPORT_SYMBOL(dm_table_get_size);
1082 1083
1083struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index) 1084struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index)
1084{ 1085{
@@ -1234,6 +1235,7 @@ fmode_t dm_table_get_mode(struct dm_table *t)
1234{ 1235{
1235 return t->mode; 1236 return t->mode;
1236} 1237}
1238EXPORT_SYMBOL(dm_table_get_mode);
1237 1239
1238static void suspend_targets(struct dm_table *t, unsigned postsuspend) 1240static void suspend_targets(struct dm_table *t, unsigned postsuspend)
1239{ 1241{
@@ -1342,6 +1344,7 @@ struct mapped_device *dm_table_get_md(struct dm_table *t)
1342{ 1344{
1343 return t->md; 1345 return t->md;
1344} 1346}
1347EXPORT_SYMBOL(dm_table_get_md);
1345 1348
1346static int device_discard_capable(struct dm_target *ti, struct dm_dev *dev, 1349static int device_discard_capable(struct dm_target *ti, struct dm_dev *dev,
1347 sector_t start, sector_t len, void *data) 1350 sector_t start, sector_t len, void *data)
@@ -1379,13 +1382,3 @@ bool dm_table_supports_discards(struct dm_table *t)
1379 1382
1380 return 0; 1383 return 0;
1381} 1384}
1382
1383EXPORT_SYMBOL(dm_vcalloc);
1384EXPORT_SYMBOL(dm_get_device);
1385EXPORT_SYMBOL(dm_put_device);
1386EXPORT_SYMBOL(dm_table_event);
1387EXPORT_SYMBOL(dm_table_get_size);
1388EXPORT_SYMBOL(dm_table_get_mode);
1389EXPORT_SYMBOL(dm_table_get_md);
1390EXPORT_SYMBOL(dm_table_put);
1391EXPORT_SYMBOL(dm_table_get);