From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 2/5] btrfs: Split btrfs_del_delalloc_inode into 2 functions
Date: Fri, 27 Apr 2018 12:21:51 +0300 [thread overview]
Message-ID: <1524820914-30864-3-git-send-email-nborisov@suse.com> (raw)
In-Reply-To: <1524820914-30864-1-git-send-email-nborisov@suse.com>
This is in preparation of fixing delalloc inodes leakage on transaction
abort. Also export the new function.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
fs/btrfs/ctree.h | 2 ++
fs/btrfs/inode.c | 15 ++++++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 5b7080d2fbff..27aa9b58b001 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3174,6 +3174,8 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
u64 *orig_start, u64 *orig_block_len,
u64 *ram_bytes);
+void __btrfs_del_delalloc_inode(struct btrfs_root *root,
+ struct btrfs_inode *inode);
struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry);
int btrfs_set_inode_index(struct btrfs_inode *dir, u64 *index);
int btrfs_unlink_inode(struct btrfs_trans_handle *trans,
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 078e02c21825..164950d96c8a 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1742,12 +1742,12 @@ static void btrfs_add_delalloc_inodes(struct btrfs_root *root,
spin_unlock(&root->delalloc_lock);
}
-static void btrfs_del_delalloc_inode(struct btrfs_root *root,
- struct btrfs_inode *inode)
+
+void __btrfs_del_delalloc_inode(struct btrfs_root *root,
+ struct btrfs_inode *inode)
{
struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
- spin_lock(&root->delalloc_lock);
if (!list_empty(&inode->delalloc_inodes)) {
list_del_init(&inode->delalloc_inodes);
clear_bit(BTRFS_INODE_IN_DELALLOC_LIST,
@@ -1760,6 +1760,15 @@ static void btrfs_del_delalloc_inode(struct btrfs_root *root,
spin_unlock(&fs_info->delalloc_root_lock);
}
}
+}
+
+
+static void btrfs_del_delalloc_inode(struct btrfs_root *root,
+ struct btrfs_inode *inode)
+{
+
+ spin_lock(&root->delalloc_lock);
+ __btrfs_del_delalloc_inode(root, inode);
spin_unlock(&root->delalloc_lock);
}
--
2.7.4
next prev parent reply other threads:[~2018-04-27 9:22 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-27 9:21 [PATCH 0/5] Fix delalloc inodes leaking on btrfs unmount Nikolay Borisov
2018-04-27 9:21 ` [PATCH 1/5] btrfs: Unexport btrfs_alloc_delalloc_work Nikolay Borisov
2018-04-27 9:21 ` Nikolay Borisov [this message]
2018-05-11 5:44 ` [PATCH 2/5] btrfs: Split btrfs_del_delalloc_inode into 2 functions Anand Jain
2018-05-11 8:39 ` Nikolay Borisov
2018-05-16 15:27 ` David Sterba
2018-04-27 9:21 ` [PATCH 3/5] btrfs: Add assert in __btrfs_del_delalloc_inode Nikolay Borisov
2018-04-27 9:21 ` [PATCH 4/5] btrfs: Fix delalloc inodes invalidation during transaction abort Nikolay Borisov
2018-05-10 15:35 ` David Sterba
2018-04-27 9:21 ` [PATCH 5/5] btrfs: Unexport and rename btrfs_invalidate_inodes Nikolay Borisov
2018-04-27 11:36 ` [PATCH v2] " Nikolay Borisov
2018-04-28 16:33 ` kbuild test robot
2018-04-28 16:44 ` kbuild test robot
2018-04-28 18:04 ` kbuild test robot
2018-05-11 5:38 ` Anand Jain
2018-05-01 14:02 ` [PATCH 0/5] Fix delalloc inodes leaking on btrfs unmount David Sterba
2018-05-16 15:36 ` David Sterba
2018-05-07 22:58 ` David Sterba
2018-05-08 5:16 ` Nikolay Borisov
2018-05-08 10:41 ` David Sterba
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=1524820914-30864-3-git-send-email-nborisov@suse.com \
--to=nborisov@suse.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).