All of lore.kernel.org
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: Alex Lyakas <alex.btrfs@zadarastorage.com>
Cc: Chris Mason <clm@fb.com>, linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v4 6/9] Btrfs: implement the free space B-tree
Date: Mon, 2 May 2016 14:55:01 -0700	[thread overview]
Message-ID: <20160502215501.GA24432@vader.DHCP.thefacebook.com> (raw)
In-Reply-To: <CAOcd+r2wCqcfbub6AKoDwyPB4XS7MDUuqeJOziw-g8vn+mM+gw@mail.gmail.com>

On Fri, Apr 22, 2016 at 11:28:24AM +0300, Alex Lyakas wrote:
> Hi Omar, Chris,
> 
> I have reviewed the free-space-tree code. It is a very nice feature.
> 
> However, I have a basic understanding question.
> 
> Let's say we are running a delayed ref which inserts a new EXTENT_ITEM
> into the extent tree, e.g., we are in alloc_reserved_file_extent. At
> this point we call remove_from_free_space_tree(), which updates the
> free-space-tree about the allocated space. But this requires to COW
> the free-space-tree itself. So we allocate a new tree block for the
> free-space tree, and insert a new delayed ref, which will update the
> extent tree about the new tree block allocation. We also insert a
> delayed ref to free the previous copy of the free-space-tree block.
> 
> At some point we run these new delayed refs, so we insert/remove
> EXTENT_ITEMs from the extent tree, and this in turn requires us to
> update the free-space-tree again. So we need again to COW
> free-space-tree blocks, generating more delayed refs.
> 
> At which point this recursion stops?
> 
> Do we assume that at some point all needed free-space tree blocks have
> been COW'ed already, and we do not COW a tree block more than once per
> transaction (unless it was written to disk due to memory pressure)?
> 
> Thanks!
> Alex.

Hi, Alex,

Your understanding is correct, we'll only COW a tree block once during a
transaction, so the recursion stops once all of the free space items we
need to add/remove don't require rebalancing the tree or allocating or
freeing a block. Same thing goes for extent items in the extent tree.
Since the extent tree and free space tree items are much smaller than a
tree block, this doesn't turn out to be a problem in practice.

Thanks for taking a look :)

-- 
Omar

  reply	other threads:[~2016-05-02 21:55 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30  3:50 [PATCH v4 0/9] Btrfs: free space B-tree Omar Sandoval
2015-09-30  3:50 ` [PATCH v4 1/9] Btrfs: add extent buffer bitmap operations Omar Sandoval
2015-09-30  3:50 ` [PATCH v4 2/9] Btrfs: add extent buffer bitmap sanity tests Omar Sandoval
2015-09-30  3:50 ` [PATCH v4 3/9] Btrfs: add helpers for read-only compat bits Omar Sandoval
2015-09-30  3:50 ` [PATCH v4 4/9] Btrfs: refactor caching_thread() Omar Sandoval
2015-09-30  3:50 ` [PATCH v4 5/9] Btrfs: introduce the free space B-tree on-disk format Omar Sandoval
2015-09-30  3:50 ` [PATCH v4 6/9] Btrfs: implement the free space B-tree Omar Sandoval
2015-09-30  4:35   ` kbuild test robot
2015-09-30  4:35   ` [PATCH] Btrfs: fix simple_return.cocci warnings kbuild test robot
2015-10-01 12:54   ` [PATCH v4 6/9] Btrfs: implement the free space B-tree David Sterba
2015-10-02 14:23   ` kbuild test robot
2015-12-29 20:19   ` Chris Mason
2016-04-22  8:28     ` Alex Lyakas
2016-05-02 21:55       ` Omar Sandoval [this message]
2015-09-30  3:50 ` [PATCH v4 7/9] Btrfs: add free space tree sanity tests Omar Sandoval
2015-10-01 13:04   ` David Sterba
2023-10-11  2:12   ` Jinjie Ruan
2023-10-11 10:20     ` David Sterba
2015-09-30  3:50 ` [PATCH v4 8/9] Btrfs: wire up the free space tree to the extent tree Omar Sandoval
2015-09-30  3:50 ` [PATCH v4 9/9] Btrfs: add free space tree mount option Omar Sandoval
2015-09-30  3:51 ` [PATCH v4 1/2] btrfs-progs: add basic awareness of the free space tree Omar Sandoval
2015-09-30  3:51   ` [PATCH v4 2/2] btrfs-progs: check the free space tree in btrfsck Omar Sandoval
2015-09-30  8:31 ` [PATCH v4 0/9] Btrfs: free space B-tree Omar Sandoval
2015-10-02 11:47 ` Austin S Hemmelgarn
2015-11-03 18:13   ` Tobias Holst
2015-11-03 18:34     ` Chris Mason
2015-11-03 18:59       ` Tobias Holst

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=20160502215501.GA24432@vader.DHCP.thefacebook.com \
    --to=osandov@osandov.com \
    --cc=alex.btrfs@zadarastorage.com \
    --cc=clm@fb.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 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.