Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1587862 > unrolled thread

[RFC][PATCH 04/10] fs: Restructure iput()

Started byPeter Zijlstra <peterz@infradead.org>
First post2017-02-24 19:50 +0100
Last post2017-02-24 19:50 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [RFC][PATCH 04/10] fs: Restructure iput() Peter Zijlstra <peterz@infradead.org> - 2017-02-24 19:50 +0100

#1587862 — [RFC][PATCH 04/10] fs: Restructure iput()

FromPeter Zijlstra <peterz@infradead.org>
Date2017-02-24 19:50 +0100
Subject[RFC][PATCH 04/10] fs: Restructure iput()
Message-ID<tet6h-4bt-13@gated-at.bofh.it>
Preparatory patch for elimination of iput_final().

No functional change.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 fs/inode.c |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1528,19 +1528,21 @@ void iput(struct inode *inode)
 {
 	if (!inode)
 		return;
+
 	BUG_ON(inode->i_state & I_CLEAR);
 retry:
-	if (atomic_dec_and_lock(&inode->i_count, &inode->i_lock)) {
-		if (inode->i_nlink && (inode->i_state & I_DIRTY_TIME)) {
-			atomic_inc(&inode->i_count);
-			inode->i_state &= ~I_DIRTY_TIME;
-			spin_unlock(&inode->i_lock);
-			trace_writeback_lazytime_iput(inode);
-			mark_inode_dirty_sync(inode);
-			goto retry;
-		}
-		iput_final(inode);
+	if (!atomic_dec_and_lock(&inode->i_count, &inode->i_lock))
+		return;
+
+	if (inode->i_nlink && (inode->i_state & I_DIRTY_TIME)) {
+		atomic_inc(&inode->i_count);
+		inode->i_state &= ~I_DIRTY_TIME;
+		spin_unlock(&inode->i_lock);
+		trace_writeback_lazytime_iput(inode);
+		mark_inode_dirty_sync(inode);
+		goto retry;
 	}
+	iput_final(inode);
 }
 EXPORT_SYMBOL(iput);
 

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web