linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* enquiry about defrag
@ 2012-09-09  0:03 ching
  2012-09-09  0:30 ` Jan Steffens
  2012-09-11 11:12 ` ching
  0 siblings, 2 replies; 14+ messages in thread
From: ching @ 2012-09-09  0:03 UTC (permalink / raw)
  To: linux-btrfs

Hi all,

i am new on btrfs, i am testing KVM on btrfs (host: kernel x86-64 3.5.3), the performance is reasonable.

I have two question on defrag, can someone help me?

1. According to btrfs wiki, defragment a COW file will produce two unrelated files.

    Does it apply to the "autodefrag" mount option?

2. Is there any command for the fragmentation status of a file/dir ? e.g. fragment size, number of fragments.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: enquiry about defrag
  2012-09-09  0:03 enquiry about defrag ching
@ 2012-09-09  0:30 ` Jan Steffens
  2012-09-09  7:49   ` ching
  2012-09-10  9:23   ` Alex Lyakas
  2012-09-11 11:12 ` ching
  1 sibling, 2 replies; 14+ messages in thread
From: Jan Steffens @ 2012-09-09  0:30 UTC (permalink / raw)
  To: ching; +Cc: linux-btrfs

On Sun, Sep 9, 2012 at 2:03 AM, ching <lsching17@gmail.com> wrote:
> 2. Is there any command for the fragmentation status of a file/dir ? e.g. fragment size, number of fragments.

Use the "filefrag" command, part of e2fsprogs.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: enquiry about defrag
  2012-09-09  0:30 ` Jan Steffens
@ 2012-09-09  7:49   ` ching
  2012-09-09  9:11     ` Fajar A. Nugraha
  2012-09-10  9:23   ` Alex Lyakas
  1 sibling, 1 reply; 14+ messages in thread
From: ching @ 2012-09-09  7:49 UTC (permalink / raw)
  To: Jan Steffens; +Cc: linux-btrfs

On 09/09/2012 08:30 AM, Jan Steffens wrote:
> On Sun, Sep 9, 2012 at 2:03 AM, ching <lsching17@gmail.com> wrote:
>> 2. Is there any command for the fragmentation status of a file/dir ? e.g. fragment size, number of fragments.
> Use the "filefrag" command, part of e2fsprogs.
>

my image is a 16G sparse file, after defragment, it still has 101387 extents, is it normal?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: enquiry about defrag
  2012-09-09  7:49   ` ching
@ 2012-09-09  9:11     ` Fajar A. Nugraha
  2012-09-09 12:05       ` ching
  0 siblings, 1 reply; 14+ messages in thread
From: Fajar A. Nugraha @ 2012-09-09  9:11 UTC (permalink / raw)
  To: ching; +Cc: linux-btrfs

On Sun, Sep 9, 2012 at 2:49 PM, ching <lsching17@gmail.com> wrote:
> On 09/09/2012 08:30 AM, Jan Steffens wrote:
>> On Sun, Sep 9, 2012 at 2:03 AM, ching <lsching17@gmail.com> wrote:
>>> 2. Is there any command for the fragmentation status of a file/dir ? e.g. fragment size, number of fragments.
>> Use the "filefrag" command, part of e2fsprogs.
>>
>
> my image is a 16G sparse file, after defragment, it still has 101387 extents, is it normal?

Is compression enabled? If so, yes, it's normal.

-- 
Fajar

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: enquiry about defrag
  2012-09-09  9:11     ` Fajar A. Nugraha
@ 2012-09-09 12:05       ` ching
  2012-09-10 12:19         ` ching
  0 siblings, 1 reply; 14+ messages in thread
From: ching @ 2012-09-09 12:05 UTC (permalink / raw)
  To: Fajar A. Nugraha; +Cc: linux-btrfs

On 09/09/2012 05:11 PM, Fajar A. Nugraha wrote:
> On Sun, Sep 9, 2012 at 2:49 PM, ching <lsching17@gmail.com> wrote:
>> On 09/09/2012 08:30 AM, Jan Steffens wrote:
>>> On Sun, Sep 9, 2012 at 2:03 AM, ching <lsching17@gmail.com> wrote:
>>>> 2. Is there any command for the fragmentation status of a file/dir ? e.g. fragment size, number of fragments.
>>> Use the "filefrag" command, part of e2fsprogs.
>>>
>> my image is a 16G sparse file, after defragment, it still has 101387 extents, is it normal?
> Is compression enabled? If so, yes, it's normal.
>

compression with lzo.

thanks. i will retry with compression disabled when 3.6 is stable.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: enquiry about defrag
  2012-09-09  0:30 ` Jan Steffens
  2012-09-09  7:49   ` ching
@ 2012-09-10  9:23   ` Alex Lyakas
  1 sibling, 0 replies; 14+ messages in thread
From: Alex Lyakas @ 2012-09-10  9:23 UTC (permalink / raw)
  To: lsching17, jan.steffens; +Cc: linux-btrfs

Hi,

You need to compile the latest version of filefrag, it has some fixes
by Liu Bo wrt to that. However, even then, filefrag may not report the
correct the extent count for btrfs. According to filefrag_fiemap(), it
tries to check whether physical extents are consecutive on disk and
then considers them as a single extent. For btrfs this may not always
be true, because logically the extents might not be consecutive, even
though they are consecutive on disk. xfstest 281 fails for me because
of this. (filefrag -v, however, seems to show BTRFS extents
correctly).
For me the best way is to check the output of btrfs-debug-tree.

Alex.




On Sun, Sep 9, 2012 at 3:30 AM, Jan Steffens <jan.steffens@gmail.com> wrote:
> On Sun, Sep 9, 2012 at 2:03 AM, ching <lsching17@gmail.com> wrote:
>> 2. Is there any command for the fragmentation status of a file/dir ? e.g. fragment size, number of fragments.
>
> Use the "filefrag" command, part of e2fsprogs.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: enquiry about defrag
  2012-09-09 12:05       ` ching
@ 2012-09-10 12:19         ` ching
  2012-09-10 13:10           ` Liu Bo
  0 siblings, 1 reply; 14+ messages in thread
From: ching @ 2012-09-10 12:19 UTC (permalink / raw)
  To: Fajar A. Nugraha; +Cc: linux-btrfs

On 09/09/2012 08:05 PM, ching wrote:
> On 09/09/2012 05:11 PM, Fajar A. Nugraha wrote:
>> On Sun, Sep 9, 2012 at 2:49 PM, ching <lsching17@gmail.com> wrote:
>>> On 09/09/2012 08:30 AM, Jan Steffens wrote:
>>>> On Sun, Sep 9, 2012 at 2:03 AM, ching <lsching17@gmail.com> wrote:
>>>>> 2. Is there any command for the fragmentation status of a file/dir ? e.g. fragment size, number of fragments.
>>>> Use the "filefrag" command, part of e2fsprogs.
>>>>
>>> my image is a 16G sparse file, after defragment, it still has 101387 extents, is it normal?
>> Is compression enabled? If so, yes, it's normal.
>>
> compression with lzo.
>
> thanks. i will retry with compression disabled when 3.6 is stable.

i just realize that it is possible to control compression per file by file attribute

http://radudi.com/index.php/2011/08/31/using-btrfs-per-file-and-per-directory-compression/

when i try to follow example above, no file attribute is shown (my mount option is rw,noatime,compress-force=lzo,space_cache,inode_cache)

$lsattr -V Linux.raw_image
lsattr 1.42.5 (29-Jul-2012)
---------------- Linux.raw_image

is there any official resource/web page for control compression per file by file attribute?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: enquiry about defrag
  2012-09-10 12:19         ` ching
@ 2012-09-10 13:10           ` Liu Bo
  2012-09-10 23:21             ` ching
  0 siblings, 1 reply; 14+ messages in thread
From: Liu Bo @ 2012-09-10 13:10 UTC (permalink / raw)
  To: ching; +Cc: Fajar A. Nugraha, linux-btrfs

On 09/10/2012 08:19 PM, ching wrote:
> On 09/09/2012 08:05 PM, ching wrote:
>> On 09/09/2012 05:11 PM, Fajar A. Nugraha wrote:
>>> On Sun, Sep 9, 2012 at 2:49 PM, ching <lsching17@gmail.com> wrote:
>>>> On 09/09/2012 08:30 AM, Jan Steffens wrote:
>>>>> On Sun, Sep 9, 2012 at 2:03 AM, ching <lsching17@gmail.com> wrote:
>>>>>> 2. Is there any command for the fragmentation status of a file/dir ? e.g. fragment size, number of fragments.
>>>>> Use the "filefrag" command, part of e2fsprogs.
>>>>>
>>>> my image is a 16G sparse file, after defragment, it still has 101387 extents, is it normal?
>>> Is compression enabled? If so, yes, it's normal.
>>>
>> compression with lzo.
>>
>> thanks. i will retry with compression disabled when 3.6 is stable.
> 
> i just realize that it is possible to control compression per file by file attribute
> 
> http://radudi.com/index.php/2011/08/31/using-btrfs-per-file-and-per-directory-compression/
> 
> when i try to follow example above, no file attribute is shown (my mount option is rw,noatime,compress-force=lzo,space_cache,inode_cache)
> 
> $lsattr -V Linux.raw_image
> lsattr 1.42.5 (29-Jul-2012)
> ---------------- Linux.raw_image
> 
> is there any official resource/web page for control compression per file by file attribute?
> 

FYI, git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: enquiry about defrag
  2012-09-10 13:10           ` Liu Bo
@ 2012-09-10 23:21             ` ching
  2012-09-11  1:28               ` Li Zefan
  0 siblings, 1 reply; 14+ messages in thread
From: ching @ 2012-09-10 23:21 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-btrfs

On 09/10/2012 09:10 PM, Liu Bo wrote:
> On 09/10/2012 08:19 PM, ching wrote:
>> On 09/09/2012 08:05 PM, ching wrote:
>>> On 09/09/2012 05:11 PM, Fajar A. Nugraha wrote:
>>>> On Sun, Sep 9, 2012 at 2:49 PM, ching <lsching17@gmail.com> wrote:
>>>>> On 09/09/2012 08:30 AM, Jan Steffens wrote:
>>>>>> On Sun, Sep 9, 2012 at 2:03 AM, ching <lsching17@gmail.com> wrote:
>>>>>>> 2. Is there any command for the fragmentation status of a file/dir ? e.g. fragment size, number of fragments.
>>>>>> Use the "filefrag" command, part of e2fsprogs.
>>>>>>
>>>>> my image is a 16G sparse file, after defragment, it still has 101387 extents, is it normal?
>>>> Is compression enabled? If so, yes, it's normal.
>>>>
>>> compression with lzo.
>>>
>>> thanks. i will retry with compression disabled when 3.6 is stable.
>> i just realize that it is possible to control compression per file by file attribute
>>
>> http://radudi.com/index.php/2011/08/31/using-btrfs-per-file-and-per-directory-compression/
>>
>> when i try to follow example above, no file attribute is shown (my mount option is rw,noatime,compress-force=lzo,space_cache,inode_cache)
>>
>> $lsattr -V Linux.raw_image
>> lsattr 1.42.5 (29-Jul-2012)
>> ---------------- Linux.raw_image
>>
>> is there any official resource/web page for control compression per file by file attribute?
>>
> FYI, git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>

may i ask a stupid question, if i remove my "compress-force=lzo" option, will compression disabled for new written data?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: enquiry about defrag
  2012-09-10 23:21             ` ching
@ 2012-09-11  1:28               ` Li Zefan
  2012-09-11 11:12                 ` ching
  0 siblings, 1 reply; 14+ messages in thread
From: Li Zefan @ 2012-09-11  1:28 UTC (permalink / raw)
  To: ching; +Cc: Liu Bo, linux-btrfs

> may i ask a stupid question, if i remove my "compress-force=lzo" option, will compression disabled for new written data?

the answer is yes. :)


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: enquiry about defrag
  2012-09-11  1:28               ` Li Zefan
@ 2012-09-11 11:12                 ` ching
  0 siblings, 0 replies; 14+ messages in thread
From: ching @ 2012-09-11 11:12 UTC (permalink / raw)
  To: Li Zefan; +Cc: Liu Bo, linux-btrfs

On 09/11/2012 09:28 AM, Li Zefan wrote:
>> may i ask a stupid question, if i remove my "compress-force=lzo" option, will compression disabled for new written data?
> the answer is yes. :)
>
>

The problem seems fixed. The number of extent decrease to 14055 after defrag with compression off.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: enquiry about defrag
  2012-09-09  0:03 enquiry about defrag ching
  2012-09-09  0:30 ` Jan Steffens
@ 2012-09-11 11:12 ` ching
  2012-09-11 11:45   ` David Sterba
  1 sibling, 1 reply; 14+ messages in thread
From: ching @ 2012-09-11 11:12 UTC (permalink / raw)
  To: linux-btrfs

On 09/09/2012 08:03 AM, ching wrote:
> Hi all,
>
> i am new on btrfs, i am testing KVM on btrfs (host: kernel x86-64 3.5.3), the performance is reasonable.
>
> I have two question on defrag, can someone help me?
>
> 1. According to btrfs wiki, defragment a COW file will produce two unrelated files.
>
>     Does it apply to the "autodefrag" mount option?
>
> 2. Is there any command for the fragmentation status of a file/dir ? e.g. fragment size, number of fragments.

can anybody helps on question 1?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: enquiry about defrag
  2012-09-11 11:12 ` ching
@ 2012-09-11 11:45   ` David Sterba
  2012-09-11 23:33     ` ching
  0 siblings, 1 reply; 14+ messages in thread
From: David Sterba @ 2012-09-11 11:45 UTC (permalink / raw)
  To: ching; +Cc: linux-btrfs

On Tue, Sep 11, 2012 at 07:12:58PM +0800, ching wrote:
> > 1. According to btrfs wiki, defragment a COW file will produce two unrelated files.
> >
> >     Does it apply to the "autodefrag" mount option?
> 
> can anybody helps on question 1?

The data blocks associated with the files (that were originally created
by snapshotting and thus shared the same blocks) will become unshared,
so yes it would appear like two unlreated files.

Autodefrag option affects only newly written data. With current
implementation it could unshare some extents if the defragged range
picked by autodefrag logic overlaps with an existing one.

>From my experience, running 'btrfs fi defrag' with autodefrag on
produced better result. Beware that there are some unfixed deadlocks
that may happen with autodefrag enabled.

david

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: enquiry about defrag
  2012-09-11 11:45   ` David Sterba
@ 2012-09-11 23:33     ` ching
  0 siblings, 0 replies; 14+ messages in thread
From: ching @ 2012-09-11 23:33 UTC (permalink / raw)
  To: linux-btrfs

On 09/11/2012 07:45 PM, David Sterba wrote:
> On Tue, Sep 11, 2012 at 07:12:58PM +0800, ching wrote:
>>> 1. According to btrfs wiki, defragment a COW file will produce two unrelated files.
>>>
>>>     Does it apply to the "autodefrag" mount option?
>> can anybody helps on question 1?
> The data blocks associated with the files (that were originally created
> by snapshotting and thus shared the same blocks) will become unshared,
> so yes it would appear like two unlreated files.
>
> Autodefrag option affects only newly written data. With current
> implementation it could unshare some extents if the defragged range
> picked by autodefrag logic overlaps with an existing one.
>
> >From my experience, running 'btrfs fi defrag' with autodefrag on
> produced better result. Beware that there are some unfixed deadlocks
> that may happen with autodefrag enabled.
>
> david
>

thanks for your help very much :)

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-09-11 23:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-09  0:03 enquiry about defrag ching
2012-09-09  0:30 ` Jan Steffens
2012-09-09  7:49   ` ching
2012-09-09  9:11     ` Fajar A. Nugraha
2012-09-09 12:05       ` ching
2012-09-10 12:19         ` ching
2012-09-10 13:10           ` Liu Bo
2012-09-10 23:21             ` ching
2012-09-11  1:28               ` Li Zefan
2012-09-11 11:12                 ` ching
2012-09-10  9:23   ` Alex Lyakas
2012-09-11 11:12 ` ching
2012-09-11 11:45   ` David Sterba
2012-09-11 23:33     ` ching

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).