From: robbieko <robbieko@synology.com>
To: linux-btrfs@vger.kernel.org
Cc: Robbie Ko <robbieko@synology.com>
Subject: [PATCH] Btrfs: improve unnecessary free space inode update when space_cache=v1 has never been used
Date: Mon, 25 Mar 2019 17:06:38 +0800 [thread overview]
Message-ID: <1553504798-8116-1-git-send-email-robbieko@synology.com> (raw)
From: Robbie Ko <robbieko@synology.com>
When we have never used space_cache=v1, we don't need to update
the free space inode, and try to free up the space occupied by the
free space inode.
Signed-off-by: Robbie Ko <robbieko@synology.com>
---
fs/btrfs/extent-tree.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 1d49694..d3bba07 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3403,6 +3403,13 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group,
if (trans->aborted)
return 0;
+
+ if (btrfs_super_cache_generation(fs_info->super_copy) == (u64)-1 &&
+ !btrfs_test_opt(fs_info, SPACE_CACHE)) {
+ dcs = BTRFS_DC_WRITTEN;
+ goto out;
+ }
+
again:
inode = lookup_free_space_inode(fs_info, block_group, path);
if (IS_ERR(inode) && PTR_ERR(inode) != -ENOENT) {
--
1.9.1
next reply other threads:[~2019-03-25 9:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-25 9:06 robbieko [this message]
2019-03-25 9:35 ` [PATCH] Btrfs: improve unnecessary free space inode update when space_cache=v1 has never been used Nikolay Borisov
2019-03-25 9:52 ` robbieko
2019-03-25 11:18 ` Nikolay Borisov
2019-03-26 1:59 ` robbieko
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=1553504798-8116-1-git-send-email-robbieko@synology.com \
--to=robbieko@synology.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