All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Saveliev <vs@namesys.com>
To: Andrew Morton <akpm@osdl.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"reiserfs-dev@namesys.com" <reiserfs-dev@namesys.com>
Subject: [PATCH] sync_sb_inodes cleanup
Date: Tue, 10 May 2005 19:00:39 +0400	[thread overview]
Message-ID: <1115737238.4456.320.camel@tribesman.namesys.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 268 bytes --]

Hello

sync_sb_inodes is called twice and both times like:
spin_lock(&inode_lock);
sync_sb_inodes(sb, wbc);
spin_unlock(&inode_lock);

This patch makes generic_sync_sb_inodes to spin lock itself.
Please, apply this patch. It helps reiser4 to get rid of some oddities.

[-- Attachment #2: sync_sb_inodes-cleanup.patch --]
[-- Type: text/plain, Size: 2133 bytes --]


sync_sb_inodes is always called like:
	spin_lock(&inode_lock);
	sync_sb_inodes(sb, wbc);
	spin_unlock(&inode_lock);
This patch moves spin_lock/spin_unlock down to sync_sb_inodes.


 fs/fs-writeback.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff -puN fs/fs-writeback.c~sync_sb_inodes-cleanup fs/fs-writeback.c
--- linux-2.6.12-rc3-mm3/fs/fs-writeback.c~sync_sb_inodes-cleanup	2005-05-10 18:41:30.822421511 +0400
+++ linux-2.6.12-rc3-mm3-vs/fs/fs-writeback.c	2005-05-10 18:45:07.907203826 +0400
@@ -283,8 +283,6 @@ __writeback_single_inode(struct inode *i
  * WB_SYNC_HOLD is a hack for sys_sync(): reattach the inode to sb->s_dirty so
  * that it can be located for waiting on in __writeback_single_inode().
  *
- * Called under inode_lock.
- *
  * If `bdi' is non-zero then we're being asked to writeback a specific queue.
  * This function assumes that the blockdev superblock's inodes are backed by
  * a variety of queues, so all inodes are searched.  For other superblocks,
@@ -305,6 +303,8 @@ generic_sync_sb_inodes(struct super_bloc
 {
 	const unsigned long start = jiffies;	/* livelock avoidance */
 
+	spin_lock(&inode_lock);
+
 	if (!wbc->for_kupdate || list_empty(&sb->s_io))
 		list_splice_init(&sb->s_dirty, &sb->s_io);
 
@@ -384,6 +384,7 @@ generic_sync_sb_inodes(struct super_bloc
 		if (wbc->nr_to_write <= 0)
 			break;
 	}
+	spin_unlock(&inode_lock);
 	return;		/* Leave any unwritten inodes on s_io */
 }
 EXPORT_SYMBOL(generic_sync_sb_inodes);
@@ -436,11 +437,8 @@ restart:
 			 * be unmounted by the time it is released.
 			 */
 			if (down_read_trylock(&sb->s_umount)) {
-				if (sb->s_root) {
-					spin_lock(&inode_lock);
+				if (sb->s_root)
 					sync_sb_inodes(sb, wbc);
-					spin_unlock(&inode_lock);
-				}
 				up_read(&sb->s_umount);
 			}
 			spin_lock(&sb_lock);
@@ -476,9 +474,7 @@ void sync_inodes_sb(struct super_block *
 			(inodes_stat.nr_inodes - inodes_stat.nr_unused) +
 			nr_dirty + nr_unstable;
 	wbc.nr_to_write += wbc.nr_to_write / 2;		/* Bit more for luck */
-	spin_lock(&inode_lock);
 	sync_sb_inodes(sb, &wbc);
-	spin_unlock(&inode_lock);
 }
 
 /*

_

             reply	other threads:[~2005-05-10 15:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-10 15:00 Vladimir Saveliev [this message]
2005-05-10 15:35 ` [PATCH] sync_sb_inodes cleanup Robert Love
2005-05-11  7:37   ` Vladimir Saveliev
2005-05-11 17:49     ` Robert Love
2005-05-13  9:25       ` Vladimir Saveliev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1115737238.4456.320.camel@tribesman.namesys.com \
    --to=vs@namesys.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reiserfs-dev@namesys.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.