Skip to contentSkip to conversation

md: define raid5_mergeable_bvec

PATCH Raz Ben-Jehuda(caro) 2 participants 2 messages Dec 11, 2006 4 messages not in the archive MD RAID

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

this is against 2.6.19-git17
hope this correct
raz

Quoted 65 lines · Jens Axboe
Quoted 49 lines · Raz Ben-Jehuda(caro)
Quoted 48 lines · Jens Axboe
Quoted 3 lines · On Sun, Dec 10 2006, [email protected] wrote:

From: "Raz Ben-Jehuda(caro)" <[email protected]>

This will encourage read request to be on only one device, so we will

often be

Quoted 11 lines

able to bypass the cache for read requests.

---

 drivers/md/raid5.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff -puN drivers/md/raid5.c~md-define-raid5_mergeable_bvec

drivers/md/raid5.c

drivers/md/raid5.c static int raid5_congested(void *data, i · line 2617

Quoted 10 lines
drivers/md/raid5.c renamed from drivers/md/raid5.c~md-define-raid5_mergeable_bvec +4 -0
@@ -2611,6 +2611,28 @@ static int raid5_congested(void *data, i
      return 0;
 }
 
+/* We want read requests to align with chunks where possible,
+ * but write requests don't need to.
+ */
+static int raid5_mergeable_bvec(request_queue_t *q, struct bio *bio,

struct bio_vec *biovec)

drivers/md/raid5.c static int raid5_congested(void *data, i · line 2626

Quoted 9 lines
drivers/md/raid5.c renamed from drivers/md/raid5.c~md-define-raid5_mergeable_bvec +9 -0
+{
+     mddev_t *mddev = q->queuedata;
+     sector_t sector = bio->bi_sector + get_start_sect(bio->bi_bdev);
+     int max;
+     unsigned int chunk_sectors = mddev->chunk_size >> 9;
+     unsigned int bio_sectors = bio->bi_size >> 9;
+
+     if (bio_data_dir(bio))
+             return biovec->bv_len; /* always allow writes to be

mergeable */

Please don't ever do that - you are making assumptions on the value of READ and WRITE.

       if (bio_data_dir(bio) == WRITE)
               ...

If this has already been merged, please submit a patch correcting it. People end up copying code like this :-)

Quoted 7 lines
Quoted 4 lines

--
Jens Axboe

thanks Jens
the attached is a fix.

But the patch is already merged, so the patch needs to be against Linus' current tree.

--
Jens Axboe

Signature · 1 line
Raz
drivers/md/raid5.c +1 -1
@@ -2567,7 +2567,7 @@
 	unsigned int chunk_sectors = mddev->chunk_size >> 9;
 	unsigned int bio_sectors = bio->bi_size >> 9;
 
-	if (bio_data_dir(bio))
+	if (bio_data_dir(bio) == WRITE )
 		return biovec->bv_len; /* always allow writes to be mergeable */
 
 	max =  (chunk_sectors - ((sector & (chunk_sectors - 1)) + bio_sectors)) << 9;
#5 lore raw
Quoted 2 lines · Raz Ben-Jehuda(caro)

this is against 2.6.19-git17
hope this correct

Patch itself looks fine. Some general suggestions for the future:

- Don't top post on lkml
- Inline patches, and always include a description and a Signed-off-by line.
- Documentation/SubmittingPatches has a lot of good info.

Signature · 1 line
Jens Axboe