All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
To: lvm-devel@redhat.com
Subject: [PATCH] Calculate mirror log size instead of hardcoding 1 extent size.
Date: Thu, 25 Dec 2008 12:09:57 +0900	[thread overview]
Message-ID: <4952F985.5010307@ce.jp.nec.com> (raw)
In-Reply-To: <494B82EE.7020006@redhat.com>

Hi Milan,

Milan Broz wrote:
> The change in  _for_each_pv() is tricky, we have no region_size information
> there, but log_lv should be already configured - so it can use le_count.
> (I am not sue if this code is correct anyway, but cannot found
> path where it is wrong.)
>  
> Signed-off-by: Milan Broz <mbroz@redhat.com>
<snip>
> @@ -817,7 +844,7 @@ static int _for_each_pv(struct cmd_conte
>  
>  	/* FIXME only_single_area_segments used as workaround to skip log LV - needs new param? */
>  	if (!only_single_area_segments && seg_is_mirrored(seg) && seg->log_lv) {
> -		if (!(r = _for_each_pv(cmd, seg->log_lv, 0, MIRROR_LOG_SIZE,
> +		if (!(r = _for_each_pv(cmd, seg->log_lv, 0, seg->log_lv->le_count?:1,
>  				       NULL, 0, 0, 0, only_single_area_segments,
>  				       fn, data)))
>  			stack;

"seg->log_lv->le_count?:1" could be just "seg->log_lv->le_count",
to avoid possible future confusion.
(I.e. there is no explanation why we pass 1 when le_count is 0.)

And if the seg->log_lv is empty, _for_each_pv() will just fail anyway
by not finding a matching segment, regardless of len = 0 or 1.
If it is possible to pass an empty seg->log_lv here in future,
le_count check should be done in the above "if", I think.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation


--- lib/metadata/lv_manip.c.orig	2008-12-25 11:44:46.000000000 +0900
+++ lib/metadata/lv_manip.c	2008-12-25 11:33:17.000000000 +0900
@@ -844,7 +844,7 @@ static int _for_each_pv(struct cmd_conte
 
 	/* FIXME only_single_area_segments used as workaround to skip log LV - needs new param? */
 	if (!only_single_area_segments && seg_is_mirrored(seg) && seg->log_lv) {
-		if (!(r = _for_each_pv(cmd, seg->log_lv, 0, seg->log_lv->le_count?:1,
+		if (!(r = _for_each_pv(cmd, seg->log_lv, 0, seg->log_lv->le_count,
 				       NULL, 0, 0, 0, only_single_area_segments,
 				       fn, data)))
 			stack;



  parent reply	other threads:[~2008-12-25  3:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-19 11:18 [PATCH] Calculate mirror log size instead of hardcoding 1 extent size Milan Broz
2008-12-19 14:44 ` Alasdair G Kergon
2008-12-25  3:09 ` Jun'ichi Nomura [this message]
2009-01-06 17:21   ` Milan Broz

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=4952F985.5010307@ce.jp.nec.com \
    --to=j-nomura@ce.jp.nec.com \
    --cc=lvm-devel@redhat.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.