/* calculate the max read-ahead size.
* For read-ahead of large files to be effective, we need to
- * readahead at least a whole stripe. i.e. number of devices
- * multiplied by chunk size.
+ * readahead at least twice a whole stripe. i.e. number of devices
+ * multiplied by chunk size times 2.
* If an individual device has an ra_pages greater than the
* chunk size, then we will not drive that device as hard as it
* wants. We consider this a configuration error: a larger
*/
{
int stripe = mddev->raid_disks * mddev->chunk_size / PAGE_CACHE_SIZE;
- if (mddev->queue->backing_dev_info.ra_pages < stripe)
- mddev->queue->backing_dev_info.ra_pages = stripe;
+ if (mddev->queue->backing_dev_info.ra_pages < 2* stripe)
+ mddev->queue->backing_dev_info.ra_pages = 2* stripe;
}
print_raid5_conf(conf);
- /* read-ahead size must cover a whole stripe, which is
- * (n-1) * chunksize where 'n' is the number of raid devices
+ /* read-ahead size must cover two whole stripes, which is
+ * 2 * (n-1) * chunksize where 'n' is the number of raid devices
*/
{
int stripe = (mddev->raid_disks-1) * mddev->chunk_size
/ PAGE_CACHE_SIZE;
- if (mddev->queue->backing_dev_info.ra_pages < stripe)
- mddev->queue->backing_dev_info.ra_pages = stripe;
+ if (mddev->queue->backing_dev_info.ra_pages < 2 * stripe)
+ mddev->queue->backing_dev_info.ra_pages = 2 * stripe;
}
/* Ok, everything is just fine now */
print_raid6_conf(conf);
- /* read-ahead size must cover a whole stripe, which is
- * (n-2) * chunksize where 'n' is the number of raid devices
+ /* read-ahead size must cover two whole stripes, which is
+ * 2 * (n-2) * chunksize where 'n' is the number of raid devices
*/
{
int stripe = (mddev->raid_disks-2) * mddev->chunk_size
/ PAGE_CACHE_SIZE;
- if (mddev->queue->backing_dev_info.ra_pages < stripe)
- mddev->queue->backing_dev_info.ra_pages = stripe;
+ if (mddev->queue->backing_dev_info.ra_pages < 2 * stripe)
+ mddev->queue->backing_dev_info.ra_pages = 2 * stripe;
}
/* Ok, everything is just fine now */