aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-table.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-20 14:25:22 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-20 14:25:22 -0500
commit17eb2c3b56afe72f76330b5db657c8b4fc98aa39 (patch)
tree89aaaf505626209729ca0843467288f070680e58 /drivers/md/dm-table.c
parent3c378158d4cd2125b42fe2b8bb23d512fdff6fe6 (diff)
parent91e106259214b40e992a58fb9417da46868e19b2 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm
* git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm: dm crypt: use bio_add_page dm: merge max_hw_sector dm: trigger change uevent on rename dm crypt: fix write endio dm mpath: hp requires scsi dm: table detect io beyond device
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r--drivers/md/dm-table.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index e298d8d11f24..47818d8249cb 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -99,6 +99,9 @@ static void combine_restrictions_low(struct io_restrictions *lhs,
99 lhs->max_segment_size = 99 lhs->max_segment_size =
100 min_not_zero(lhs->max_segment_size, rhs->max_segment_size); 100 min_not_zero(lhs->max_segment_size, rhs->max_segment_size);
101 101
102 lhs->max_hw_sectors =
103 min_not_zero(lhs->max_hw_sectors, rhs->max_hw_sectors);
104
102 lhs->seg_boundary_mask = 105 lhs->seg_boundary_mask =
103 min_not_zero(lhs->seg_boundary_mask, rhs->seg_boundary_mask); 106 min_not_zero(lhs->seg_boundary_mask, rhs->seg_boundary_mask);
104 107
@@ -189,8 +192,10 @@ static int alloc_targets(struct dm_table *t, unsigned int num)
189 192
190 /* 193 /*
191 * Allocate both the target array and offset array at once. 194 * Allocate both the target array and offset array at once.
195 * Append an empty entry to catch sectors beyond the end of
196 * the device.
192 */ 197 */
193 n_highs = (sector_t *) dm_vcalloc(num, sizeof(struct dm_target) + 198 n_highs = (sector_t *) dm_vcalloc(num + 1, sizeof(struct dm_target) +
194 sizeof(sector_t)); 199 sizeof(sector_t));
195 if (!n_highs) 200 if (!n_highs)
196 return -ENOMEM; 201 return -ENOMEM;
@@ -564,6 +569,9 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev)
564 rs->max_segment_size = 569 rs->max_segment_size =
565 min_not_zero(rs->max_segment_size, q->max_segment_size); 570 min_not_zero(rs->max_segment_size, q->max_segment_size);
566 571
572 rs->max_hw_sectors =
573 min_not_zero(rs->max_hw_sectors, q->max_hw_sectors);
574
567 rs->seg_boundary_mask = 575 rs->seg_boundary_mask =
568 min_not_zero(rs->seg_boundary_mask, 576 min_not_zero(rs->seg_boundary_mask,
569 q->seg_boundary_mask); 577 q->seg_boundary_mask);
@@ -701,6 +709,8 @@ static void check_for_valid_limits(struct io_restrictions *rs)
701{ 709{
702 if (!rs->max_sectors) 710 if (!rs->max_sectors)
703 rs->max_sectors = SAFE_MAX_SECTORS; 711 rs->max_sectors = SAFE_MAX_SECTORS;
712 if (!rs->max_hw_sectors)
713 rs->max_hw_sectors = SAFE_MAX_SECTORS;
704 if (!rs->max_phys_segments) 714 if (!rs->max_phys_segments)
705 rs->max_phys_segments = MAX_PHYS_SEGMENTS; 715 rs->max_phys_segments = MAX_PHYS_SEGMENTS;
706 if (!rs->max_hw_segments) 716 if (!rs->max_hw_segments)
@@ -867,6 +877,9 @@ struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index)
867 877
868/* 878/*
869 * Search the btree for the correct target. 879 * Search the btree for the correct target.
880 *
881 * Caller should check returned pointer with dm_target_is_valid()
882 * to trap I/O beyond end of device.
870 */ 883 */
871struct dm_target *dm_table_find_target(struct dm_table *t, sector_t sector) 884struct dm_target *dm_table_find_target(struct dm_table *t, sector_t sector)
872{ 885{
@@ -896,6 +909,7 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q)
896 q->max_hw_segments = t->limits.max_hw_segments; 909 q->max_hw_segments = t->limits.max_hw_segments;
897 q->hardsect_size = t->limits.hardsect_size; 910 q->hardsect_size = t->limits.hardsect_size;
898 q->max_segment_size = t->limits.max_segment_size; 911 q->max_segment_size = t->limits.max_segment_size;
912 q->max_hw_sectors = t->limits.max_hw_sectors;
899 q->seg_boundary_mask = t->limits.seg_boundary_mask; 913 q->seg_boundary_mask = t->limits.seg_boundary_mask;
900 q->bounce_pfn = t->limits.bounce_pfn; 914 q->bounce_pfn = t->limits.bounce_pfn;
901 if (t->limits.no_cluster) 915 if (t->limits.no_cluster)