[PATCH] dm: make sure QUEUE_FLAG_CLUSTER is set properly
authorNeilBrown <neilb@suse.de>
Mon, 27 Mar 2006 09:17:49 +0000 (01:17 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 27 Mar 2006 16:44:59 +0000 (08:44 -0800)
This flag should be set for a virtual device iff it is set for all
underlying devices.

Signed-off-by: Neil Brown <neilb@suse.de>
Acked-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/md/dm-table.c
include/linux/device-mapper.h

index 907b08ddb783c845c1b8b0d3631070c38fb37225..9558a4acec129d4f4484a2eea3adbeb6b7f14333 100644 (file)
@@ -97,6 +97,8 @@ static void combine_restrictions_low(struct io_restrictions *lhs,
 
        lhs->seg_boundary_mask =
                min_not_zero(lhs->seg_boundary_mask, rhs->seg_boundary_mask);
+
+       lhs->no_cluster |= rhs->no_cluster;
 }
 
 /*
@@ -523,6 +525,8 @@ int dm_get_device(struct dm_target *ti, const char *path, sector_t start,
                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;
@@ -832,6 +836,11 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q)
        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)
index 51e0e95a421a1a19ed3bfbc30e6e530b112dee55..aee10b2ea4c6855c62d96673371c7eb876e291fa 100644 (file)
@@ -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 {