From: NeilBrown <neilb@suse.de>
To: Adam Kwolek <adam.kwolek@intel.com>
Cc: linux-raid@vger.kernel.org, dan.j.williams@intel.com,
ed.ciechanowski@intel.com, wojciech.neubauer@intel.com
Subject: Re: [PATCH 2/8] imsm: FIX: mdadm should process local data
Date: Thu, 13 Jan 2011 13:41:01 +1100 [thread overview]
Message-ID: <20110113134101.6f0eece4@notabene.brown> (raw)
In-Reply-To: <20110112135434.15045.40376.stgit@gklab-128-013.igk.intel.com>
On Wed, 12 Jan 2011 14:54:34 +0100 Adam Kwolek <adam.kwolek@intel.com> wrote:
> When update is created by mdadm, local information should be updated also.
> This makes us to prepare one update for mdmon and second "update" to maintain local changes.
> we can use prepared update for "local/mdadm" metadata update purposes.
> We have 2 cases:
> 1. when metadata is updated by mdmon, we avoid metadata reloading in mdadm.
> we proceed the same updtate 2 times:
> - one time in mdadm for "local update"
> - second time in mdmon for real metadat update
> 2. when metadata is updated by mdadm (no mdmon running) updates are processed in the same
> way.
> - one time in mdadm for "local update"
> - there is no "second time" update but mdadm just flushes
> metadata to array
> This let us to avoid code duplication by using prepare and process update functions
> as for update via mdmon. This makes update preparing mdmon independent
> and there is no need to maintain the same thing in 2 places in code.
>
I've applied something like this, but with some clean-ups which make the
previous patch unnecessary.
NeilBrown
>
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
> ---
>
> super-intel.c | 82 ++++++++++++++++++---------------------------------------
> 1 files changed, 26 insertions(+), 56 deletions(-)
>
> diff --git a/super-intel.c b/super-intel.c
> index a4a4497..7038433 100644
> --- a/super-intel.c
> +++ b/super-intel.c
> @@ -6523,6 +6523,27 @@ abort:
> return 0;
> }
>
> +static void imsm_update_metadata_locally(struct supertype *st,
> + struct metadata_update *mu)
> +{
> + void **space_list;
> +
> + if ((!mu) || (!st))
> + return;
> +
> + imsm_prepare_update(st, mu);
> + imsm_process_update(st, mu);
> +
> + if (mu->space_list) {
> + space_list = (void **)*mu->space_list;
> + while (space_list) {
> + void *space = space_list;
> + space_list = *space_list;
> + free(space);
> + }
> + mu->space_list = NULL;
> + }
> +}
>
> static int imsm_reshape_super(struct supertype *st, long long size, int level,
> int layout, int chunksize, int raid_disks,
> @@ -6565,11 +6586,6 @@ static int imsm_reshape_super(struct supertype *st, long long size, int level,
> st, &geo, &old_raid_disks)) {
> struct imsm_update_reshape *u = NULL;
> int len;
> - struct intel_super *super = st->sb;
> - void **space_list;
> - struct intel_dev *dl;
> - void **space_tail = (void **)&space_list;
> -
>
> len = imsm_create_metadata_update_for_reshape(
> st, &geo, old_raid_disks, &u);
> @@ -6579,58 +6595,12 @@ static int imsm_reshape_super(struct supertype *st, long long size, int level,
> goto exit_imsm_reshape_super;
> }
>
> - /* As well as creating update, we apply update.
> - */
> + ret_val = 0;
> + append_metadata_update(st, u, len);
>
> - dprintf("imsm:prepare space list for update_reshape\n");
> - for (dl = super->devlist; dl;
> - dl = dl->next) {
> - int size = sizeof_imsm_dev(dl->dev, 1);
> - void *s;
> - if (u->new_raid_disks > u->old_raid_disks)
> - size += sizeof(__u32)*2*
> - (u->new_raid_disks - u->old_raid_disks);
> - s = malloc(size);
> - if (!s)
> - break;
> - *space_tail = s;
> - space_tail = s;
> - *space_tail = NULL;
> - }
> - ret_val = apply_reshape_container_disks_update(
> - u, super, &space_list);
> - if (ret_val) {
> - /* reallocate anchor
> - */
> - size_t buf_len = super->len;
> - size_t len =
> - disks_to_mpb_size(u->new_raid_disks);
> - struct imsm_super *mpb = super->anchor;
> - void *new_anchor;
> -
> - if (__le32_to_cpu(mpb->mpb_size) + len >
> - buf_len) {
> - buf_len = ROUND_UP(__le32_to_cpu(
> - mpb->mpb_size) + len, 512);
> - if (posix_memalign(&new_anchor,
> - 512, buf_len) == 0) {
> - memcpy(new_anchor, super->buf,
> - super->len);
> - free(super->buf);
> - super->buf = new_anchor;
> - super->len = buf_len;
> - }
> - super->updates_pending++;
> - ret_val = 0;
> - }
> - } else {
> - while (space_list) {
> - void *space = space_list;
> - space_list = *space_list;
> - free(space);
> - }
> - free(u);
> - }
> + /* update metadata locally
> + */
> + imsm_update_metadata_locally(st, st->updates);
> } else
> fprintf(stderr, Name "imsm: Operation is not allowed "
> "on this container\n");
>
> --
> 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:[~2011-01-13 2:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-12 13:54 [PATCH 0/8] OLCE Raid5/0 single array for external meta Adam Kwolek
2011-01-12 13:54 ` [PATCH 1/8] FIX: put update in to queue for local meta update Adam Kwolek
2011-01-12 13:54 ` [PATCH 2/8] imsm: FIX: mdadm should process local data Adam Kwolek
2011-01-13 2:41 ` NeilBrown [this message]
2011-01-12 13:54 ` [PATCH 3/8] imsm: FIX: local mdadm update shouldn't be done in update creation function Adam Kwolek
2011-01-13 2:41 ` NeilBrown
2011-01-12 13:54 ` [PATCH 4/8] imsm: FIX: old devices memory has to be released Adam Kwolek
2011-01-13 2:41 ` NeilBrown
2011-01-12 13:55 ` [PATCH 5/8] FIX: Cannot load container information Adam Kwolek
2011-01-13 2:42 ` NeilBrown
2011-01-12 13:55 ` [PATCH 6/8] imsm: FIX: spares are not counted Adam Kwolek
2011-01-13 2:42 ` NeilBrown
2011-01-12 13:55 ` [PATCH 7/8] Finalize reshape after adding disks to array Adam Kwolek
2011-01-13 2:43 ` NeilBrown
2011-01-13 9:25 ` Kwolek, Adam
2011-01-12 13:55 ` [PATCH 8/8] FIX: reload metadata for container operation Adam Kwolek
2011-01-13 2:44 ` NeilBrown
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=20110113134101.6f0eece4@notabene.brown \
--to=neilb@suse.de \
--cc=adam.kwolek@intel.com \
--cc=dan.j.williams@intel.com \
--cc=ed.ciechanowski@intel.com \
--cc=linux-raid@vger.kernel.org \
--cc=wojciech.neubauer@intel.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).