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 12/15] ocfs2: Some tiny bug fixes for discontiguous block allocation.
Date: Wed, 31 Mar 2010 20:34:06 -0700	[thread overview]
Message-ID: <20100401033406.GI28680@mail.oracle.com> (raw)
In-Reply-To: <1270090752-18935-12-git-send-email-tao.ma@oracle.com>

On Thu, Apr 01, 2010 at 10:59:09AM +0800, Tao Ma wrote:
> -static inline int ocfs2_supports_discontig_bh(struct ocfs2_super *osb)
> +static inline int ocfs2_supports_discontig_bg(struct ocfs2_super *osb)

	D'oh!

> -	rec->e_blkno = p_blkno;
> +	rec->e_blkno = cpu_to_le64(p_blkno);

	D'oh!!

> +	le16_add_cpu(&bg->bg_free_bits_count,
> +		     clusters * le16_to_cpu(cl->cl_bpc));

	D'oh!!!
> @@ -511,8 +513,8 @@ static int ocfs2_block_group_grow_discontig(handle_t *handle,
>  	struct ocfs2_super *osb = OCFS2_SB(alloc_inode->i_sb);
>  	struct ocfs2_group_desc *bg =
>  		(struct ocfs2_group_desc *)bg_bh->b_data;
> -	unsigned int needed =
> -		ocfs2_bits_per_group(cl) - le16_to_cpu(bg->bg_bits);
> +	unsigned int needed = le16_to_cpu(cl->cl_cpg) -
> +			 le16_to_cpu(bg->bg_bits) / le16_to_cpu(cl->cl_bpc);

	Ouch!  But can you put parens around the divide?  Make the
intention clear.

> @@ -733,18 +734,20 @@ static int ocfs2_block_group_alloc(struct ocfs2_super *osb,
>  		goto bail;
>  	}
>  
> -	le32_add_cpu(&cl->cl_recs[bg->bg_chain].c_free,
> +	alloc_rec = le16_to_cpu(bg->bg_chain);
> +	le32_add_cpu(&cl->cl_recs[alloc_rec].c_free,
>  		     le16_to_cpu(bg->bg_free_bits_count));

	D'oh!!!!

> -	le32_add_cpu(&cl->cl_recs[bg->bg_chain].c_total,
> +	le32_add_cpu(&cl->cl_recs[alloc_rec].c_total,
>  		     le16_to_cpu(bg->bg_bits));
> -	cl->cl_recs[bg->bg_chain].c_blkno  = cpu_to_le64(bg_blkno);
> +	cl->cl_recs[alloc_rec].c_blkno  = cpu_to_le64(bg->bg_blkno);
>  	if (le16_to_cpu(cl->cl_next_free_rec) < le16_to_cpu(cl->cl_count))
>  		le16_add_cpu(&cl->cl_next_free_rec, 1);
>  
>  	le32_add_cpu(&fe->id1.bitmap1.i_used, le16_to_cpu(bg->bg_bits) -
>  					le16_to_cpu(bg->bg_free_bits_count));
>  	le32_add_cpu(&fe->id1.bitmap1.i_total, le16_to_cpu(bg->bg_bits));
> -	le32_add_cpu(&fe->i_clusters, le16_to_cpu(cl->cl_cpg));
> +	le32_add_cpu(&fe->i_clusters,
> +		     le16_to_cpu(bg->bg_bits) / le16_to_cpu(cl->cl_bpc));

	You don't need to change this.  Either we've allocated cpg or
we've failed out.

Joel

-- 

"There is shadow under this red rock.
 (Come in under the shadow of this red rock)
 And I will show you something different from either
 Your shadow at morning striding behind you
 Or your shadow at evening rising to meet you.
 I will show you fear in a handful of dust."

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

  reply	other threads:[~2010-04-01  3:34 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 [this message]
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
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=20100401033406.GI28680@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.