All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Becker <Joel.Becker@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 1/1] Patch to recover orphans in offline	slots during recovery and mount
Date: Thu, 5 Mar 2009 15:28:34 -0800	[thread overview]
Message-ID: <20090305232833.GA27682@mail.oracle.com> (raw)
In-Reply-To: <1236246813-16263-1-git-send-email-srinivas.eeda@oracle.com>

On Thu, Mar 05, 2009 at 01:53:33AM -0800, Srinivas Eeda wrote:
> During recovery, a node recovers orphans in it's slot and the dead node(s). But
> if the dead nodes were holding orphans in offline slots, they will be left
> unrecovered.
> 
> If the dead node is the last one to die and is holding orphans in other slots
> and is the first one to mount, then it only recovers it's own slot, which
> leaves orphans in offline slots.
> 
> This patch queues complete_recovery to clean orphans for all offline slots
> during mount and node recovery.

	A couple comments.

> +/*
> + * This replay_map is to track online/offline slots, so we could recover
> + * offline slots during recovery and mount
> + */
> +
> +enum ocfs2_replay_state {
> +	REPLAY_UNNEEDED,
> +	REPLAY_NEEDED,
> +	REPLAY_DONE
> +};

	Let's define the states in comments on the enum.

	/* Replay is not needed, so ignore this map */
	/* Replay is needed, queue the slots specified in rm_replay_slots */
	/* Replay was already queued */

> +void ocfs2_replay_map_set_state(struct ocfs2_super *osb, int state)
> +{
> +	if (!osb->replay_map)
> +		return;

	/* If we've already queued the replay, we don't have any more to do */
	if (osb->replay_map->rm_state == REPLAY_DONE)
		return;

> +	osb->replay_map->rm_state = state;
> +}
> +
> +int ocfs2_compute_replay_slots(struct ocfs2_super *osb)
> +{
> +	struct ocfs2_replay_map *replay_map;
> +	int i, node_num;
> +
> +	replay_map = osb->replay_map;
> +
> +	if (!replay_map)
> +		replay_map = kzalloc(sizeof(struct ocfs2_replay_map) +
> +				     (osb->max_slots * sizeof(char)),
> +				     GFP_KERNEL);

	We don't want to recompute the replay map.  If osb->replay_map
is set, just return out of this function, like you did in the previous
patch.

> +
> +	if (!replay_map) {
> +		mlog_errno(-ENOMEM);
> +		return -ENOMEM;
> +	}
> +
> +	spin_lock(&osb->osb_lock);
> +
> +	replay_map->rm_slots = osb->max_slots;
> +	replay_map->rm_state = REPLAY_UNNEEDED;
> +
> +	/* set rm_replay_slots for offline slot(s) */
> +	for (i = 0; i < replay_map->rm_slots; i++) {
> +		if (ocfs2_slot_to_node_num_locked(osb, i, &node_num) == -ENOENT)
> +			replay_map->rm_replay_slots[i] = 1;
> +	}
> +
> +	osb->replay_map = replay_map;
> +	spin_unlock(&osb->osb_lock);
> +	return 0;
> +}

	Otherwise, the rest looks good.

Joel

-- 

"What do you take me for, an idiot?"  
        - General Charles de Gaulle, when a journalist asked him
          if he was happy.

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127

  reply	other threads:[~2009-03-05 23:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-05  9:53 [Ocfs2-devel] [PATCH 1/1] Patch to recover orphans in offline slots during recovery and mount Srinivas Eeda
2009-03-05 23:28 ` Joel Becker [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-03-04  8:10 Srinivas Eeda
2009-03-04 19:49 ` Joel Becker

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=20090305232833.GA27682@mail.oracle.com \
    --to=joel.becker@oracle.com \
    --cc=ocfs2-devel@oss.oracle.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.