]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
md/r5cache: shift complex rmw from read path to write path
authorSong Liu <songliubraving@fb.com>
Tue, 24 Jan 2017 01:12:58 +0000 (17:12 -0800)
committerShaohua Li <shli@fb.com>
Tue, 24 Jan 2017 19:20:15 +0000 (11:20 -0800)
commit07e83364845e1e1c7e189a01206a9d7d33831568
tree5b454f7d444476a4b1c4e1ce2e5b954a638d9923
parenta85dd7b8df52e35d8ee3794c65cac5c39128fd80
md/r5cache: shift complex rmw from read path to write path

Write back cache requires a complex RMW mechanism, where old data is
read into dev->orig_page for prexor, and then xor is done with
dev->page. This logic is already implemented in the write path.

However, current read path is not awared of this requirement. When
the array is optimal, the RMW is not required, as the data are
read from raid disks. However, when the target stripe is degraded,
complex RMW is required to generate right data.

To keep read path as clean as possible, we handle read path by
flushing degraded, in-journal stripes before processing reads to
missing dev.

Specifically, when there is read requests to a degraded stripe
with data in journal, handle_stripe_fill() calls
r5c_make_stripe_write_out() and exits. Then handle_stripe_dirtying()
will do the complex RMW and flush the stripe to RAID disks. After
that, read requests are handled.

There is one more corner case when there is non-overwrite bio for
the missing (or out of sync) dev. handle_stripe_dirtying() will not
be able to process the non-overwrite bios without constructing the
data in handle_stripe_fill(). This is fixed by delaying non-overwrite
bios in handle_stripe_dirtying(). So handle_stripe_fill() works on
these bios after the stripe is flushed to raid disks.

Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/raid5.c