From: Tao Ma <tao.ma@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 12/15] ocfs2: Some tiny bug fixes for discontiguous block allocation.
Date: Thu, 01 Apr 2010 12:32:29 +0800 [thread overview]
Message-ID: <4BB421DD.9090708@oracle.com> (raw)
In-Reply-To: <20100401033406.GI28680@mail.oracle.com>
Hi Joel,
Joel Becker wrote:
> On Thu, Apr 01, 2010 at 10:59:09AM +0800, Tao Ma wrote:
>> @@ -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.
no problem.
>
>> @@ -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.
Current we don't fail out in ocfs2_block_group_grow_discontig when we
used up all the extent record in the list. So actually our bitmap size
can be less than cpg. So you think we need to bail out?
I removed your
if (needed > 0) {
}
in this function. So maybe I am wrong? ;)
To bail out is simple, we just need to set the status to ENOSPC in this
case and it should be enough for us.
Regards,
Tao
next prev parent reply other threads:[~2010-04-01 4:32 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 [this message]
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=4BB421DD.9090708@oracle.com \
--to=tao.ma@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.