All of lore.kernel.org
 help / color / mirror / Atom feed
From: JackieLiu <liuyun01@kylinos.cn>
To: Shaohua Li <shli@kernel.org>
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: Wed, 30 Nov 2016 12:03:14 +0800	[thread overview]
Message-ID: <256217AC-28C5-4C52-ABDB-9C36221E6A1B@kylinos.cn> (raw)
In-Reply-To: <20161129223150.tseez7b4y6lb72fs@kernel.org>


> 在 2016年11月30日,06:31,Shaohua Li <shli@kernel.org> 写道:
> 
> On Mon, Nov 28, 2016 at 04:19:21PM +0800, JackieLiu wrote:
>> When recovery is complete, we write an empty block and record his
>> position first, then make the data-only stripes rewritten done,
>> the location of the empty block as the last checkpoint position
>> to write into the super block. And we should update last_checkpoint
>> to this empty block position.
>> ...
>> +	pos = ctx.pos;
>> +	r5l_log_write_empty_meta_block(log, ctx.pos, (ctx.seq += 10));
> 
> hmm, move the ctx.seq += 10 out please

yep, if this patch is OK,I will resend an appropriate patch.

>> +	ctx.pos = r5l_ring_add(log, ctx.pos, BLOCK_SECTORS);
>> +
>> 	if ((ctx.data_only_stripes == 0) && (ctx.data_parity_stripes == 0))
>> 		pr_debug("md/raid:%s: starting from clean shutdown\n",
>> 			 mdname(mddev));
>> @@ -2167,9 +2171,9 @@ static int r5l_recovery_log(struct r5l_log *log)
>> 
>> 	log->log_start = ctx.pos;
>> 	log->next_checkpoint = ctx.pos;
>> +	log->last_checkpoint = pos;
>> 	log->seq = ctx.seq;
>> -	r5l_log_write_empty_meta_block(log, ctx.pos, ctx.seq);
>> -	r5l_write_super(log, ctx.pos);
>> +	r5l_write_super(log, pos);
>> 	return 0;
>> }
> 
> Applied the first 3 patches in the series. This one looks good too, but why we
> always create the empty meta block? It's only required when we don't rewrite
> the data. Eg, the data_only_stripes == 0.
> 
> Thanks,
> Shaohua

As you said, when data_only_stripes != 0, does not need to write an empty 
meta block, but we need to calculate the position of the first list member and
save it.  at the same time, when data_only_stripes == 0, then you need to write
an empty block, and let the super block pointing to him; In any case, Since 
there is a possibility that invalid blocks are connected to valid blocks, we still 
need to add 10 to them.

In my option, if this empty block has been added, we just let the super block 
pointing to him, everything is OK now, the code is more clean, and the logic 
is clear.

Thanks
Jackie





  reply	other threads:[~2016-11-30  4:03 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 [this message]
2016-12-02 20:10       ` Shaohua Li
2016-12-05  3:58         ` JackieLiu
2016-12-06  1:00           ` Shaohua Li
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=256217AC-28C5-4C52-ABDB-9C36221E6A1B@kylinos.cn \
    --to=liuyun01@kylinos.cn \
    --cc=linux-raid@vger.kernel.org \
    --cc=liuzhengyuan@kylinos.cn \
    --cc=shli@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.