From: Josef Bacik <josef@redhat.com>
To: linux-btrfs@vger.kernel.org
Subject: Re: Disk space accounting and subvolume delete
Date: Mon, 10 May 2010 14:50:31 -0400 [thread overview]
Message-ID: <20100510185031.GA2453@localhost.localdomain> (raw)
In-Reply-To: <20100510182352.GA21154@untroubled.org>
On Mon, May 10, 2010 at 12:23:52PM -0600, Bruce Guenter wrote:
> Hi.
>
> When deleting a snapshot, I have observed that the disk space used by
> that snapshot is not immediately released (according to statvfs or df).
> Neither "sync" nor "btrfs filesystem sync" releases the disk space
> neither. The only way I have found to actually fully release the disk
> space is to issue the sync and then sleep until the statvfs free numbers
> stop changing.
>
> This is a rather problematic approach to managing disk space. Is there
> any way to either force a wait until the disk space has been released?
>
> My application is automatically managing disk space in the presence of
> snapshots. I allow the disk (a backup) to fill up with snapshots until
> it is nearly full, and then to delete snapshots until I have a threshold
> free. However, without the disk space being released promptly and no
> way to wait until it is released, the loop can't tell how many snapshots
> to delete.
>
The way BTRFS's COW works is that we can't free up space until after a
transaction has committed. After the transaction commits (after a sync) we walk
the list of pinned extents and free them asynchronously. We could probably make
btrfs filesystem sync wait for that part to finish tho. It shouldn't be too
hard to do, feel free to take a crack at it. Thanks,
Josef
next prev parent reply other threads:[~2010-05-10 18:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-10 18:23 Disk space accounting and subvolume delete Bruce Guenter
2010-05-10 18:50 ` Josef Bacik [this message]
2010-05-11 0:10 ` Yan, Zheng
2010-05-11 15:45 ` Bruce Guenter
2010-05-12 5:02 ` Yan, Zheng
2010-05-12 21:56 ` Mike Fleetwood
2010-05-31 19:01 ` Bruce Guenter
2010-05-31 20:34 ` Mike Fedyk
2010-06-01 2:32 ` Yan, Zheng
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=20100510185031.GA2453@localhost.localdomain \
--to=josef@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
/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 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).