]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] fix raid0 readahead size
authorAndrew Morton <akpm@osdl.org>
Fri, 12 Mar 2004 00:19:57 +0000 (16:19 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 12 Mar 2004 00:19:57 +0000 (16:19 -0800)
From: Arjan van de Ven <arjanv@redhat.com>

Readahead of raid0 was suboptimal; it read only 1 stride ahead.  The
problem with this is that while it will keep all spindles busy, it will not
actually manage to make larger IO's, eg each disk would just do the chunk
size IO.  Doing at least 2 chunks is more than appropriate so that each
spindle will get a chance to merge IO's.

(Neil fixed raid6 and raid6 too)

drivers/md/raid0.c
drivers/md/raid5.c
drivers/md/raid6main.c

index cf71910c23deebe8559327ec2d57108e7241ae64..3b3385c35389bf829497f55d8a326ff8655f7291 100644 (file)
@@ -313,8 +313,8 @@ static int raid0_run (mddev_t *mddev)
 
        /* 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
@@ -322,8 +322,8 @@ static int raid0_run (mddev_t *mddev)
         */
        {
                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;
        }
 
 
index 9ff47e712c00c98f81aa6c26991fcae4935572d2..c4cf610b7d7a915b2bcdd545a0e6c8a91c7b19aa 100644 (file)
@@ -1602,14 +1602,14 @@ memory = conf->max_nr_stripes * (sizeof(struct stripe_head) +
 
        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 */
index 8063fb5867d87bce8f7e131dff2ea83489292dda..a4ef32dfefe6a4db7d31eec04ee1a0464aa7d8d9 100644 (file)
@@ -1771,14 +1771,14 @@ static int run (mddev_t *mddev)
 
        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 */