Re: ext4: why init the unused block group at batched discard?

2 messages, 2 authors, 2011-07-07 · open the first message on its own page

Re: ext4: why init the unused block group at batched discard?

From: Amir Goldstein <amir73il@gmail.com>
Date: 2011-07-06 07:21:24

On Wed, Jul 6, 2011 at 9:09 AM, Kyungmin Park [off-list ref] wrote:
Hi Lukas,

During code review batched discard support at ext4. I wonder why do
you init the uninitialized block group during batched discard.
As you know uninitialized block group mean that there's no operation
at these blocks.
Hi Kyungmin,

EXT4_MB_GRP_NEED_INIT() is not the same as EXT4_BG_BLOCK_UNINIT.
The former means that no allocation/free was attempted from the block group
since mount time and the latter means that no allocation happened since mkfs.
So no need to trim it at all.
So I think it is possible that blocks deleted in previous mount time would
need to be trimmed in this mount time.

Am I right, Lukas?

Amir.
How do you think?

int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range)
{
       ...

       for (group = first_group; group <= last_group; group++) {
               grp = ext4_get_group_info(sb, group);
               /* We only do this if the grp has never been initialized */
               if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) {
                       ret = ext4_mb_init_group(sb, group);
                       if (ret)
                               break;
               }
       ...
       }
       ...
}

Thank you,
Kyungmin Park
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Re: ext4: why init the unused block group at batched discard?

From: Yongqiang Yang <hidden>
Date: 2011-07-07 01:47:29

On Wed, Jul 6, 2011 at 3:21 PM, Amir Goldstein [off-list ref] wrote:
On Wed, Jul 6, 2011 at 9:09 AM, Kyungmin Park [off-list ref] wrote:
quoted
Hi Lukas,

During code review batched discard support at ext4. I wonder why do
you init the uninitialized block group during batched discard.
As you know uninitialized block group mean that there's no operation
at these blocks.
Hi Kyungmin,

EXT4_MB_GRP_NEED_INIT() is not the same as EXT4_BG_BLOCK_UNINIT.
The former means that no allocation/free was attempted from the block group
since mount time and the latter means that no allocation happened since mkfs.
quoted
So no need to trim it at all.
So I think it is possible that blocks deleted in previous mount time would
need to be trimmed in this mount time.

Am I right, Lukas?
It seems that you both are right.

if EXT4_MB_GRP_NEED_INIT() retruns true, it means buddy allocator has
not been initialized, and ext4_mb_init_group() initializes the buddy
allocator for specified group.

Actually, ext4_mb_init_group() initializes UNINIT block bitmap to
generate buddy bitmaps.

Maybe in trim case, we should consider BLOCK_UNINIT as well.

Yongqiang.
Amir.
quoted
How do you think?

int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range)
{
       ...

       for (group = first_group; group <= last_group; group++) {
               grp = ext4_get_group_info(sb, group);
               /* We only do this if the grp has never been initialized */
               if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) {
                       ret = ext4_mb_init_group(sb, group);
                       if (ret)
                               break;
               }
       ...
       }
       ...
}

Thank you,
Kyungmin Park
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help