[PATCH] fs: Use common code in wait_on_new_inode()
From: Markus Elfring
Date: Sat Oct 10 2026 - 14:10:49 EST
From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 10 Oct 2026 20:00:18 +0200
Use an additional label so that a statement can be better reused
at the end of this function implementation.
Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
fs/inode.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/inode.c b/fs/inode.c
index 702f2d5ef459..f4699866a73b 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -529,10 +529,8 @@ void wait_on_new_inode(struct inode *inode)
struct wait_queue_head *wq_head;
spin_lock(&inode->i_lock);
- if (!(inode_state_read(inode) & I_NEW)) {
- spin_unlock(&inode->i_lock);
- return;
- }
+ if (!(inode_state_read(inode) & I_NEW))
+ goto unlock;
wq_head = inode_bit_waitqueue(&wqe, inode, __I_NEW);
for (;;) {
@@ -545,6 +543,7 @@ void wait_on_new_inode(struct inode *inode)
}
finish_wait(wq_head, &wqe.wq_entry);
WARN_ON(inode_state_read(inode) & I_NEW);
+unlock:
spin_unlock(&inode->i_lock);
}
EXPORT_SYMBOL(wait_on_new_inode);
--
2.56.0