Skip to contentSkip to conversation

Make sure QUEUE_FLAG_CLUSTER is set properly for dm.

PATCH New NeilBrown 1 participant 1 message Feb 12, 2006 1 message not in the archive Device mapper

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20060213091916.20461.patches@notabene

NeilBrown

author
#1 lore raw

PATCH 1/1 Make sure QUEUE_FLAG_CLUSTER is set properly for dm.

This flag should be set for a virtual device iff it is set for all underlying devices.

### Diffstat output

 ./drivers/md/dm-table.c         |    9 +++++++++
 ./include/linux/device-mapper.h |    1 +
 2 files changed, 10 insertions(+)
drivers/md/dm-table.c renamed from drivers/md/dm-table.c~current~ +9 -0
diff ./drivers/md/dm-table.c~current~ ./drivers/md/dm-table.c
@@ -98,6 +98,8 @@ static void combine_restrictions_low(str
 
 	lhs->seg_boundary_mask =
 		min_not_zero(lhs->seg_boundary_mask, rhs->seg_boundary_mask);
+
+	lhs->no_cluster |= rhs->no_cluster;
 }
 
 /*
@@ -526,6 +528,8 @@ int dm_get_device(struct dm_target *ti, 
 		rs->seg_boundary_mask =
 			min_not_zero(rs->seg_boundary_mask,
 				     q->seg_boundary_mask);
+
+		rs->no_cluster |= !test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags);
 	}
 
 	return r;
@@ -835,6 +839,11 @@ void dm_table_set_restrictions(struct dm
 	q->hardsect_size = t->limits.hardsect_size;
 	q->max_segment_size = t->limits.max_segment_size;
 	q->seg_boundary_mask = t->limits.seg_boundary_mask;
+	if (t->limits.no_cluster)
+		q->queue_flags &= ~(1 << QUEUE_FLAG_CLUSTER);
+	else
+		q->queue_flags |= (1 << QUEUE_FLAG_CLUSTER);
+
 }
 
 unsigned int dm_table_get_num_targets(struct dm_table *t)
include/linux/device-mapper.h renamed from include/linux/device-mapper.h~current~ +1 -0
diff ./include/linux/device-mapper.h~current~ ./include/linux/device-mapper.h
@@ -97,6 +97,7 @@ struct io_restrictions {
 	unsigned short		hardsect_size;
 	unsigned int		max_segment_size;
 	unsigned long		seg_boundary_mask;
+	unsigned char		no_cluster; /* inverted so that 0 is default */
 };
 
 struct dm_target {