• Immutable Page
  • Info
  • Attachments


RAID1 is a simple RAID mode, storing data on multiple hard drives to increase reliability. RAID1 slows down disk writes because data needs to be written to multiple drives, but it has the potential to speed up reads because a read could be done from any drive. Looking at drivers/md/dm-raid1.c it seems that Linux does not implement this yet:

static struct mirror *choose_mirror(struct mirror_set *ms, sector_t sector)
        /* FIXME: add read balancing */
        return ms->default_mirror;

For bonus points, figure out a really intelligent way to choose the mirror, using factors such as:

  • Sequential IO is fast, so a read adjacant to a previous one should maybe go to the same disk.

  • A RAID1 volume could be only part of the disk, maybe the disk has other requests in the queue and we should pick the least busy disk?

  • Power saving. When the system is nearly idle and only doing reads, maybe one disk could be spun down, with all requests going to the other disk?

RAID1 read balancing was added in 2.6.25: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=06386bbfd2441416875d0403d405c56822f6ebac

Difficulty: 4

Tell others about this page:

last edited 2008-11-22 12:13:33 by LaitrKeiows