• Stefan Behrens's avatar
    Btrfs: add code to scrub to copy read data to another disk · ff023aac
    Stefan Behrens authored
    The device replace procedure makes use of the scrub code. The scrub
    code is the most efficient code to read the allocated data of a disk,
    i.e. it reads sequentially in order to avoid disk head movements, it
    skips unallocated blocks, it uses read ahead mechanisms, and it
    contains all the code to detect and repair defects.
    This commit adds code to scrub to allow the scrub code to copy read
    data to another disk.
    One goal is to be able to perform as fast as possible. Therefore the
    write requests are collected until huge bios are built, and the
    write process is decoupled from the read process with some kind of
    flow control, of course, in order to limit the allocated memory.
    The best performance on spinning disks could by reached when the
    head movements are avoided as much as possible. Therefore a single
    worker is used to interface the read process with the write process.
    The regular scrub operation works as fast as before, it is not
    negatively influenced and actually it is more or less unchanged.
    Signed-off-by: default avatarStefan Behrens <sbehrens@giantdisaster.de>
    Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
    ff023aac
reada.c 23.8 KB