[Ocfs2-tools-devel] [PATCH 4/4] Defrag the filesystem

Goldwyn Rodrigues rgoldwyn at gmail.com
Tue Mar 23 07:00:50 PDT 2010


Hi Joel,

Thanks for your ideas.

On Mon, Mar 22, 2010 at 11:05 PM, Joel Becker <Joel.Becker at oracle.com> wrote:
> On Mon, Mar 22, 2010 at 08:55:02PM -0700, Joel Becker wrote:
>> 1. Making files more contiguous.  This means taking files of many small
>>    extents and making them consist of fewer, larger extents.  This is
>>    good for performance.
>> 2. Making the whole disk more contiguous.  This means packing file data
>>    to one end of the disk so that free space is in large hunks.  This is
>>    good for future allocation of unfragmented files.
>
>        This is offline defrag.  You can think really big here.  Imagine
> this scheme:
>
> Pass 3a: Pack all data to the end of the disk.  Don't care how badly it
>         packs, because you're just doing this temporarily.  Now the
>         entire front of the disk is empty except for block groups.
> Pass 3b: Move data back to the front of the disk to create almost
>         completely contiguous files.  Do it in ascending inode order so
>         the earliest data extents correspond to the earliest inodes.
>
> Something like that might satisfy both type 1 and type 2 defrag.
>

Yes, That is in my plan. However, the terminology is different.
Instead of type 1 and type 2, I call it file (internal) and
filesystem(external) defragmentation.
However, my plan was a little different. To start with, I intend to
switch pass 1 and pass 2. Pass 1 would now include defraging files and
directories. Defraging files would mean reducing the depth of the
extent tree. This way Pass 2 (freeing unused inode groups and extent
groups) can get more groups to free. I should be able to play around
with the pass sequence until it is finally accepted. :)

I was looking for ideas for defraging a file with minimum moves. I
posted on the list with no response. I think I will have to resort to
copying the file. If I resort to copying, I will incorporate that with
directories as well, compacting the dirents as we copy. So, no more
sliding window ;)

One of my goals is to keep the number of moves to the minimum.

-- 
Goldwyn



More information about the Ocfs2-tools-devel mailing list