From: Shaohua Li <shli@kernel.org>
To: JackieLiu <liuyun01@kylinos.cn>
Cc: songliubraving@fb.com, 刘正元 <liuzhengyuan@kylinos.cn>,
linux-raid@vger.kernel.org
Subject: Re: [PATCH 4/4] md/raid5-cache: adjust the write position of the empty block and mark it as a checkpoint
Date: Mon, 5 Dec 2016 17:00:32 -0800 [thread overview]
Message-ID: <20161206010032.wqdvrogugbbkmhg6@kernel.org> (raw)
In-Reply-To: <D667B2F7-64DE-434D-B793-F4F514BB2714@kylinos.cn>
On Mon, Dec 05, 2016 at 11:58:53AM +0800, JackieLiu wrote:
>
> > 在 2016年12月3日,04:10,Shaohua Li <shli@kernel.org> 写道:
> >
> > confusing reading the code. Don't think a 'if () write_empty_block' makes the
>
> Hi ShaoHua.
>
> I rewrote this part of the code, now without data_only_stripes, we write an empty block here,
> with data_only_stripes, mark the first cache block as last_checkpoint.
Next time please send formal patch and fix your mail client (it skews up tabs).
I manually applied this patch this time. Thanks!
Best Regards,
Shaohua
> diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c
> index 9e72180..5697724 100644
> --- a/drivers/md/raid5-cache.c
> +++ b/drivers/md/raid5-cache.c
> @@ -2072,7 +2072,6 @@ r5c_recovery_rewrite_data_only_stripes(struct r5l_log *log,
> return -ENOMEM;
> }
>
> - ctx->seq += 10;
> list_for_each_entry_safe(sh, next, &ctx->cached_list, lru) {
> struct r5l_meta_block *mb;
> int i;
> @@ -2132,6 +2131,8 @@ static int r5l_recovery_log(struct r5l_log *log)
> struct mddev *mddev = log->rdev->mddev;
> struct r5l_recovery_ctx ctx;
> int ret;
> + sector_t pos;
> + struct stripe_head *sh;
>
> ctx.pos = log->last_checkpoint;
> ctx.seq = log->last_cp_seq;
> @@ -2149,6 +2150,18 @@ static int r5l_recovery_log(struct r5l_log *log)
> if (ret)
> return ret;
>
> + pos = ctx.pos;
> + ctx.seq += 10;
> +
> + if (ctx.data_only_stripes == 0) {
> + log->next_checkpoint = ctx.pos;
> + r5l_log_write_empty_meta_block(log, ctx.pos, ctx.seq++);
> + ctx.pos = r5l_ring_add(log, ctx.pos, BLOCK_SECTORS);
> + } else {
> + sh = list_last_entry(&ctx.cached_list, struct stripe_head, lru);
> + log->next_checkpoint = sh->log_start;
> + }
> +
> if ((ctx.data_only_stripes == 0) && (ctx.data_parity_stripes == 0))
> pr_debug("md/raid:%s: starting from clean shutdown\n",
> mdname(mddev));
> @@ -2166,10 +2179,9 @@ static int r5l_recovery_log(struct r5l_log *log)
> }
>
> log->log_start = ctx.pos;
> - log->next_checkpoint = ctx.pos;
> log->seq = ctx.seq;
> - r5l_log_write_empty_meta_block(log, ctx.pos, ctx.seq);
> - r5l_write_super(log, ctx.pos);
> + log->last_checkpoint = pos;
> + r5l_write_super(log, pos);
> return 0;
> }
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-12-06 1:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-28 8:19 [PATCH 1/4] md/raid5-cache: remove unnecessary function parameters JackieLiu
2016-11-28 8:19 ` [PATCH 2/4] md/raid5-cache: use ring add to prevent overflow JackieLiu
2016-11-29 20:31 ` Song Liu
2016-11-28 8:19 ` [PATCH 3/4] md/raid5-cache: release the stripe_head at the appropriate location JackieLiu
2016-11-29 20:33 ` Song Liu
2016-11-28 8:19 ` [PATCH 4/4] md/raid5-cache: adjust the write position of the empty block and mark it as a checkpoint JackieLiu
2016-11-29 20:33 ` Song Liu
2016-11-29 22:31 ` Shaohua Li
2016-11-30 4:03 ` JackieLiu
2016-12-02 20:10 ` Shaohua Li
2016-12-05 3:58 ` JackieLiu
2016-12-06 1:00 ` Shaohua Li [this message]
2016-11-29 20:14 ` [PATCH 1/4] md/raid5-cache: remove unnecessary function parameters 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=20161206010032.wqdvrogugbbkmhg6@kernel.org \
--to=shli@kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=liuyun01@kylinos.cn \
--cc=liuzhengyuan@kylinos.cn \
--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).