From: Niels Dossche <dossche.niels@gmail.com>
To: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
Niels Dossche <dossche.niels@gmail.com>,
Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: [PATCH] btrfs: add lockdep_assert_held to need_preemptive_reclaim
Date: Mon, 28 Feb 2022 23:52:16 +0100 [thread overview]
Message-ID: <20220228225215.16552-1-dossche.niels@gmail.com> (raw)
In a previous patch I extended the locking for member accesses of
space_info. It was then suggested to also add a lockdep assertion for
space_info->lock to need_preemptive_reclaim.
Suggested-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
---
fs/btrfs/space-info.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
index 294242c194d8..5464bd168d5b 100644
--- a/fs/btrfs/space-info.c
+++ b/fs/btrfs/space-info.c
@@ -734,9 +734,13 @@ static bool need_preemptive_reclaim(struct btrfs_fs_info *fs_info,
{
u64 global_rsv_size = fs_info->global_block_rsv.reserved;
u64 ordered, delalloc;
- u64 thresh = div_factor_fine(space_info->total_bytes, 90);
+ u64 thresh;
u64 used;
+ lockdep_assert_held(&space_info->lock);
+
+ thresh = div_factor_fine(space_info->total_bytes, 90);
+
/* If we're just plain full then async reclaim just slows us down. */
if ((space_info->bytes_used + space_info->bytes_reserved +
global_rsv_size) >= thresh)
--
2.35.1
next reply other threads:[~2022-02-28 22:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-28 22:52 Niels Dossche [this message]
2022-03-02 19:30 ` [PATCH] btrfs: add lockdep_assert_held to need_preemptive_reclaim David Sterba
2022-03-03 0:25 ` Niels Dossche
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=20220228225215.16552-1-dossche.niels@gmail.com \
--to=dossche.niels@gmail.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=johannes.thumshirn@wdc.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@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