linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yongqiang Yang <xiaoqiangnk@gmail.com>
To: Andreas Dilger <adilger@dilger.ca>
Cc: Robin Dong <hao.bigrat@gmail.com>,
	linux-ext4@vger.kernel.org, Robin Dong <sanbai@taobao.com>
Subject: Re: [PATCH 1/8 bigalloc] ext4: get blocks from ext4_ext_get_actual_len
Date: Thu, 3 Nov 2011 16:50:04 +0800	[thread overview]
Message-ID: <CAGBYx2bc-ZeP5Kk8mrokbWFTYp6T1N_68DhyWsUdqf=ReYhY0A@mail.gmail.com> (raw)
In-Reply-To: <3CF57267-8DFB-4AFE-94AA-48036AC80C19@dilger.ca>

On Thu, Nov 3, 2011 at 2:29 AM, Andreas Dilger <adilger@dilger.ca> wrote:
> On 2011-11-01, at 4:53 AM, Robin Dong wrote:
>> From: Robin Dong <sanbai@taobao.com>
>>
>> Since ee_len's unit change to cluster, it need to transform from clusters
>> to blocks when use ext4_ext_get_actual_len.
>
> Robin,
> thanks for working on and submitting these patches so quickly.
>
>> struct ext4_extent {
>>       __le32  ee_block;       /* first logical block extent covers */
>> -     __le16  ee_len;         /* number of blocks covered by extent */
>> +     __le16  ee_len;         /* number of clusters covered by extent */
>
> It would make sense that ee_block should also be changed to be measured
> in units of clusters instead of blocks, since there is no value to
> using extents with cluster size if they are not also cluster aligned.
>
> I think this would also simplify some of the code.
Actually, after these patches are applied, both logical block and
physical block are all cluster sized.  So I have a suggestion that we
can simply tell users that ext4 can use large size block rather than
cluster.

Yongqiang.

>
>> static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext)
>> {
>> +     struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
>
> Why allocate "*sbi" on the stack in all of these functions for a
> single use?  This provides no benefit, but can increase the stack
> usage considerably due to repeated allocations.
>
>>       ext4_fsblk_t block = ext4_ext_pblock(ext);
>> +     int len = EXT4_C2B(sbi, ext4_ext_get_actual_len(ext));
>
> It probably makes more sense to pass "sb" or "sbi" as a parameter to
> ext4_ext_get_actual_len() and then have it return the proper length
> in blocks (i.e. call EXT4_C2B() internally), which will simplify all
> of the callers and avoid potential bugs if some code does not use it.
>
>> @@ -1523,7 +1534,7 @@ ext4_can_extents_be_merged(struct inode *inode, struct ext4_extent *ex1,
>>       ext1_ee_len = ext4_ext_get_actual_len(ex1);
>>       ext2_ee_len = ext4_ext_get_actual_len(ex2);
>>
>> -     if (le32_to_cpu(ex1->ee_block) + ext1_ee_len !=
>> +     if (le32_to_cpu(ex1->ee_block) + EXT4_C2B(sbi, ext1_ee_len) !=
>>                       le32_to_cpu(ex2->ee_block))
>
> If both ee_len and ee_block are in the same units (blocks or clusters),
> then there is no need to convert units for this function at all.
>
>
> Cheers, Andreas
>
>
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Best Wishes
Yongqiang Yang
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-11-03  8:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-01 10:53 [PATCH 0/8 bigalloc] ext4: change unit of extent's ee_len from block to cluster Robin Dong
2011-11-01 10:53 ` [PATCH 1/8 bigalloc] ext4: get blocks from ext4_ext_get_actual_len Robin Dong
2011-11-02 18:29   ` Andreas Dilger
2011-11-03  8:50     ` Yongqiang Yang [this message]
2011-11-03 17:57       ` Andreas Dilger
2011-11-01 10:53 ` [PATCH 2/8 bigalloc] ext4: change ext4_ext_map_blocks to allocate clusters instead of blocks Robin Dong
2011-11-01 10:53 ` [PATCH 3/8 bigalloc] ext4: remove unused functions and tags Robin Dong
2011-11-01 10:53 ` [PATCH 4/8 bigalloc] ext4: zeroout extra pages when users write one page Robin Dong
2011-11-01 10:53 ` [PATCH 5/8 bigalloc] ext4: zero out extra pages when truncate file Robin Dong
2011-11-01 10:53 ` [PATCH 6/8 bigalloc] ext4: directories allocate a cluster when it need spaces Robin Dong
2011-11-01 10:53 ` [PATCH 7/8 bigalloc] ext4: align fallocate size to a whole cluster Robin Dong
2011-11-01 10:53 ` [PATCH 8/8 bigalloc] ext4: make cluster works for mmap Robin Dong

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='CAGBYx2bc-ZeP5Kk8mrokbWFTYp6T1N_68DhyWsUdqf=ReYhY0A@mail.gmail.com' \
    --to=xiaoqiangnk@gmail.com \
    --cc=adilger@dilger.ca \
    --cc=hao.bigrat@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sanbai@taobao.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).