linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* can subvolumes be specified as compressed?
@ 2010-07-29  7:50 Wang Shaoyan
  2010-07-29  8:21 ` Miao Xie
  0 siblings, 1 reply; 8+ messages in thread
From: Wang Shaoyan @ 2010-07-29  7:50 UTC (permalink / raw)
  To: linux-btrfs

Hi.
I want a subvolume in root to be compressed, I try to do this:
# mkfs.btrfs /dev/sda8
# mount /dev/sda8 /home/usr/btrfs
# cd /home/usr/btrfs
# btrfs subvolume create mysubvolume
# mount -o compress,subvol=mysubvolume /dev/sda8 some_dir_in_root
but when I create a file in some_dir_in_root, the file isn't
compressed at all. why? How can I specify some subvolumes to be
compressed, and the others Not to be compressed in a single btrfs?

--
Wang Shaoyan

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

* Re: can subvolumes be specified as compressed?
  2010-07-29  7:50 can subvolumes be specified as compressed? Wang Shaoyan
@ 2010-07-29  8:21 ` Miao Xie
  2010-07-29  8:55   ` Wang Shaoyan
  0 siblings, 1 reply; 8+ messages in thread
From: Miao Xie @ 2010-07-29  8:21 UTC (permalink / raw)
  To: Wang Shaoyan; +Cc: linux-btrfs

On Thu, 29 Jul 2010 15:50:28 +0800, Wang Shaoyan wrote:
> Hi.
> I want a subvolume in root to be compressed, I try to do this:
> # mkfs.btrfs /dev/sda8
> # mount /dev/sda8 /home/usr/btrfs
> # cd /home/usr/btrfs
> # btrfs subvolume create mysubvolume
> # mount -o compress,subvol=mysubvolume /dev/sda8 some_dir_in_root
> but when I create a file in some_dir_in_root, the file isn't
> compressed at all. why? How can I specify some subvolumes to be
> compressed, and the others Not to be compressed in a single btrfs?

The method that you said is right, by this way, I can create a compressed file
on the specified subvolume.

I think your file has been compressed or is hard to be compressed, so
you found it isn't compressed at all. Just like we use a zip tool to compress
a compressed file, we will find the file isn't compressed at all.

Thanks
Miao

>
> --
> Wang Shaoyan
> --
> 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] 8+ messages in thread

* Re: can subvolumes be specified as compressed?
  2010-07-29  8:21 ` Miao Xie
@ 2010-07-29  8:55   ` Wang Shaoyan
  2010-07-29 10:04     ` Miao Xie
  2010-07-30  1:29     ` Wang Shaoyan
  0 siblings, 2 replies; 8+ messages in thread
From: Wang Shaoyan @ 2010-07-29  8:55 UTC (permalink / raw)
  To: miaox, linux-btrfs

A prerequisite is: when first mounted file system, not specify '-o
compress' options, only on mount subvolume
Below is my test:
# mkfs.btrfs /dev/sda8
# mount /dev/sda8 btrfs
# df
    Used: 56k
# btrfs subvolume create mysubvolume
# mkdir some_dir_in_root
# mount -o compress,subvol=3Dmysubvolume /dev/sda8 some_dir_in_root
# cd some_dir_in_root
# dd if=3D/dev/zero of=3Dbigfile count=3D2048 //create a all-0 file of =
1M byte
# df
    Used:1088k
we can find it is not compressed at all.

Another test:if we mount subvolume with "-o compress" first, then we
mount /dev/sda8 without "-o compress", and create a test file in
somewhere not in subvolume, we can find the file is compressed too.

2010/7/29 Miao Xie <miaox@cn.fujitsu.com>:
> On Thu, 29 Jul 2010 15:50:28 +0800, Wang Shaoyan wrote:
>>
>> Hi.
>> I want a subvolume in root to be compressed, I try to do this:
>> # mkfs.btrfs /dev/sda8
>> # mount /dev/sda8 /home/usr/btrfs
>> # cd /home/usr/btrfs
>> # btrfs subvolume create mysubvolume
>> # mount -o compress,subvol=3Dmysubvolume /dev/sda8 some_dir_in_root
>> but when I create a file in some_dir_in_root, the file isn't
>> compressed at all. why? How can I specify some subvolumes to be
>> compressed, and the others Not to be compressed in a single btrfs?
>
> The method that you said is right, by this way, I can create a compre=
ssed
> file
> on the specified subvolume.
>
> I think your file has been compressed or is hard to be compressed, so
> you found it isn't compressed at all. Just like we use a zip tool to
> compress
> a compressed file, we will find the file isn't compressed at all.
>
> Thanks
> Miao
>
>>
>> --
>> Wang Shaoyan
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-btrf=
s" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at =A0http://vger.kernel.org/majordomo-info.html
>>
>>
>
>



--=20
Wang Shaoyan
--
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] 8+ messages in thread

* Re: can subvolumes be specified as compressed?
  2010-07-29  8:55   ` Wang Shaoyan
@ 2010-07-29 10:04     ` Miao Xie
  2010-07-30  1:29     ` Wang Shaoyan
  1 sibling, 0 replies; 8+ messages in thread
From: Miao Xie @ 2010-07-29 10:04 UTC (permalink / raw)
  To: Wang Shaoyan; +Cc: linux-btrfs

On Thu, 29 Jul 2010 16:55:03 +0800, Wang Shaoyan wrote:
> A prerequisite is: when first mounted file system, not specify '-o
> compress' options, only on mount subvolume
> Below is my test:
> # mkfs.btrfs /dev/sda8
> # mount /dev/sda8 btrfs
> # df
>      Used: 56k
> # btrfs subvolume create mysubvolume
> # mkdir some_dir_in_root
> # mount -o compress,subvol=mysubvolume /dev/sda8 some_dir_in_root
> # cd some_dir_in_root
> # dd if=/dev/zero of=bigfile count=2048 //create a all-0 file of 1M byte
> # df
>      Used:1088k
> we can find it is not compressed at all.
>
> Another test:if we mount subvolume with "-o compress" first, then we
> mount /dev/sda8 without "-o compress", and create a test file in
> somewhere not in subvolume, we can find the file is compressed too.

Sorry! I made a mistake.

According to the implement of the btrfs, after we mount a btrfs filesystem
(include subvol), if we mount the same filesystem again or its subvol, the
kernel doesn't allocate a new super_block object, and use the super_block
object that allocated and initiated at the first mount. So the feature is also
the same as the filesystem mounted first.

Thanks
Miao

>
> 2010/7/29 Miao Xie<miaox@cn.fujitsu.com>:
>> On Thu, 29 Jul 2010 15:50:28 +0800, Wang Shaoyan wrote:
>>>
>>> Hi.
>>> I want a subvolume in root to be compressed, I try to do this:
>>> # mkfs.btrfs /dev/sda8
>>> # mount /dev/sda8 /home/usr/btrfs
>>> # cd /home/usr/btrfs
>>> # btrfs subvolume create mysubvolume
>>> # mount -o compress,subvol=mysubvolume /dev/sda8 some_dir_in_root
>>> but when I create a file in some_dir_in_root, the file isn't
>>> compressed at all. why? How can I specify some subvolumes to be
>>> compressed, and the others Not to be compressed in a single btrfs?
>>
>> The method that you said is right, by this way, I can create a compressed
>> file
>> on the specified subvolume.
>>
>> I think your file has been compressed or is hard to be compressed, so
>> you found it isn't compressed at all. Just like we use a zip tool to
>> compress
>> a compressed file, we will find the file isn't compressed at all.
>>
>> Thanks
>> Miao
>>
>>>
>>> --
>>> Wang Shaoyan
>>> --
>>> 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] 8+ messages in thread

* Re: can subvolumes be specified as compressed?
  2010-07-29  8:55   ` Wang Shaoyan
  2010-07-29 10:04     ` Miao Xie
@ 2010-07-30  1:29     ` Wang Shaoyan
  2010-07-30  2:09       ` Chris Ball
  1 sibling, 1 reply; 8+ messages in thread
From: Wang Shaoyan @ 2010-07-30  1:29 UTC (permalink / raw)
  To: miaox, linux-btrfs

So, is there such a method: in a specified directory, the compression
feature is enabled, and the file in this directory will be compressed
automatically, while the others don't enable compression.

thanks.

2010/7/29 Wang Shaoyan <stufever@gmail.com>:
> A prerequisite is: when first mounted file system, not specify '-o
> compress' options, only on mount subvolume
> Below is my test:
> # mkfs.btrfs /dev/sda8
> # mount /dev/sda8 btrfs
> # df
> =A0 =A0Used: 56k
> # btrfs subvolume create mysubvolume
> # mkdir some_dir_in_root
> # mount -o compress,subvol=3Dmysubvolume /dev/sda8 some_dir_in_root
> # cd some_dir_in_root
> # dd if=3D/dev/zero of=3Dbigfile count=3D2048 //create a all-0 file o=
f 1M byte
> # df
> =A0 =A0Used:1088k
> we can find it is not compressed at all.
>
> Another test:if we mount subvolume with "-o compress" first, then we
> mount /dev/sda8 without "-o compress", and create a test file in
> somewhere not in subvolume, we can find the file is compressed too.
>
> 2010/7/29 Miao Xie <miaox@cn.fujitsu.com>:
>> On Thu, 29 Jul 2010 15:50:28 +0800, Wang Shaoyan wrote:
>>>
>>> Hi.
>>> I want a subvolume in root to be compressed, I try to do this:
>>> # mkfs.btrfs /dev/sda8
>>> # mount /dev/sda8 /home/usr/btrfs
>>> # cd /home/usr/btrfs
>>> # btrfs subvolume create mysubvolume
>>> # mount -o compress,subvol=3Dmysubvolume /dev/sda8 some_dir_in_root
>>> but when I create a file in some_dir_in_root, the file isn't
>>> compressed at all. why? How can I specify some subvolumes to be
>>> compressed, and the others Not to be compressed in a single btrfs?
>>
>> The method that you said is right, by this way, I can create a compr=
essed
>> file
>> on the specified subvolume.
>>
>> I think your file has been compressed or is hard to be compressed, s=
o
>> you found it isn't compressed at all. Just like we use a zip tool to
>> compress
>> a compressed file, we will find the file isn't compressed at all.
>>
>> Thanks
>> Miao
>>
>>>
>>> --
>>> Wang Shaoyan
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-btr=
fs" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at =A0http://vger.kernel.org/majordomo-info.htm=
l
>>>
>>>
>>
>>
>
>
>
> --
> Wang Shaoyan
>



--=20
Wang Shaoyan
--
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] 8+ messages in thread

* Re: can subvolumes be specified as compressed?
  2010-07-30  1:29     ` Wang Shaoyan
@ 2010-07-30  2:09       ` Chris Ball
  2010-07-30  3:21         ` Wang Shaoyan
  0 siblings, 1 reply; 8+ messages in thread
From: Chris Ball @ 2010-07-30  2:09 UTC (permalink / raw)
  To: Wang Shaoyan; +Cc: miaox, linux-btrfs

Hi,

   > So, is there such a method: in a specified directory, the
   > compression feature is enabled, and the file in this directory
   > will be compressed automatically, while the others don't enable
   > compression.

I don't think so, but it wouldn't be difficult -- you'd just set a
per-inode flag on whether to compress, and if it's set on a directory
then it's inherited by the files in that directory.

I think the hold up has been that we've waited for a *generic*
cross-filesystem flag to appear, and it hasn't (or it has and I didn't
notice).  Does anyone have suggestions on how to break the deadlock
there?

- Chris.
-- 
Chris Ball   <cjb@laptop.org>
One Laptop Per Child

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

* Re: can subvolumes be specified as compressed?
  2010-07-30  2:09       ` Chris Ball
@ 2010-07-30  3:21         ` Wang Shaoyan
  2010-07-30  3:50           ` Chris Ball
  0 siblings, 1 reply; 8+ messages in thread
From: Wang Shaoyan @ 2010-07-30  3:21 UTC (permalink / raw)
  To: Chris Ball; +Cc: miaox, linux-btrfs

I don't know whether this demand, which specified some subvolumes or
directories to be compressed, conflict with the design of btrfs's
compression feature, may be they want to do this thing well, and
everyone will enable the compression feature, rather than throw the
decision to user to determine which should compress.

But now, if we can mount a subvolume and specify some mount options,
we should make these options work, rather than ignore.

2010/7/30 Chris Ball <cjb@laptop.org>:
> Hi,
>
> =A0 > So, is there such a method: in a specified directory, the
> =A0 > compression feature is enabled, and the file in this directory
> =A0 > will be compressed automatically, while the others don't enable
> =A0 > compression.
>
> I don't think so, but it wouldn't be difficult -- you'd just set a
> per-inode flag on whether to compress, and if it's set on a directory
> then it's inherited by the files in that directory.
>
> I think the hold up has been that we've waited for a *generic*
> cross-filesystem flag to appear, and it hasn't (or it has and I didn'=
t
> notice). =A0Does anyone have suggestions on how to break the deadlock
> there?
>
> - Chris.
> --
> Chris Ball =A0 <cjb@laptop.org>
> One Laptop Per Child
>



--=20
Wang Shaoyan
--
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] 8+ messages in thread

* Re: can subvolumes be specified as compressed?
  2010-07-30  3:21         ` Wang Shaoyan
@ 2010-07-30  3:50           ` Chris Ball
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Ball @ 2010-07-30  3:50 UTC (permalink / raw)
  To: Wang Shaoyan; +Cc: miaox, linux-btrfs

Hi,

   > I don't know whether this demand, which specified some subvolumes
   > or directories to be compressed, conflict with the design of
   > btrfs's compression feature, may be they want to do this thing
   > well, and everyone will enable the compression feature, rather
   > than throw the decision to user to determine which should
   > compress.

You can't tell whether you can compress data well until you've already
spent CPU compressing it, though.  Right now we have a useful metric
of "if parts of the file fail to compress, bail out on compressing the
rest of the file, both now and in the future"; but it's only a metric.
There are cases this fails on, such as a tar archive that starts out
with JPEGs and continues with large (compressible) text files.

I think the argument that we don't need to offer user control because
we can just do a good job all the time only works if it's actually
true that we can do a good job all the time, and I don't think that's
true here.  So, I still support user control of the per-inode flag.

(I agree about the subvol flags; I think being able to set quotas and
compression per-subvol is on the roadmap and just not done yet.)

-- 
Chris Ball   <cjb@laptop.org>
One Laptop Per Child

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

end of thread, other threads:[~2010-07-30  3:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-29  7:50 can subvolumes be specified as compressed? Wang Shaoyan
2010-07-29  8:21 ` Miao Xie
2010-07-29  8:55   ` Wang Shaoyan
2010-07-29 10:04     ` Miao Xie
2010-07-30  1:29     ` Wang Shaoyan
2010-07-30  2:09       ` Chris Ball
2010-07-30  3:21         ` Wang Shaoyan
2010-07-30  3:50           ` Chris Ball

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