* [PATCH] sync_sb_inodes cleanup
@ 2005-05-10 15:00 Vladimir Saveliev
2005-05-10 15:35 ` Robert Love
0 siblings, 1 reply; 5+ messages in thread
From: Vladimir Saveliev @ 2005-05-10 15:00 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel@vger.kernel.org, reiserfs-dev@namesys.com
[-- 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);
}
/*
_
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] sync_sb_inodes cleanup
2005-05-10 15:00 [PATCH] sync_sb_inodes cleanup Vladimir Saveliev
@ 2005-05-10 15:35 ` Robert Love
2005-05-11 7:37 ` Vladimir Saveliev
0 siblings, 1 reply; 5+ messages in thread
From: Robert Love @ 2005-05-10 15:35 UTC (permalink / raw)
To: Vladimir Saveliev
Cc: Andrew Morton, linux-kernel@vger.kernel.org,
reiserfs-dev@namesys.com
On Tue, 2005-05-10 at 19:00 +0400, Vladimir Saveliev wrote:
> This patch makes generic_sync_sb_inodes to spin lock itself.
> Please, apply this patch. It helps reiser4 to get rid of some oddities.
>
> [snip]
>
> {
> const unsigned long start = jiffies; /* livelock avoidance */
>
> + spin_lock(&inode_lock);
Looking at what jiffies is used for, it is probably is not a big deal,
but you should move the assignment of start to after acquiring the lock,
as that could take quite some time.
Robert Love
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] sync_sb_inodes cleanup
2005-05-10 15:35 ` Robert Love
@ 2005-05-11 7:37 ` Vladimir Saveliev
2005-05-11 17:49 ` Robert Love
0 siblings, 1 reply; 5+ messages in thread
From: Vladimir Saveliev @ 2005-05-11 7:37 UTC (permalink / raw)
To: Robert Love
Cc: Andrew Morton, linux-kernel@vger.kernel.org,
reiserfs-dev@namesys.com
Hello
On Tue, 2005-05-10 at 19:35, Robert Love wrote:
> On Tue, 2005-05-10 at 19:00 +0400, Vladimir Saveliev wrote:
>
> > This patch makes generic_sync_sb_inodes to spin lock itself.
> > Please, apply this patch. It helps reiser4 to get rid of some oddities.
> >
> > [snip]
> >
> > {
> > const unsigned long start = jiffies; /* livelock avoidance */
> >
> > + spin_lock(&inode_lock);
>
> Looking at what jiffies is used for, it is probably is not a big deal,
> but you should move the assignment of start to after acquiring the lock,
> as that could take quite some time.
>
I did not want to un-const start. It would be required for the
assignment move, wouldn't it?
> Robert Love
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] sync_sb_inodes cleanup
2005-05-11 7:37 ` Vladimir Saveliev
@ 2005-05-11 17:49 ` Robert Love
2005-05-13 9:25 ` Vladimir Saveliev
0 siblings, 1 reply; 5+ messages in thread
From: Robert Love @ 2005-05-11 17:49 UTC (permalink / raw)
To: Vladimir Saveliev
Cc: Andrew Morton, linux-kernel@vger.kernel.org,
reiserfs-dev@namesys.com
On Wed, 2005-05-11 at 11:37 +0400, Vladimir Saveliev wrote:
> I did not want to un-const start. It would be required for the
> assignment move, wouldn't it?
Well, the const is just a programming convention. It is useful here,
but just a convention; removing it changes nothing behavior-wise. Your
patch, though, changes behavior.
How bad do you need to push the spin locks into the function?
Robert Love
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] sync_sb_inodes cleanup
2005-05-11 17:49 ` Robert Love
@ 2005-05-13 9:25 ` Vladimir Saveliev
0 siblings, 0 replies; 5+ messages in thread
From: Vladimir Saveliev @ 2005-05-13 9:25 UTC (permalink / raw)
To: Robert Love
Cc: Andrew Morton, linux-kernel@vger.kernel.org,
reiserfs-dev@namesys.com
Hello
On Wed, 2005-05-11 at 21:49, Robert Love wrote:
> On Wed, 2005-05-11 at 11:37 +0400, Vladimir Saveliev wrote:
>
> > I did not want to un-const start. It would be required for the
> > assignment move, wouldn't it?
>
> Well, the const is just a programming convention. It is useful here,
> but just a convention; removing it changes nothing behavior-wise. Your
> patch, though, changes behavior.
>
ok, I will move assignment.
> How bad do you need to push the spin locks into the function?
>
The reason is that reiser4 implements its own sync_inodes method of
struct super_operations. reiser4_sync_inodes first calls
generic_sync_sb_inodes and then calls reiser4' function to flush atoms
to disk. If generic_sync_sb_inodes would exit with inode_lock locked,
reiser4_sync_inodes would have to unlock inode_lock after
generic_sync_sb_inodes and lock it before exit. inode_lock is static for
fs/inode.c, so, we asked whether it would be possible to have
spinlocking in generic_sync_sb_inodes.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-05-13 9:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-10 15:00 [PATCH] sync_sb_inodes cleanup Vladimir Saveliev
2005-05-10 15:35 ` Robert Love
2005-05-11 7:37 ` Vladimir Saveliev
2005-05-11 17:49 ` Robert Love
2005-05-13 9:25 ` Vladimir Saveliev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox