Commit 08649012545cfb116798260352547cf4d47064ec

Authored by Mike Snitzer
Committed by Alasdair G Kergon
1 parent 3e8dbb7f39

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>

Showing 1 changed file with 13 additions and 20 deletions Side-by-side Diff

drivers/md/dm-table.c
... ... @@ -157,6 +157,7 @@
157 157  
158 158 return addr;
159 159 }
  160 +EXPORT_SYMBOL(dm_vcalloc);
160 161  
161 162 /*
162 163 * highs, and targets are managed as dynamic arrays during a
... ... @@ -277,6 +278,7 @@
277 278 {
278 279 atomic_inc(&t->holders);
279 280 }
  281 +EXPORT_SYMBOL(dm_table_get);
280 282  
281 283 void dm_table_put(struct dm_table *t)
282 284 {
... ... @@ -286,6 +288,7 @@
286 288 smp_mb__before_atomic_dec();
287 289 atomic_dec(&t->holders);
288 290 }
  291 +EXPORT_SYMBOL(dm_table_put);
289 292  
290 293 /*
291 294 * Checks to see if we need to extend highs or targets.
292 295  
... ... @@ -451,13 +454,14 @@
451 454 * Add a device to the list, or just increment the usage count if
452 455 * it's already present.
453 456 */
454   -static int __table_get_device(struct dm_table *t, struct dm_target *ti,
455   - const char *path, fmode_t mode, struct dm_dev **result)
  457 +int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
  458 + struct dm_dev **result)
456 459 {
457 460 int r;
458 461 dev_t uninitialized_var(dev);
459 462 struct dm_dev_internal *dd;
460 463 unsigned int major, minor;
  464 + struct dm_table *t = ti->table;
461 465  
462 466 BUG_ON(!t);
463 467  
... ... @@ -505,6 +509,7 @@
505 509 *result = &dd->dm_dev;
506 510 return 0;
507 511 }
  512 +EXPORT_SYMBOL(dm_get_device);
508 513  
509 514 int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
510 515 sector_t start, sector_t len, void *data)
511 516  
... ... @@ -543,15 +548,8 @@
543 548 }
544 549 EXPORT_SYMBOL_GPL(dm_set_device_limits);
545 550  
546   -int 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 */
556 554 void dm_put_device(struct dm_target *ti, struct dm_dev *d)
557 555 {
... ... @@ -564,6 +562,7 @@
564 562 kfree(dd);
565 563 }
566 564 }
  565 +EXPORT_SYMBOL(dm_put_device);
567 566  
568 567 /*
569 568 * Checks to see if the target joins onto the end of the table.
570 569  
... ... @@ -1074,11 +1073,13 @@
1074 1073 t->event_fn(t->event_context);
1075 1074 mutex_unlock(&_event_lock);
1076 1075 }
  1076 +EXPORT_SYMBOL(dm_table_event);
1077 1077  
1078 1078 sector_t dm_table_get_size(struct dm_table *t)
1079 1079 {
1080 1080 return t->num_targets ? (t->highs[t->num_targets - 1] + 1) : 0;
1081 1081 }
  1082 +EXPORT_SYMBOL(dm_table_get_size);
1082 1083  
1083 1084 struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index)
1084 1085 {
... ... @@ -1234,6 +1235,7 @@
1234 1235 {
1235 1236 return t->mode;
1236 1237 }
  1238 +EXPORT_SYMBOL(dm_table_get_mode);
1237 1239  
1238 1240 static void suspend_targets(struct dm_table *t, unsigned postsuspend)
1239 1241 {
... ... @@ -1342,6 +1344,7 @@
1342 1344 {
1343 1345 return t->md;
1344 1346 }
  1347 +EXPORT_SYMBOL(dm_table_get_md);
1345 1348  
1346 1349 static int device_discard_capable(struct dm_target *ti, struct dm_dev *dev,
1347 1350 sector_t start, sector_t len, void *data)
... ... @@ -1379,14 +1382,4 @@
1379 1382  
1380 1383 return 0;
1381 1384 }
1382   -
1383   -EXPORT_SYMBOL(dm_vcalloc);
1384   -EXPORT_SYMBOL(dm_get_device);
1385   -EXPORT_SYMBOL(dm_put_device);
1386   -EXPORT_SYMBOL(dm_table_event);
1387   -EXPORT_SYMBOL(dm_table_get_size);
1388   -EXPORT_SYMBOL(dm_table_get_mode);
1389   -EXPORT_SYMBOL(dm_table_get_md);
1390   -EXPORT_SYMBOL(dm_table_put);
1391   -EXPORT_SYMBOL(dm_table_get);