aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-table.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/md/dm-table.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r--drivers/md/dm-table.c41
1 files changed, 14 insertions, 27 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 1a6cb3c7822e..9924ea23032d 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -12,6 +12,7 @@
12#include <linux/blkdev.h> 12#include <linux/blkdev.h>
13#include <linux/namei.h> 13#include <linux/namei.h>
14#include <linux/ctype.h> 14#include <linux/ctype.h>
15#include <linux/string.h>
15#include <linux/slab.h> 16#include <linux/slab.h>
16#include <linux/interrupt.h> 17#include <linux/interrupt.h>
17#include <linux/mutex.h> 18#include <linux/mutex.h>
@@ -237,6 +238,9 @@ void dm_table_destroy(struct dm_table *t)
237{ 238{
238 unsigned int i; 239 unsigned int i;
239 240
241 if (!t)
242 return;
243
240 while (atomic_read(&t->holders)) 244 while (atomic_read(&t->holders))
241 msleep(1); 245 msleep(1);
242 smp_mb(); 246 smp_mb();
@@ -425,8 +429,7 @@ static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode,
425 * it's already present. 429 * it's already present.
426 */ 430 */
427static int __table_get_device(struct dm_table *t, struct dm_target *ti, 431static int __table_get_device(struct dm_table *t, struct dm_target *ti,
428 const char *path, sector_t start, sector_t len, 432 const char *path, fmode_t mode, struct dm_dev **result)
429 fmode_t mode, struct dm_dev **result)
430{ 433{
431 int r; 434 int r;
432 dev_t uninitialized_var(dev); 435 dev_t uninitialized_var(dev);
@@ -499,16 +502,15 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
499 return 0; 502 return 0;
500 } 503 }
501 504
502 if (blk_stack_limits(limits, &q->limits, start << 9) < 0) 505 if (bdev_stack_limits(limits, bdev, start) < 0)
503 DMWARN("%s: target device %s is misaligned: " 506 DMWARN("%s: adding target device %s caused an alignment inconsistency: "
504 "physical_block_size=%u, logical_block_size=%u, " 507 "physical_block_size=%u, logical_block_size=%u, "
505 "alignment_offset=%u, start=%llu", 508 "alignment_offset=%u, start=%llu",
506 dm_device_name(ti->table->md), bdevname(bdev, b), 509 dm_device_name(ti->table->md), bdevname(bdev, b),
507 q->limits.physical_block_size, 510 q->limits.physical_block_size,
508 q->limits.logical_block_size, 511 q->limits.logical_block_size,
509 q->limits.alignment_offset, 512 q->limits.alignment_offset,
510 (unsigned long long) start << 9); 513 (unsigned long long) start << SECTOR_SHIFT);
511
512 514
513 /* 515 /*
514 * Check if merge fn is supported. 516 * Check if merge fn is supported.
@@ -524,11 +526,10 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
524} 526}
525EXPORT_SYMBOL_GPL(dm_set_device_limits); 527EXPORT_SYMBOL_GPL(dm_set_device_limits);
526 528
527int dm_get_device(struct dm_target *ti, const char *path, sector_t start, 529int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
528 sector_t len, fmode_t mode, struct dm_dev **result) 530 struct dm_dev **result)
529{ 531{
530 return __table_get_device(ti->table, ti, path, 532 return __table_get_device(ti->table, ti, path, mode, result);
531 start, len, mode, result);
532} 533}
533 534
534 535
@@ -600,11 +601,8 @@ int dm_split_args(int *argc, char ***argvp, char *input)
600 return -ENOMEM; 601 return -ENOMEM;
601 602
602 while (1) { 603 while (1) {
603 start = end;
604
605 /* Skip whitespace */ 604 /* Skip whitespace */
606 while (*start && isspace(*start)) 605 start = skip_spaces(end);
607 start++;
608 606
609 if (!*start) 607 if (!*start)
610 break; /* success, we hit the end */ 608 break; /* success, we hit the end */
@@ -1025,9 +1023,9 @@ combine_limits:
1025 * for the table. 1023 * for the table.
1026 */ 1024 */
1027 if (blk_stack_limits(limits, &ti_limits, 0) < 0) 1025 if (blk_stack_limits(limits, &ti_limits, 0) < 0)
1028 DMWARN("%s: target device " 1026 DMWARN("%s: adding target device "
1029 "(start sect %llu len %llu) " 1027 "(start sect %llu len %llu) "
1030 "is misaligned", 1028 "caused an alignment inconsistency",
1031 dm_device_name(table->md), 1029 dm_device_name(table->md),
1032 (unsigned long long) ti->begin, 1030 (unsigned long long) ti->begin,
1033 (unsigned long long) ti->len); 1031 (unsigned long long) ti->len);
@@ -1079,15 +1077,6 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
1079 struct queue_limits *limits) 1077 struct queue_limits *limits)
1080{ 1078{
1081 /* 1079 /*
1082 * Each target device in the table has a data area that should normally
1083 * be aligned such that the DM device's alignment_offset is 0.
1084 * FIXME: Propagate alignment_offsets up the stack and warn of
1085 * sub-optimal or inconsistent settings.
1086 */
1087 limits->alignment_offset = 0;
1088 limits->misaligned = 0;
1089
1090 /*
1091 * Copy table's limits to the DM device's request_queue 1080 * Copy table's limits to the DM device's request_queue
1092 */ 1081 */
1093 q->limits = *limits; 1082 q->limits = *limits;
@@ -1240,8 +1229,6 @@ void dm_table_unplug_all(struct dm_table *t)
1240 1229
1241struct mapped_device *dm_table_get_md(struct dm_table *t) 1230struct mapped_device *dm_table_get_md(struct dm_table *t)
1242{ 1231{
1243 dm_get(t->md);
1244
1245 return t->md; 1232 return t->md;
1246} 1233}
1247 1234