From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: fdmanana@kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 6/9] btrfs: add lockdep assertion to remaining delalloc callbacks
Date: Sat, 10 Feb 2024 18:18:19 +1030 [thread overview]
Message-ID: <a8a495e8-e3a9-4663-bedd-10369a1fc76f@gmx.com> (raw)
In-Reply-To: <3c6359337ba942d628b989cc7458cde4d9a5373a.1707491248.git.fdmanana@suse.com>
On 2024/2/10 04:30, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> The merge and split callbacks for an inode's io tree are supposed to be
> called while the io tree's spinlock is being held, so that the given
> extent_state records are stable, not modified or freed while the callbacks
> are using them. So add lockdep assertions in the callbacks.
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> fs/btrfs/inode.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 778bb6754e00..c7a5fb1f8b3e 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -2300,6 +2300,8 @@ void btrfs_split_delalloc_extent(struct btrfs_inode *inode,
> struct btrfs_fs_info *fs_info = inode->root->fs_info;
> u64 size;
>
> + lockdep_assert_held(&inode->io_tree.lock);
> +
> /* not delalloc, ignore it */
> if (!(orig->state & EXTENT_DELALLOC))
> return;
> @@ -2338,6 +2340,8 @@ void btrfs_merge_delalloc_extent(struct btrfs_inode *inode, struct extent_state
> u64 new_size, old_size;
> u32 num_extents;
>
> + lockdep_assert_held(&inode->io_tree.lock);
> +
> /* not delalloc, ignore it */
> if (!(other->state & EXTENT_DELALLOC))
> return;
next prev parent reply other threads:[~2024-02-10 7:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 18:00 [PATCH 0/9] btrfs: cleanups and minor performance change to setting/clearing delalloc fdmanana
2024-02-09 18:00 ` [PATCH 1/9] btrfs: stop passing root argument to btrfs_add_delalloc_inodes() fdmanana
2024-02-10 7:45 ` Qu Wenruo
2024-02-09 18:00 ` [PATCH 2/9] btrfs: stop passing root argument to __btrfs_del_delalloc_inode() fdmanana
2024-02-10 7:45 ` Qu Wenruo
2024-02-09 18:00 ` [PATCH 3/9] btrfs: assert root delalloc lock is held at __btrfs_del_delalloc_inode() fdmanana
2024-02-10 7:46 ` Qu Wenruo
2024-02-09 18:00 ` [PATCH 4/9] btrfs: rename btrfs_add_delalloc_inodes() to singular form fdmanana
2024-02-10 7:46 ` Qu Wenruo
2024-02-09 18:00 ` [PATCH 5/9] btrfs: reduce inode lock critical section when setting and clearing delalloc fdmanana
2024-02-09 18:00 ` [PATCH 6/9] btrfs: add lockdep assertion to remaining delalloc callbacks fdmanana
2024-02-10 7:48 ` Qu Wenruo [this message]
2024-02-09 18:00 ` [PATCH 7/9] btrfs: use assertion instead of BUG_ON when adding/removing to delalloc list fdmanana
2024-02-10 7:48 ` Qu Wenruo
2024-02-09 18:00 ` [PATCH 8/9] btrfs: remove do_list variable at btrfs_set_delalloc_extent() fdmanana
2024-02-10 7:49 ` Qu Wenruo
2024-02-09 18:00 ` [PATCH 9/9] btrfs: remove do_list variable at btrfs_clear_delalloc_extent() fdmanana
2024-02-10 7:49 ` Qu Wenruo
2024-02-09 21:54 ` [PATCH 0/9] btrfs: cleanups and minor performance change to setting/clearing delalloc Boris Burkov
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=a8a495e8-e3a9-4663-bedd-10369a1fc76f@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=fdmanana@kernel.org \
--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