Thread (15 messages) 15 messages, 3 authors, 2012-03-19

Re: [PATCH 3/4] writeback: Refactor writeback_single_inode()

From: Fengguang Wu <hidden>
Date: 2012-03-19 05:07:28
Also in: linux-fsdevel, lkml

On Fri, Mar 09, 2012 at 10:02:27AM +0100, Jan Kara wrote:
quoted hunk ↗ jump to hunk
The code in writeback_single_inode() is relatively complex. The list
requeing logic makes sense only for flusher thread but not really for
sync_inode() or write_inode_now() callers. Also when we want to get
rid of inode references held by flusher thread, we will need a special
I_SYNC handling there.

So separate part of writeback_single_inode() which does the real writeback work
into __writeback_single_inode(). Make writeback_single_inode() do only stuff
necessary for callers writing only one inode, and move the special list
handling into writeback_sb_inodes() and a helper function inode_wb_requeue().

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/fs-writeback.c                |  264 +++++++++++++++++++++-----------------
 include/trace/events/writeback.h |   36 ++++-
 2 files changed, 174 insertions(+), 126 deletions(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
+
+	ret = __writeback_single_inode(inode, wb, wbc);
+
+	spin_lock(&wb->list_lock);
+	spin_lock(&inode->i_lock);
+	if (inode->i_state & I_FREEING)
+		goto out_unlock;
+	if (inode->i_state & I_DIRTY)
+		redirty_tail(inode, wb);
+	else
+		list_del_init(&inode->i_wb_list);
It seems that the above redirty_tail() and hence I_FREEING check can
be eliminated? writeback_single_inode() does not need to deal with wb
list requeue now, but only need to care about dequeue.

The patch looks fine otherwise.
+out_unlock:
 	inode_sync_complete(inode);
-	trace_writeback_single_inode(inode, wbc, nr_to_write);
+	spin_unlock(&inode->i_lock);
+	spin_unlock(&wb->list_lock);
+
 	return ret;
 }
 
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help