Re: [RFC PATCH v2] Btrfs: improve space count for files with fragments

2012-05-09 Thread David Sterba
On Fri, Apr 27, 2012 at 09:44:13AM +0800, Liu Bo wrote: Let's take the above case: 0k 20k | --- extent --- | | - A - | 1k 19k And we assume that this extent starts from disk_bytenr on its FS logical offset. By splitting the [0k, 20k) extent, we'll get three

Re: [RFC PATCH v2] Btrfs: improve space count for files with fragments

2012-05-09 Thread Liu Bo
On 05/10/2012 01:29 AM, David Sterba wrote: On Fri, Apr 27, 2012 at 09:44:13AM +0800, Liu Bo wrote: Let's take the above case: 0k 20k | --- extent --- | | - A - | 1k 19k And we assume that this extent starts from disk_bytenr on its FS logical offset. By

[RFC PATCH v2] Btrfs: improve space count for files with fragments

2012-04-26 Thread Liu Bo
Here is a simple scenario: $ dd if=/dev/zero of=/mnt/btrfs/foobar bs=1k count=20;sync $ btrfs fi df /mnt/btrfs we get 20K used, but then $ dd if=/dev/zero of=/mnt/btrfs/foobar bs=1k count=4 seek=4 conv=notrunc;sync $ btrfs fi df /mnt/btrfs we get 24K used. Here is the problem, it is possible

Re: [RFC PATCH v2] Btrfs: improve space count for files with fragments

2012-04-26 Thread Chris Mason
On Thu, Apr 26, 2012 at 02:39:23PM +0800, Liu Bo wrote: Here is a simple scenario: $ dd if=/dev/zero of=/mnt/btrfs/foobar bs=1k count=20;sync $ btrfs fi df /mnt/btrfs we get 20K used, but then $ dd if=/dev/zero of=/mnt/btrfs/foobar bs=1k count=4 seek=4 conv=notrunc;sync $ btrfs fi df

Re: [RFC PATCH v2] Btrfs: improve space count for files with fragments

2012-04-26 Thread Liu Bo
On 04/27/2012 01:14 AM, Chris Mason wrote: On Thu, Apr 26, 2012 at 02:39:23PM +0800, Liu Bo wrote: Here is a simple scenario: $ dd if=/dev/zero of=/mnt/btrfs/foobar bs=1k count=20;sync $ btrfs fi df /mnt/btrfs we get 20K used, but then $ dd if=/dev/zero of=/mnt/btrfs/foobar bs=1k