Skip to contentSkip to conversation

fs: Use common code in wait_on_new_inode()

PATCH New Markus Elfring 1 participant 1 message Oct 10

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: Use common code in wait_on_new_inode()

From: Markus Elfring <[email protected]>
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.

---
 fs/inode.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
fs/inode.c +3 -4
index 702f2d5ef459..f4699866a73b 100644
@@ -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);
Signature · 1 line
2.56.0