From: NeilBrown <neilb@suse.com>
To: linux-raid@vger.kernel.org
Cc: shli@fb.com, kernel-team@fb.com, dan.j.williams@intel.com,
hch@infradead.org, liuzhengyuang521@gmail.com,
liuzhengyuan@kylinos.cn, Song Liu <songliubraving@fb.com>
Subject: Re: [PATCH v5 7/8] md/r5cache: r5c recovery
Date: Thu, 20 Oct 2016 14:03:13 +1100 [thread overview]
Message-ID: <87vawnwwlq.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20161013054944.1038806-8-songliubraving@fb.com>
[-- Attachment #1: Type: text/plain, Size: 3060 bytes --]
On Thu, Oct 13 2016, Song Liu wrote:
> This is the recovery part of raid5-cache.
>
> With cache feature, there are 2 different scenarios of recovery:
> 1. Data-Parity stripe: a stripe with complete parity in journal.
> 2. Data-Only stripe: a stripe with only data in journal (or partial
> parity).
>
> The code differentiate Data-Parity stripe from Data-Only stripe with
> flag (STRIPE_R5C_WRITTEN).
>
> For Data-Parity stripes, we use the same procedure as raid5 journal,
> where all the data and parity are replayed to the RAID devices.
>
> For Data-Only strips, we need to finish complete calculate parity and
> finish the full reconstruct write or RMW write. For simplicity, in
> the recovery, we load the stripe to stripe cache. Once the array is
> started, the stripe cache state machine will handle these stripes
> through normal write path.
>
> r5c_recovery_flush_log contains the main procedure of recovery. The
> recovery code first scans through the journal and loads data to
> stripe cache. The code keeps tracks of all these stripes in a list
> (use sh->lru and ctx->cached_list), stripes in the list are
> organized in the order of its first appearance on the journal.
> During the scan, the recovery code assesses each stripe as
> Data-Parity or Data-Only.
>
> During scan, the array may run out of stripe cache. In these cases,
> the recovery code will also call raid5_set_cache_size to increase
> stripe cache size.
>
> At the end of scan, the recovery code replays all Data-Parity
> stripes, and sets proper states for Data-Only stripes. The recovery
> code also increases seq number by 10 and rewrites all Data-Only
> stripes to journal. This is to avoid confusion after repeated
> crashes. More details is explained in raid5-cache.c before
> r5c_recovery_rewrite_data_only_stripes().
>
> Signed-off-by: Song Liu <songliubraving@fb.com>
This patch seems to do a number of different things.
I think it re-factors the journal reading code.
It adds code to write a new "empty" journal metadata block
and it adds support for recovery of cached data.
All this together makes it hard to review. I'd rather more smaller
patches.
> + /* stripes only have parity are already flushed to RAID */
> + if (data_count == 0)
> + goto out;
Can you explain why that is? When were they flushed to the RAID, and
how was the parity determined?
> +
> +static void
> +r5l_recovery_create_emtpy_meta_block(struct r5l_log *log,
"empty"
> + struct page *page,
> + sector_t pos, u64 seq)
> +/* returns 0 for match; 1 for mismtach */
No, please don't do that.
You can return an negative error if you like, and call it as
function_name() < 0
or
function_name() == 0
or give the function a name that describes what it tests
i.e.
r5l_data_checksum_is_correct()
or
r5l_data_checksum_does_not_match()
and then return 0 if the test fails and 1 if it succeeds.
> +static int
> +r5l_recovery_verify_data_checksum(struct r5l_log *log, struct page *page,
> + sector_t log_offset, __le32 log_checksum)
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]
next prev parent reply other threads:[~2016-10-20 3:03 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-13 5:49 [PATCH v5 0/8] raid5-cache: enabling cache features Song Liu
2016-10-13 5:49 ` [PATCH v5 1/8] md/r5cache: Check array size in r5l_init_log Song Liu
2016-10-13 5:49 ` [PATCH v5 2/8] md/r5cache: move some code to raid5.h Song Liu
2016-10-13 5:49 ` [PATCH v5 3/8] md/r5cache: State machine for raid5-cache write back mode Song Liu
2016-10-14 6:13 ` NeilBrown
2016-10-14 7:03 ` Song Liu
2016-10-13 5:49 ` [PATCH v5 4/8] md/r5cache: write part of r5cache Song Liu
2016-10-14 6:53 ` NeilBrown
2016-10-14 7:33 ` Song Liu
2016-10-19 0:53 ` NeilBrown
2016-10-21 20:42 ` Song Liu
2016-10-13 5:49 ` [PATCH v5 5/8] md/r5cache: reclaim support Song Liu
2016-10-19 2:03 ` NeilBrown
2016-10-21 21:04 ` Song Liu
2016-10-13 5:49 ` [PATCH v5 6/8] md/r5cache: sysfs entry r5c_state Song Liu
2016-10-19 2:19 ` NeilBrown
2016-10-21 21:20 ` Song Liu
2016-10-13 5:49 ` [PATCH v5 7/8] md/r5cache: r5c recovery Song Liu
2016-10-19 2:32 ` NeilBrown
2016-10-20 3:03 ` NeilBrown [this message]
2016-10-21 21:12 ` Song Liu
2016-10-26 1:18 ` NeilBrown
2016-10-13 5:49 ` [PATCH v5 8/8] md/r5cache: handle SYNC and FUA Song Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vawnwwlq.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=dan.j.williams@intel.com \
--cc=hch@infradead.org \
--cc=kernel-team@fb.com \
--cc=linux-raid@vger.kernel.org \
--cc=liuzhengyuan@kylinos.cn \
--cc=liuzhengyuang521@gmail.com \
--cc=shli@fb.com \
--cc=songliubraving@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).