From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mm: Fix sparse warnings in backing-dev.h
Date: Fri, 23 Jun 2023 18:07:37 +0100 [thread overview]
Message-ID: <20230623170737.3965705-1-willy@infradead.org> (raw)
Sparse reports a context imbalance, and indeed _begin() returns
with the RCU lock held and _end() releases it. Reassure sparse that
this is fine by adding appropriate annotations.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/backing-dev.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index fbad4fcd408e..69bb13412a3e 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -284,8 +284,9 @@ static inline struct bdi_writeback *inode_to_wb_wbc(
* can't sleep during the transaction. IRQs may or may not be disabled on
* return.
*/
-static inline struct bdi_writeback *
-unlocked_inode_to_wb_begin(struct inode *inode, struct wb_lock_cookie *cookie)
+static inline
+struct bdi_writeback *unlocked_inode_to_wb_begin(struct inode *inode,
+ struct wb_lock_cookie *cookie) __acquires(RCU)
{
rcu_read_lock();
@@ -311,7 +312,7 @@ unlocked_inode_to_wb_begin(struct inode *inode, struct wb_lock_cookie *cookie)
* @cookie: @cookie from unlocked_inode_to_wb_begin()
*/
static inline void unlocked_inode_to_wb_end(struct inode *inode,
- struct wb_lock_cookie *cookie)
+ struct wb_lock_cookie *cookie) __releases(RCU)
{
if (unlikely(cookie->locked))
xa_unlock_irqrestore(&inode->i_mapping->i_pages, cookie->flags);
--
2.39.2
next reply other threads:[~2023-06-23 17:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-23 17:07 Matthew Wilcox (Oracle) [this message]
2023-06-23 17:36 ` [PATCH] mm: Fix sparse warnings in backing-dev.h Matthew Wilcox
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=20230623170737.3965705-1-willy@infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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).