From 25f532b9218d9016be36cdd3cf9fa841d3826ba3 Mon Sep 17 00:00:00 2001 From: Kevin Corry Date: Sun, 26 Oct 2003 16:37:48 -0800 Subject: [PATCH] [PATCH] Fix DM on top of raid Force Device-Mapper to use PAGE_SIZE or smaller I/O when the underlying device has a bvec_merge_fn routine registered. This will fix the situation of Device-Mapper submitting I/Os to RAID-0 that span the RAID-0 chunk boundaries. Joe is working on a better solution that actually honors the MD merge_bvec_fn routine. But this minimal change will fix the problem for the time being. --- drivers/md/dm-table.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index f665996345827..46eaee908b404 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -489,6 +489,18 @@ int dm_get_device(struct dm_target *ti, const char *path, sector_t start, rs->max_sectors = min_not_zero(rs->max_sectors, q->max_sectors); + /* FIXME: Device-Mapper on top of RAID-0 breaks because DM + * currently doesn't honor MD's merge_bvec_fn routine. + * In this case, we'll force DM to use PAGE_SIZE or + * smaller I/O, just to be safe. A better fix is in the + * works, but add this for the time being so it will at + * least operate correctly. + */ + if (q->merge_bvec_fn) + rs->max_sectors = + min_not_zero(rs->max_sectors, + (unsigned short)(PAGE_SIZE >> 9)); + rs->max_phys_segments = min_not_zero(rs->max_phys_segments, q->max_phys_segments); -- 2.53.0