diff options
-rw-r--r-- | drivers/md/raid5.c | 5 | ||||
-rw-r--r-- | drivers/md/raid5.h | 22 |
2 files changed, 24 insertions, 3 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 18f20f3d9664..60cfa397f2d6 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -6943,6 +6943,11 @@ static struct r5conf *setup_conf(struct mddev *mddev) if (conf == NULL) goto abort; +#if PAGE_SIZE != DEFAULT_STRIPE_SIZE + conf->stripe_size = DEFAULT_STRIPE_SIZE; + conf->stripe_shift = ilog2(DEFAULT_STRIPE_SIZE) - 9; + conf->stripe_sectors = DEFAULT_STRIPE_SIZE >> 9; +#endif INIT_LIST_HEAD(&conf->free_list); INIT_LIST_HEAD(&conf->pending_list); conf->pending_data = kcalloc(PENDING_IO_MAX, diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index ca21f30e31da..7fb3b26a181a 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h @@ -472,9 +472,14 @@ struct disk_info { */ #define NR_STRIPES 256 +#define DEFAULT_STRIPE_SIZE 4096 + +#if PAGE_SIZE == DEFAULT_STRIPE_SIZE #define STRIPE_SIZE PAGE_SIZE #define STRIPE_SHIFT (PAGE_SHIFT - 9) #define STRIPE_SECTORS (STRIPE_SIZE>>9) +#endif + #define IO_THRESHOLD 1 #define BYPASS_THRESHOLD 1 #define NR_HASH (PAGE_SIZE / sizeof(struct hlist_head)) @@ -557,6 +562,11 @@ struct r5conf { int raid_disks; int max_nr_stripes; int min_nr_stripes; +#if PAGE_SIZE != DEFAULT_STRIPE_SIZE + unsigned long stripe_size; + unsigned int stripe_shift; + unsigned long stripe_sectors; +#endif /* reshape_progress is the leading edge of a 'reshape' * It has value MaxSector when no reshape is happening @@ -673,9 +683,15 @@ struct r5conf { struct r5pending_data *next_pending_data; }; -#define RAID5_STRIPE_SIZE(conf) STRIPE_SIZE -#define RAID5_STRIPE_SHIFT(conf) STRIPE_SHIFT -#define RAID5_STRIPE_SECTORS(conf) STRIPE_SECTORS +#if PAGE_SIZE == DEFAULT_STRIPE_SIZE +#define RAID5_STRIPE_SIZE(conf) STRIPE_SIZE +#define RAID5_STRIPE_SHIFT(conf) STRIPE_SHIFT +#define RAID5_STRIPE_SECTORS(conf) STRIPE_SECTORS +#else +#define RAID5_STRIPE_SIZE(conf) ((conf)->stripe_size) +#define RAID5_STRIPE_SHIFT(conf) ((conf)->stripe_shift) +#define RAID5_STRIPE_SECTORS(conf) ((conf)->stripe_sectors) +#endif /* bio's attached to a stripe+device for I/O are linked together in bi_sector * order without overlap. There may be several bio's per stripe+device, and |