* [PATCH] mm: Fix sparse warnings in backing-dev.h
@ 2023-06-23 17:07 Matthew Wilcox (Oracle)
2023-06-23 17:36 ` Matthew Wilcox
0 siblings, 1 reply; 2+ messages in thread
From: Matthew Wilcox (Oracle) @ 2023-06-23 17:07 UTC (permalink / raw)
To: Andrew Morton; +Cc: Matthew Wilcox (Oracle), linux-mm, linux-kernel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-23 17:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-23 17:07 [PATCH] mm: Fix sparse warnings in backing-dev.h Matthew Wilcox (Oracle)
2023-06-23 17:36 ` Matthew Wilcox
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).