aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2007-12-13 09:16:04 -0500
committerAlasdair G Kergon <agk@redhat.com>2007-12-20 12:32:12 -0500
commit91212507f93778c09d4c1335207b6f4b995f5ad1 (patch)
tree651bc8678413d7d6d6879214264f4bb7f9fb089d
parent69267a30bed1fabec658058c63845528a8b813d4 (diff)
dm: merge max_hw_sector
Make sure dm honours max_hw_sectors of underlying devices We still have no firm testing evidence in support of this patch but believe it may help to resolve some bug reports. - agk Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
-rw-r--r--drivers/md/dm-table.c9
-rw-r--r--include/linux/device-mapper.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index f3f952e347ed..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
@@ -566,6 +569,9 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev)
566 rs->max_segment_size = 569 rs->max_segment_size =
567 min_not_zero(rs->max_segment_size, q->max_segment_size); 570 min_not_zero(rs->max_segment_size, q->max_segment_size);
568 571
572 rs->max_hw_sectors =
573 min_not_zero(rs->max_hw_sectors, q->max_hw_sectors);
574
569 rs->seg_boundary_mask = 575 rs->seg_boundary_mask =
570 min_not_zero(rs->seg_boundary_mask, 576 min_not_zero(rs->seg_boundary_mask,
571 q->seg_boundary_mask); 577 q->seg_boundary_mask);
@@ -703,6 +709,8 @@ static void check_for_valid_limits(struct io_restrictions *rs)
703{ 709{
704 if (!rs->max_sectors) 710 if (!rs->max_sectors)
705 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;
706 if (!rs->max_phys_segments) 714 if (!rs->max_phys_segments)
707 rs->max_phys_segments = MAX_PHYS_SEGMENTS; 715 rs->max_phys_segments = MAX_PHYS_SEGMENTS;
708 if (!rs->max_hw_segments) 716 if (!rs->max_hw_segments)
@@ -901,6 +909,7 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q)
901 q->max_hw_segments = t->limits.max_hw_segments; 909 q->max_hw_segments = t->limits.max_hw_segments;
902 q->hardsect_size = t->limits.hardsect_size; 910 q->hardsect_size = t->limits.hardsect_size;
903 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;
904 q->seg_boundary_mask = t->limits.seg_boundary_mask; 913 q->seg_boundary_mask = t->limits.seg_boundary_mask;
905 q->bounce_pfn = t->limits.bounce_pfn; 914 q->bounce_pfn = t->limits.bounce_pfn;
906 if (t->limits.no_cluster) 915 if (t->limits.no_cluster)
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index b8b7c51389fe..e765e191663d 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -115,6 +115,7 @@ struct io_restrictions {
115 unsigned short max_hw_segments; 115 unsigned short max_hw_segments;
116 unsigned short hardsect_size; 116 unsigned short hardsect_size;
117 unsigned int max_segment_size; 117 unsigned int max_segment_size;
118 unsigned int max_hw_sectors;
118 unsigned long seg_boundary_mask; 119 unsigned long seg_boundary_mask;
119 unsigned long bounce_pfn; 120 unsigned long bounce_pfn;
120 unsigned char no_cluster; /* inverted so that 0 is default */ 121 unsigned char no_cluster; /* inverted so that 0 is default */