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 13/15] ocfs2: ocfs2_group_bitmap_size has to handle old volume.
Date: Thu, 1 Apr 2010 00:37:18 -0700	[thread overview]
Message-ID: <20100401073717.GA19666@mail.oracle.com> (raw)
In-Reply-To: <4BB41FA0.8070804@oracle.com>

On Thu, Apr 01, 2010 at 12:22:56PM +0800, Tao Ma wrote:
> Joel Becker wrote:
> >On Thu, Apr 01, 2010 at 10:59:10AM +0800, Tao Ma wrote:
> >>ocfs2_group_bitmap_size has to handle the case when the
> >>volume don't have discontiguous block group support.
> >
> >	NAK.  We specify 256 in all cases.  This doesn't hurt old code
> >because we've never used more bits.  Even though our old bg_size values
> >were much larger, we never used that space because bg_bits was set to
> >the smaller value.
> No, it hurts.
> So with an old ocfs2-tools and a new kernel, the new kernel will set
> it to 256 while the old ocfs2-tools refused to work by checking
> bg_size(see
> chainalloc_process_group in libocfs2).

*facepalm*

	Well, we shot ourselves in the foot.  The entire point of having
the size stored is so that we can vary it and the code still works.
Consider that "validation" of bg_size a bug.  The correct validation is
((bg_bits + 7) / 8) <= bg_size.
	So we do need the kernel to store the old-style bg_size in order
to keep compatibility.  But we can do better.  First, you don't need the
supports_discontig_bg argument.  You already have the superblock, just
check ocfs2_supports_discontig_bg(OCFS2_SB(sb)).
	Secondly, that function needs a big fat comment.

static inline int ocfs2_group_bitmap_size(struct super_block *sb,
					  int suballocator)
{
	int size = sb->s_blocksize -
		offsetof(struct ocfs2_group_desc, bg_bitmap);

	/*
	 * The cluster allocator uses the entire block.  Suballocators have
	 * never used more than OCFS2_MAX_BG_BITMAP_SIZE.  Unfortunately, older
	 * code expects bg_size set to the maximum.  Thus we must keep
	 * bg_size as-is unless discontig_bg is enabled.
	 */
	if (suballocator && ocfs2_supports_discontig_bg(OCFS2_SB(sb)))
		size = OCFS2_MAX_BG_BITMAP_SIZE;

	return size;
}

Joel

-- 

Life's Little Instruction Book #450

	"Don't be afraid to say, 'I need help.'"

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

  parent reply	other threads:[~2010-04-01  7:37 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-01  2:53 [Ocfs2-devel] [PATCH 0/15] ocfs2: Support for discontiguous block group Tao Ma
2010-04-01  2:58 ` [Ocfs2-devel] [PATCH 01/15] ocfs2: Define data structures for discontiguous block groups Tao Ma
2010-04-01  2:58 ` [Ocfs2-devel] [PATCH 02/15] ocfs2: Allocate " Tao Ma
2010-04-01  2:59 ` [Ocfs2-devel] [PATCH 03/15] ocfs2: Pass suballocation results back via a structure Tao Ma
2010-04-01  2:59 ` [Ocfs2-devel] [PATCH 04/15] ocfs2: Add suballoc_loc to metadata blocks Tao Ma
2010-04-01  2:59 ` [Ocfs2-devel] [PATCH 05/15] ocfs2: ocfs2_claim_suballoc_bits() doesn't need an osb argument Tao Ma
2010-04-01  2:59 ` [Ocfs2-devel] [PATCH 06/15] ocfs2: Trim suballocations if they cross discontiguous regions Tao Ma
2010-04-01  2:59 ` [Ocfs2-devel] [PATCH 07/15] ocfs2: ocfs2_claim_*() don't need an ocfs2_super argument Tao Ma
2010-04-01  2:59 ` [Ocfs2-devel] [PATCH 08/15] ocfs2: Return allocated metadata blknos on the ocfs2_suballoc_result Tao Ma
2010-04-01  2:59 ` [Ocfs2-devel] [PATCH 09/15] ocfs2: Set suballoc_loc on allocated metadata Tao Ma
2010-04-01  2:59 ` [Ocfs2-devel] [PATCH 10/15] ocfs2: Grow discontig block groups in one transaction Tao Ma
2010-04-01  2:59 ` [Ocfs2-devel] [PATCH 11/15] ocfs2: Don't relink cluster groups when allocating discontig block groups Tao Ma
2010-04-01  2:59 ` [Ocfs2-devel] [PATCH 12/15] ocfs2: Some tiny bug fixes for discontiguous block allocation Tao Ma
2010-04-01  3:34   ` Joel Becker
2010-04-01  4:32     ` Tao Ma
2010-04-01 17:44       ` Joel Becker
2010-04-01  2:59 ` [Ocfs2-devel] [PATCH 13/15] ocfs2: ocfs2_group_bitmap_size has to handle old volume Tao Ma
2010-04-01  3:38   ` Joel Becker
2010-04-01  4:22     ` Tao Ma
2010-04-01  4:34       ` Wengang Wang
2010-04-01  4:39         ` Tao Ma
2010-04-01  4:50           ` Tao Ma
2010-04-01  7:40             ` Joel Becker
2010-04-01  7:39           ` Joel Becker
2010-04-01  7:38         ` Joel Becker
2010-04-01  7:37       ` Joel Becker [this message]
2010-04-01  7:46         ` Tao Ma
2010-04-01 17:53           ` Joel Becker
2010-04-01 23:32             ` Tao Ma
2010-04-01 23:43               ` Joel Becker
2010-04-01  2:59 ` [Ocfs2-devel] [PATCH 14/15] ocfs2: Free block to the right block group Tao Ma
2010-04-01  3:42   ` Joel Becker
2010-04-01  2:59 ` [Ocfs2-devel] [PATCH 15/15] ocfs2: enable discontig block group support Tao Ma
2010-04-01  3:43   ` 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=20100401073717.GA19666@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.