From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
To: Alex Lyakas <alex.btrfs@zadarastorage.com>
Cc: Anand Jain <Anand.Jain@oracle.com>,
Wang Shilong <wangshilong1991@gmail.com>,
"dsterba@suse.cz Sterba" <dsterba@suse.cz>,
"linux-btrfs@vger.kernel.org FILE SYSTEM list:BTRFS"
<linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v2] btrfs-progs: calculate disk space that a subvol could free
Date: Fri, 29 Nov 2013 09:34:55 +0800 [thread overview]
Message-ID: <5297EF3F.4030400@cn.fujitsu.com> (raw)
In-Reply-To: <CAOcd+r2OJAf1MfHeB46K7bbhPTwWiM6SKCpRVojFbY18SBWEKg@mail.gmail.com>
Hi Alex,
On 11/29/2013 01:39 AM, Alex Lyakas wrote:
> Hello Anand,
> I have sent a similar comment to your email thread in
> http://www.spinics.net/lists/linux-btrfs/msg27547.html
>
> I believe this approach of calculating freeable space is incorrect.
> Try this:
> - create a fresh btrfs
> - create a regular file
> - write some data into it in such a way, that it was, say 4000
> EXTENT_DATA items, so that file tree and extent tree get deep enough
> - run btrfs-debug-tree and verify that all EXTENT_ITEMs of this file
> (in the extent tree) have refcnt=1
> - create a snapshot of the subvolume
> - run btrfs-debug-tree again
>
> You will see that most (in my case - all) of EXTENT_ITEMs still have
> refcnt=1. Reason for this is as I mentioned in
> http://www.spinics.net/lists/linux-btrfs/msg27547.html
>
> But if you delete the subvolume, no space will be freed, because all
> these extents are also shared by the snapshot. Although it seems that
> your tool will report that all subvolume's space is freeable (based on
> refcnt=1).
>
> Can you pls try that experiment and comment on it? Perhaps I am
> missing something here?
I think you are right here, the only way we can make sure whether
a extent_item is shared by many roots is to walk backref to find
all roots, and if number of roots is 1, we know it's sole space.
If so, i don't think this should be implemented in user space, Btrfs quota
implement such function in kernel space, but it also face a problem that
deleting a subvolume will break space accounting(because subvolume deletion
won't iterate the whole fs tree).
Thanks,
Wang
>
> Thanks!
> Alex.
>
>
>
> On Thu, Oct 10, 2013 at 6:33 AM, Wang Shilong
> <wangsl.fnst@cn.fujitsu.com> wrote:
>> On 10/10/2013 11:35 AM, Anand Jain wrote:
>>>
>>> If 'btrfs_file_extent_item' can contain the ref count it would
>>> solve the current problem quite easily. (problem is that, its
>>> of n * n searches to know data extents with its ref for a given
>>> subvol).
>> Just considering btrfs_file_extent_item is not enough, because
>> we should consider metadata(as i have said before).
>>
>>> But what'r the challenge(s) to have ref count in the
>>> btrfs_file_extent_item ? any thoughts ?
>> Haven't thought a better idea yet.
>>
>>
>>> Thanks, Anand
>>> --
>>> 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
>>>
>> --
>> 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
> --
> 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
>
next prev parent reply other threads:[~2013-11-29 1:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-27 16:45 [PATCH] btrfs-progs: calculate disk space that a subvol could free Anand Jain
2013-09-27 19:10 ` Zach Brown
2013-09-28 17:19 ` Anand Jain
2013-09-29 15:02 ` Anand Jain
2013-10-01 13:25 ` David Sterba
2013-09-29 15:15 ` [PATCH V2] btrfs-progs: device add should check existing FS before adding Anand Jain
2013-09-29 15:26 ` Anand Jain
2013-09-29 15:25 ` [PATCH v2] btrfs-progs: calculate disk space that a subvol could free Anand Jain
2013-10-01 13:39 ` David Sterba
2013-10-01 14:05 ` Wang Shilong
2013-10-07 2:47 ` Anand Jain
2013-10-07 3:01 ` Wang Shilong
2013-10-07 3:22 ` Anand Jain
2013-10-08 16:49 ` David Sterba
2013-10-09 14:17 ` Wang Shilong
2013-10-10 3:35 ` Anand Jain
2013-10-10 3:33 ` Wang Shilong
2013-11-28 17:39 ` Alex Lyakas
2013-11-29 1:34 ` Wang Shilong [this message]
2013-11-29 1:57 ` Anand Jain
2013-10-09 8:03 ` Anand Jain
2013-10-09 8:35 ` Wang Shilong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5297EF3F.4030400@cn.fujitsu.com \
--to=wangsl.fnst@cn.fujitsu.com \
--cc=Anand.Jain@oracle.com \
--cc=alex.btrfs@zadarastorage.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=wangshilong1991@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.