linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 00/19] periodic write-back timer optimization
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
@ 2009-05-27 12:23 ` Arnd Bergmann
  2009-05-27 12:27   ` Artem Bityutskiy
  2009-05-27 13:05 ` [PATCH 01/19] VFS: introduce helpers for manipulation s_dirty flag Artem Bityutskiy
                   ` (18 subsequent siblings)
  19 siblings, 1 reply; 28+ messages in thread
From: Arnd Bergmann @ 2009-05-27 12:23 UTC (permalink / raw)
  To: Artem Bityutskiy
  Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Jens Axboe

On Wednesday 27 May 2009, Artem Bityutskiy wrote:
> Hi,
> 
> This is the second attempt. The first one was here:
> http://marc.info/?l=linux-fsdevel&m=124301072305588&w=2
> It was very hacky and got no comments.

How does this relate to the per-BDI writeback patches that
Jens is working on? Doesn't that require a completely different
(probably simpler) implementation of your patch?

	Arnd <><

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 00/19] periodic write-back timer optimization
  2009-05-27 12:23 ` Arnd Bergmann
@ 2009-05-27 12:27   ` Artem Bityutskiy
  2009-05-27 12:33     ` Jens Axboe
  0 siblings, 1 reply; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 12:27 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Jens Axboe

ext Arnd Bergmann wrote:
> On Wednesday 27 May 2009, Artem Bityutskiy wrote:
>> Hi,
>>
>> This is the second attempt. The first one was here:
>> http://marc.info/?l=linux-fsdevel&m=124301072305588&w=2
>> It was very hacky and got no comments.
> 
> How does this relate to the per-BDI writeback patches that
> Jens is working on? Doesn't that require a completely different
> (probably simpler) implementation of your patch?

At a quick glance, our works do not intersect. He seems
to be changing the guts of write-back, while I only touch
the timer which wakes up the periodic write-back thread,
nothing else. I'll try to take Jens' patches and see.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 00/19] periodic write-back timer optimization
  2009-05-27 12:27   ` Artem Bityutskiy
@ 2009-05-27 12:33     ` Jens Axboe
  2009-05-27 12:37       ` Artem Bityutskiy
  0 siblings, 1 reply; 28+ messages in thread
From: Jens Axboe @ 2009-05-27 12:33 UTC (permalink / raw)
  To: Artem Bityutskiy
  Cc: Arnd Bergmann, linux-kernel, linux-fsdevel, Christoph Hellwig

On Wed, May 27 2009, Artem Bityutskiy wrote:
> ext Arnd Bergmann wrote:
>> On Wednesday 27 May 2009, Artem Bityutskiy wrote:
>>> Hi,
>>>
>>> This is the second attempt. The first one was here:
>>> http://marc.info/?l=linux-fsdevel&m=124301072305588&w=2
>>> It was very hacky and got no comments.
>>
>> How does this relate to the per-BDI writeback patches that
>> Jens is working on? Doesn't that require a completely different
>> (probably simpler) implementation of your patch?
>
> At a quick glance, our works do not intersect. He seems
> to be changing the guts of write-back, while I only touch
> the timer which wakes up the periodic write-back thread,
> nothing else. I'll try to take Jens' patches and see.

There's definitely overlap! The timer is gone with my patches and so is
pdflush. For an idle (idle here meaning no background writeback
activity) system, there should just be bdi-default running. And that
will wake up every dirty_writeback_interval by default.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 00/19] periodic write-back timer optimization
  2009-05-27 12:33     ` Jens Axboe
@ 2009-05-27 12:37       ` Artem Bityutskiy
  2009-05-27 12:47         ` Jens Axboe
  0 siblings, 1 reply; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 12:37 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Arnd Bergmann, linux-kernel, linux-fsdevel, Christoph Hellwig

Jens Axboe wrote:
> On Wed, May 27 2009, Artem Bityutskiy wrote:
>> ext Arnd Bergmann wrote:
>>> On Wednesday 27 May 2009, Artem Bityutskiy wrote:
>>>> Hi,
>>>>
>>>> This is the second attempt. The first one was here:
>>>> http://marc.info/?l=linux-fsdevel&m=124301072305588&w=2
>>>> It was very hacky and got no comments.
>>> How does this relate to the per-BDI writeback patches that
>>> Jens is working on? Doesn't that require a completely different
>>> (probably simpler) implementation of your patch?
>> At a quick glance, our works do not intersect. He seems
>> to be changing the guts of write-back, while I only touch
>> the timer which wakes up the periodic write-back thread,
>> nothing else. I'll try to take Jens' patches and see.
> 
> There's definitely overlap! The timer is gone with my patches and so is
> pdflush. For an idle (idle here meaning no background writeback
> activity) system, there should just be bdi-default running. And that
> will wake up every dirty_writeback_interval by default.

Hmm, right. Will be working on top of your patches then.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 00/19] periodic write-back timer optimization
  2009-05-27 12:37       ` Artem Bityutskiy
@ 2009-05-27 12:47         ` Jens Axboe
  2009-05-28  6:34           ` Artem Bityutskiy
  0 siblings, 1 reply; 28+ messages in thread
From: Jens Axboe @ 2009-05-27 12:47 UTC (permalink / raw)
  To: Artem Bityutskiy
  Cc: Arnd Bergmann, linux-kernel, linux-fsdevel, Christoph Hellwig

On Wed, May 27 2009, Artem Bityutskiy wrote:
> Jens Axboe wrote:
>> On Wed, May 27 2009, Artem Bityutskiy wrote:
>>> ext Arnd Bergmann wrote:
>>>> On Wednesday 27 May 2009, Artem Bityutskiy wrote:
>>>>> Hi,
>>>>>
>>>>> This is the second attempt. The first one was here:
>>>>> http://marc.info/?l=linux-fsdevel&m=124301072305588&w=2
>>>>> It was very hacky and got no comments.
>>>> How does this relate to the per-BDI writeback patches that
>>>> Jens is working on? Doesn't that require a completely different
>>>> (probably simpler) implementation of your patch?
>>> At a quick glance, our works do not intersect. He seems
>>> to be changing the guts of write-back, while I only touch
>>> the timer which wakes up the periodic write-back thread,
>>> nothing else. I'll try to take Jens' patches and see.
>>
>> There's definitely overlap! The timer is gone with my patches and so is
>> pdflush. For an idle (idle here meaning no background writeback
>> activity) system, there should just be bdi-default running. And that
>> will wake up every dirty_writeback_interval by default.
>
> Hmm, right. Will be working on top of your patches then.

That would be great, I would have no problem integrating such a feature.
It definitely makes sense.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 00/19] periodic write-back timer optimization
@ 2009-05-27 13:05 Artem Bityutskiy
  2009-05-27 12:23 ` Arnd Bergmann
                   ` (19 more replies)
  0 siblings, 20 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

Hi,

This is the second attempt. The first one was here:
http://marc.info/?l=linux-fsdevel&m=124301072305588&w=2
It was very hacky and got no comments.

Here is a cleaner set of patches. They attempt to optimize
the periodic write-back and stop it when there are no
dirty data. At the moment "pdflush" thread wakes up every
5 seconds (by default). Even if there are no dirty data,
it still wakes up. In the embedded world this means that
power consumption is higher, because the pdflush makes
the CPU to leave low power consumption/retention mode
every 5 seconds.

The patch set consists of 2 parts. Patches 01-17 are rather
mechanical. They simply introduce 3 VFS helpers which
encapsulate the 'sb->s_dirt' handling, so file-systems do
not manipulate it directly, but rather use VFS helpers
for this.

Patch 18 is just a simple preparation for patch 19.

Patch 19 introduces a global 'periodic_wb_enabled' flag.
Then it adds few code to the 'mark_sb_dirty()' and the
'__mark_inode_dirty(); function. This code enables the
periodic write-back if it is disabled. I tried to make
this additional code light-weight.

The periodic WB function, in turn, checks whether there
is dirt. If there is, it sets the 'wb_timer' for itself.
Otherwise, it just deletes the timer. Should something
become dirty, it will be woken up again.

This is still RFC.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 01/19] VFS: introduce helpers for manipulation s_dirty flag
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
  2009-05-27 12:23 ` Arnd Bergmann
@ 2009-05-27 13:05 ` Artem Bityutskiy
  2009-05-27 13:05 ` [PATCH 02/19] AFFS: do not manipulate s_dirt directly Artem Bityutskiy
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] VFS: introduce helpers for manipulation s_dirty flag

This patch introduces 3 new VFS helpers: 'mark_sb_dirty()',
'mark_sb_clean()', and 'sb_is_dirty()'. The helpers simply
set 'sb->s_dirt' or test 'sb->s_dirt'. The plan is to make
every FS use these helpers instead of manipulating
'sb->s_dirt' directly. And the further plan is to stop the
periodic write-back when there is no dirt.

This patch is just a preparation. No functional changes yet.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 include/linux/fs.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 73242c3..437939c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1782,6 +1782,19 @@ extern int get_sb_pseudo(struct file_system_type *, char *,
 extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
 int __put_super_and_need_restart(struct super_block *sb);
 
+static inline void mark_sb_dirty(struct super_block *sb)
+{
+	sb->s_dirt = 1;
+}
+static inline void mark_sb_clean(struct super_block *sb)
+{
+	sb->s_dirt = 0;
+}
+static inline int sb_is_dirty(struct super_block *sb)
+{
+	return sb->s_dirt;
+}
+
 /* Alas, no aliases. Too much hassle with bringing module.h everywhere */
 #define fops_get(fops) \
 	(((fops) && try_module_get((fops)->owner) ? (fops) : NULL))
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 02/19] AFFS: do not manipulate s_dirt directly
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
  2009-05-27 12:23 ` Arnd Bergmann
  2009-05-27 13:05 ` [PATCH 01/19] VFS: introduce helpers for manipulation s_dirty flag Artem Bityutskiy
@ 2009-05-27 13:05 ` Artem Bityutskiy
  2009-05-27 13:05 ` [PATCH 03/19] BFS: " Artem Bityutskiy
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] AFFS: do not manipulate s_dirt directly

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/affs/bitmap.c |    4 ++--
 fs/affs/super.c  |   11 +++++++----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/fs/affs/bitmap.c b/fs/affs/bitmap.c
index dc5ef14..0be510c 100644
--- a/fs/affs/bitmap.c
+++ b/fs/affs/bitmap.c
@@ -102,7 +102,7 @@ affs_free_block(struct super_block *sb, u32 block)
 	*(__be32 *)bh->b_data = cpu_to_be32(tmp - mask);
 
 	mark_buffer_dirty(bh);
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	bm->bm_free++;
 
 	mutex_unlock(&sbi->s_bmlock);
@@ -247,7 +247,7 @@ find_bit:
 	*(__be32 *)bh->b_data = cpu_to_be32(tmp + mask);
 
 	mark_buffer_dirty(bh);
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 
 	mutex_unlock(&sbi->s_bmlock);
 
diff --git a/fs/affs/super.c b/fs/affs/super.c
index 280d361..fab17aa 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -64,9 +64,12 @@ affs_write_super(struct super_block *sb)
 				  &AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->disk_change);
 		affs_fix_checksum(sb, sbi->s_root_bh);
 		mark_buffer_dirty(sbi->s_root_bh);
-		sb->s_dirt = !clean;	/* redo until bitmap synced */
+		if (clean)
+			mark_sb_clean(sb);
+		else
+			mark_sb_dirty(sb);
 	} else
-		sb->s_dirt = 0;
+		mark_sb_clean(sb);
 	unlock_super(sb);
 
 	pr_debug("AFFS: write_super() at %lu, clean=%d\n", get_seconds(), clean);
@@ -522,8 +525,8 @@ affs_remount(struct super_block *sb, int *flags, char *data)
 	if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
 		return 0;
 	if (*flags & MS_RDONLY) {
-		sb->s_dirt = 1;
-		while (sb->s_dirt)
+		mark_sb_dirty(sb);
+		while (sb_is_dirty(sb))
 			affs_write_super(sb);
 		affs_free_bitmap(sb);
 	} else
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 03/19] BFS: do not manipulate s_dirt directly
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (2 preceding siblings ...)
  2009-05-27 13:05 ` [PATCH 02/19] AFFS: do not manipulate s_dirt directly Artem Bityutskiy
@ 2009-05-27 13:05 ` Artem Bityutskiy
  2009-05-27 13:05 ` [PATCH 04/19] EXOFS: " Artem Bityutskiy
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] BFS: do not manipulate s_dirt directly

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/bfs/inode.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 3a9a136..7ab0792 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -219,7 +219,7 @@ static void bfs_put_super(struct super_block *s)
 
 	lock_kernel();
 
-	if (s->s_dirt)
+	if (sb_is_dirty(s))
 		bfs_write_super(s);
 
 	brelse(info->si_sbh);
@@ -255,7 +255,7 @@ static void bfs_write_super(struct super_block *s)
 	mutex_lock(&info->bfs_lock);
 	if (!(s->s_flags & MS_RDONLY))
 		mark_buffer_dirty(info->si_sbh);
-	s->s_dirt = 0;
+	mark_sb_clean(s);
 	mutex_unlock(&info->bfs_lock);
 }
 
@@ -464,7 +464,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
 	brelse(bh);
 	if (!(s->s_flags & MS_RDONLY)) {
 		mark_buffer_dirty(info->si_sbh);
-		s->s_dirt = 1;
+		mark_sb_dirty(s);
 	} 
 	dump_imap("read_super", s);
 	mutex_init(&info->bfs_lock);
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 04/19] EXOFS: do not manipulate s_dirt directly
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (3 preceding siblings ...)
  2009-05-27 13:05 ` [PATCH 03/19] BFS: " Artem Bityutskiy
@ 2009-05-27 13:05 ` Artem Bityutskiy
  2009-05-27 13:05 ` [PATCH 05/19] EXT2: " Artem Bityutskiy
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] EXOFS: do not manipulate s_dirt directly

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/exofs/inode.c |    2 +-
 fs/exofs/super.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index ba8d9fa..80d3d03 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -1066,7 +1066,7 @@ struct inode *exofs_new_inode(struct inode *dir, int mode)
 
 	sbi = sb->s_fs_info;
 
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	inode->i_uid = current->cred->fsuid;
 	if (dir->i_mode & S_ISGID) {
 		inode->i_gid = dir->i_gid;
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index 49e16af..9cf9738 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -241,7 +241,7 @@ static void exofs_write_super(struct super_block *sb)
 		EXOFS_ERR("exofs_write_super: exofs_sync_op failed.\n");
 		goto out;
 	}
-	sb->s_dirt = 0;
+	mark_sb_clean(sb);
 
 out:
 	if (or)
@@ -262,7 +262,7 @@ static void exofs_put_super(struct super_block *sb)
 
 	lock_kernel();
 
-	if (sb->s_dirt)
+	if (is_sb_dirty(sb))
 		exofs_write_super(sb);
 
 	/* make sure there are no pending commands */
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 05/19] EXT2: do not manipulate s_dirt directly
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (4 preceding siblings ...)
  2009-05-27 13:05 ` [PATCH 04/19] EXOFS: " Artem Bityutskiy
@ 2009-05-27 13:05 ` Artem Bityutskiy
  2009-05-27 13:05 ` [PATCH 06/19] EXT4: " Artem Bityutskiy
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] EXT2: do not manipulate s_dirt directly

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/ext2/balloc.c |    4 ++--
 fs/ext2/ialloc.c |    4 ++--
 fs/ext2/super.c  |    8 ++++----
 fs/ext2/xattr.c  |    2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index 7f8d2e5..a3de92b 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -164,7 +164,7 @@ static void release_blocks(struct super_block *sb, int count)
 		struct ext2_sb_info *sbi = EXT2_SB(sb);
 
 		percpu_counter_add(&sbi->s_freeblocks_counter, count);
-		sb->s_dirt = 1;
+		mark_sb_dirty(sb);
 	}
 }
 
@@ -179,7 +179,7 @@ static void group_adjust_blocks(struct super_block *sb, int group_no,
 		free_blocks = le16_to_cpu(desc->bg_free_blocks_count);
 		desc->bg_free_blocks_count = cpu_to_le16(free_blocks + count);
 		spin_unlock(sb_bgl_lock(sbi, group_no));
-		sb->s_dirt = 1;
+		mark_sb_dirty(sb);
 		mark_buffer_dirty(bh);
 	}
 }
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index 15387c9..bb8cf4e 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -81,7 +81,7 @@ static void ext2_release_inode(struct super_block *sb, int group, int dir)
 	spin_unlock(sb_bgl_lock(EXT2_SB(sb), group));
 	if (dir)
 		percpu_counter_dec(&EXT2_SB(sb)->s_dirs_counter);
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	mark_buffer_dirty(bh);
 }
 
@@ -548,7 +548,7 @@ got:
 	}
 	spin_unlock(sb_bgl_lock(sbi, group));
 
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	mark_buffer_dirty(bh2);
 	inode->i_uid = current_fsuid();
 	if (test_opt (sb, GRPID))
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index f5b7fad..4f054d5 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -116,7 +116,7 @@ static void ext2_put_super (struct super_block * sb)
 
 	lock_kernel();
 
-	if (sb->s_dirt)
+	if (sb_is_dirty(sb))
 		ext2_write_super(sb);
 
 	ext2_xattr_put_super(sb);
@@ -1107,7 +1107,7 @@ static void ext2_commit_super (struct super_block * sb,
 {
 	es->s_wtime = cpu_to_le32(get_seconds());
 	mark_buffer_dirty(EXT2_SB(sb)->s_sbh);
-	sb->s_dirt = 0;
+	mark_sb_clean(sb);
 }
 
 static void ext2_sync_super(struct super_block *sb, struct ext2_super_block *es)
@@ -1117,7 +1117,7 @@ static void ext2_sync_super(struct super_block *sb, struct ext2_super_block *es)
 	es->s_wtime = cpu_to_le32(get_seconds());
 	mark_buffer_dirty(EXT2_SB(sb)->s_sbh);
 	sync_dirty_buffer(EXT2_SB(sb)->s_sbh);
-	sb->s_dirt = 0;
+	mark_sb_clean(sb);
 }
 
 /*
@@ -1148,7 +1148,7 @@ void ext2_write_super (struct super_block * sb)
 		} else
 			ext2_commit_super (sb, es);
 	}
-	sb->s_dirt = 0;
+	mark_sb_clean(sb);
 	unlock_kernel();
 }
 
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 7913531..1673ee4 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -343,7 +343,7 @@ static void ext2_xattr_update_super_block(struct super_block *sb)
 		return;
 
 	EXT2_SET_COMPAT_FEATURE(sb, EXT2_FEATURE_COMPAT_EXT_ATTR);
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	mark_buffer_dirty(EXT2_SB(sb)->s_sbh);
 }
 
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 06/19] EXT4: do not manipulate s_dirt directly
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (5 preceding siblings ...)
  2009-05-27 13:05 ` [PATCH 05/19] EXT2: " Artem Bityutskiy
@ 2009-05-27 13:05 ` Artem Bityutskiy
  2009-05-27 13:05 ` [PATCH 07/19] FAT: " Artem Bityutskiy
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] EXT4: do not manipulate s_dirt directly

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/ext4/balloc.c  |    2 +-
 fs/ext4/ialloc.c  |    4 ++--
 fs/ext4/inode.c   |    2 +-
 fs/ext4/mballoc.c |    4 ++--
 fs/ext4/resize.c  |    4 ++--
 fs/ext4/super.c   |   16 ++++++++--------
 fs/ext4/xattr.c   |    2 +-
 7 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 53c72ad..ccb83ff 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -490,7 +490,7 @@ void ext4_add_groupblocks(handle_t *handle, struct super_block *sb,
 	ret = ext4_handle_dirty_metadata(handle, NULL, gd_bh);
 	if (!err)
 		err = ret;
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 
 error_return:
 	brelse(bitmap_bh);
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index f18e0a0..949e4a7 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -297,7 +297,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)
 	err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh);
 	if (!fatal)
 		fatal = err;
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 error_return:
 	brelse(bitmap_bh);
 	ext4_std_error(sb, fatal);
@@ -968,7 +968,7 @@ got:
 	percpu_counter_dec(&sbi->s_freeinodes_counter);
 	if (S_ISDIR(mode))
 		percpu_counter_inc(&sbi->s_dirs_counter);
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 
 	if (sbi->s_log_groups_per_flex) {
 		flex_group = ext4_flex_group(sbi, group);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index e91f978..743ca39 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4598,7 +4598,7 @@ static int ext4_do_update_inode(handle_t *handle,
 			ext4_update_dynamic_rev(sb);
 			EXT4_SET_RO_COMPAT_FEATURE(sb,
 					EXT4_FEATURE_RO_COMPAT_LARGE_FILE);
-			sb->s_dirt = 1;
+			mark_sb_dirty(sb);
 			ext4_handle_sync(handle);
 			err = ext4_handle_dirty_metadata(handle, inode,
 					EXT4_SB(sb)->s_sbh);
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index f871677..191cf37 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3054,7 +3054,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
 	err = ext4_handle_dirty_metadata(handle, NULL, gdp_bh);
 
 out_err:
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	brelse(bitmap_bh);
 	return err;
 }
@@ -4909,7 +4909,7 @@ do_more:
 		put_bh(bitmap_bh);
 		goto do_more;
 	}
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 error_return:
 	brelse(bitmap_bh);
 	ext4_std_error(sb, err);
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 546c7dd..323d741 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -945,7 +945,7 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
 	}
 
 	ext4_handle_dirty_metadata(handle, NULL, sbi->s_sbh);
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 
 exit_journal:
 	unlock_super(sb);
@@ -1076,7 +1076,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es,
 	}
 	ext4_blocks_count_set(es, o_blocks_count + add);
 	ext4_handle_dirty_metadata(handle, NULL, EXT4_SB(sb)->s_sbh);
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	unlock_super(sb);
 	ext4_debug("freeing blocks %llu through %llu\n", o_blocks_count,
 		   o_blocks_count + add);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index d789833..017052a 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -566,7 +566,7 @@ static void ext4_put_super(struct super_block *sb)
 
 	lock_super(sb);
 	lock_kernel();
-	if (sb->s_dirt)
+	if (sb_is_dirty(sb))
 		ext4_write_super_locked(sb);
 
 	ext4_mb_release(sb);
@@ -2482,7 +2482,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 #else
 		es->s_flags |= cpu_to_le32(EXT2_FLAGS_SIGNED_HASH);
 #endif
-		sb->s_dirt = 1;
+		mark_sb_dirty(sb);
 	}
 
 	if (sbi->s_blocks_per_group > blocksize * 8) {
@@ -3117,7 +3117,7 @@ static int ext4_load_journal(struct super_block *sb,
 	if (journal_devnum &&
 	    journal_devnum != le32_to_cpu(es->s_journal_dev)) {
 		es->s_journal_dev = cpu_to_le32(journal_devnum);
-		sb->s_dirt = 1;
+		mark_sb_dirty(sb);
 
 		/* Make sure we flush the recovery flag to disk. */
 		ext4_commit_super(sb, es, 1);
@@ -3199,7 +3199,7 @@ static void ext4_mark_recovery_complete(struct super_block *sb,
 	if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER) &&
 	    sb->s_flags & MS_RDONLY) {
 		EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
-		sb->s_dirt = 0;
+		mark_sb_clean(sb);
 		ext4_commit_super(sb, es, 1);
 	}
 	unlock_super(sb);
@@ -3261,7 +3261,7 @@ int ext4_force_commit(struct super_block *sb)
 
 	journal = EXT4_SB(sb)->s_journal;
 	if (journal) {
-		sb->s_dirt = 0;
+		mark_sb_clean(sb);
 		ret = ext4_journal_force_commit(journal);
 	}
 
@@ -3279,7 +3279,7 @@ static void ext4_write_super_locked(struct super_block *sb)
 	if (EXT4_SB(sb)->s_journal) {
 		if (mutex_trylock(&sb->s_lock) != 0)
 			BUG();
-		sb->s_dirt = 0;
+		mark_sb_clean(sb);
 	} else {
 		ext4_commit_super(sb, EXT4_SB(sb)->s_es, 1);
 	}
@@ -3298,7 +3298,7 @@ static int ext4_sync_fs(struct super_block *sb, int wait)
 	tid_t target;
 
 	trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait);
-	sb->s_dirt = 0;
+	mark_sb_clean(sb);
 	if (EXT4_SB(sb)->s_journal) {
 		if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal,
 					      &target)) {
@@ -3320,7 +3320,7 @@ static int ext4_freeze(struct super_block *sb)
 {
 	int error = 0;
 	journal_t *journal;
-	sb->s_dirt = 0;
+	mark_sb_clean(sb);
 
 	if (!(sb->s_flags & MS_RDONLY)) {
 		journal = EXT4_SB(sb)->s_journal;
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 62b31c2..3589b7a 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -456,7 +456,7 @@ static void ext4_xattr_update_super_block(handle_t *handle,
 
 	if (ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh) == 0) {
 		EXT4_SET_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_EXT_ATTR);
-		sb->s_dirt = 1;
+		mark_sb_dirty(sb);
 		ext4_handle_dirty_metadata(handle, NULL, EXT4_SB(sb)->s_sbh);
 	}
 }
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 07/19] FAT: do not manipulate s_dirt directly
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (6 preceding siblings ...)
  2009-05-27 13:05 ` [PATCH 06/19] EXT4: " Artem Bityutskiy
@ 2009-05-27 13:05 ` Artem Bityutskiy
  2009-05-27 13:05 ` [PATCH 08/19] HFS: " Artem Bityutskiy
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] FAT: do not manipulate s_dirt directly

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/fat/fatent.c |    8 ++++----
 fs/fat/inode.c  |    4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
index da6eea4..fa19a9d 100644
--- a/fs/fat/fatent.c
+++ b/fs/fat/fatent.c
@@ -495,7 +495,7 @@ int fat_alloc_clusters(struct inode *inode, int *cluster, int nr_cluster)
 				sbi->prev_free = entry;
 				if (sbi->free_clusters != -1)
 					sbi->free_clusters--;
-				sb->s_dirt = 1;
+				mark_sb_dirty(sb);
 
 				cluster[idx_clus] = entry;
 				idx_clus++;
@@ -517,7 +517,7 @@ int fat_alloc_clusters(struct inode *inode, int *cluster, int nr_cluster)
 	/* Couldn't allocate the free entries */
 	sbi->free_clusters = 0;
 	sbi->free_clus_valid = 1;
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	err = -ENOSPC;
 
 out:
@@ -578,7 +578,7 @@ int fat_free_clusters(struct inode *inode, int cluster)
 		ops->ent_put(&fatent, FAT_ENT_FREE);
 		if (sbi->free_clusters != -1) {
 			sbi->free_clusters++;
-			sb->s_dirt = 1;
+			mark_sb_dirty(sb);
 		}
 
 		if (nr_bhs + fatent.nr_bhs > MAX_BUF_PER_PAGE) {
@@ -668,7 +668,7 @@ int fat_count_free_clusters(struct super_block *sb)
 	}
 	sbi->free_clusters = free;
 	sbi->free_clus_valid = 1;
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	fatent_brelse(&fatent);
 out:
 	unlock_fat(sbi);
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 2292cbf..f3b6410 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -442,7 +442,7 @@ static void fat_clear_inode(struct inode *inode)
 static void fat_write_super(struct super_block *sb)
 {
 	lock_super(sb);
-	sb->s_dirt = 0;
+	mark_sb_clean(sb);
 
 	if (!(sb->s_flags & MS_RDONLY))
 		fat_clusters_flush(sb);
@@ -455,7 +455,7 @@ static void fat_put_super(struct super_block *sb)
 
 	lock_kernel();
 
-	if (sb->s_dirt)
+	if (sb_is_dirty(sb))
 		fat_write_super(sb);
 
 	if (sbi->nls_disk) {
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 08/19] HFS: do not manipulate s_dirt directly
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (7 preceding siblings ...)
  2009-05-27 13:05 ` [PATCH 07/19] FAT: " Artem Bityutskiy
@ 2009-05-27 13:05 ` Artem Bityutskiy
  2009-05-27 13:06 ` [PATCH 09/19] HFSPLUS: " Artem Bityutskiy
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] HFS: do not manipulate s_dirt directly

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/hfs/extent.c |    2 +-
 fs/hfs/hfs_fs.h |    2 +-
 fs/hfs/inode.c  |    6 +++---
 fs/hfs/super.c  |    4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c
index 2c16316..bff476a 100644
--- a/fs/hfs/extent.c
+++ b/fs/hfs/extent.c
@@ -432,7 +432,7 @@ out:
 		if (inode->i_ino < HFS_FIRSTUSER_CNID)
 			set_bit(HFS_FLG_ALT_MDB_DIRTY, &HFS_SB(sb)->flags);
 		set_bit(HFS_FLG_MDB_DIRTY, &HFS_SB(sb)->flags);
-		sb->s_dirt = 1;
+		mark_sb_dirty(sb);
 	}
 	return res;
 
diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h
index 052387e..3b6631f 100644
--- a/fs/hfs/hfs_fs.h
+++ b/fs/hfs/hfs_fs.h
@@ -251,7 +251,7 @@ static inline const char *hfs_mdb_name(struct super_block *sb)
 static inline void hfs_bitmap_dirty(struct super_block *sb)
 {
 	set_bit(HFS_FLG_BITMAP_DIRTY, &HFS_SB(sb)->flags);
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 }
 
 static inline void hfs_buffer_sync(struct buffer_head *bh)
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index a1cbff2..b87dcf0 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -198,7 +198,7 @@ struct inode *hfs_new_inode(struct inode *dir, struct qstr *name, int mode)
 	insert_inode_hash(inode);
 	mark_inode_dirty(inode);
 	set_bit(HFS_FLG_MDB_DIRTY, &HFS_SB(sb)->flags);
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 
 	return inode;
 }
@@ -213,7 +213,7 @@ void hfs_delete_inode(struct inode *inode)
 		if (HFS_I(inode)->cat_key.ParID == cpu_to_be32(HFS_ROOT_CNID))
 			HFS_SB(sb)->root_dirs--;
 		set_bit(HFS_FLG_MDB_DIRTY, &HFS_SB(sb)->flags);
-		sb->s_dirt = 1;
+		mark_sb_dirty(sb);
 		return;
 	}
 	HFS_SB(sb)->file_count--;
@@ -226,7 +226,7 @@ void hfs_delete_inode(struct inode *inode)
 		}
 	}
 	set_bit(HFS_FLG_MDB_DIRTY, &HFS_SB(sb)->flags);
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 }
 
 void hfs_inode_read_fork(struct inode *inode, struct hfs_extent *ext,
diff --git a/fs/hfs/super.c b/fs/hfs/super.c
index 3aac417..6b84117 100644
--- a/fs/hfs/super.c
+++ b/fs/hfs/super.c
@@ -50,7 +50,7 @@ MODULE_LICENSE("GPL");
 static void hfs_write_super(struct super_block *sb)
 {
 	lock_super(sb);
-	sb->s_dirt = 0;
+	mark_sb_clean(sb);
 
 	/* sync everything to the buffers */
 	if (!(sb->s_flags & MS_RDONLY))
@@ -69,7 +69,7 @@ static void hfs_put_super(struct super_block *sb)
 {
 	lock_kernel();
 
-	if (sb->s_dirt)
+	if (sb_is_dirty(sb))
 		hfs_write_super(sb);
 	hfs_mdb_close(sb);
 	/* release the MDB's resources */
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 09/19] HFSPLUS: do not manipulate s_dirt directly
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (8 preceding siblings ...)
  2009-05-27 13:05 ` [PATCH 08/19] HFS: " Artem Bityutskiy
@ 2009-05-27 13:06 ` Artem Bityutskiy
  2009-05-27 13:06 ` [PATCH 10/19] JFFS2: " Artem Bityutskiy
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] HFSPLUS: do not manipulate s_dirt directly

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/hfsplus/bitmap.c |    4 ++--
 fs/hfsplus/dir.c    |    2 +-
 fs/hfsplus/inode.c  |    6 +++---
 fs/hfsplus/super.c  |   14 +++++++-------
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/fs/hfsplus/bitmap.c b/fs/hfsplus/bitmap.c
index ea30afc..345b0e3 100644
--- a/fs/hfsplus/bitmap.c
+++ b/fs/hfsplus/bitmap.c
@@ -151,7 +151,7 @@ done:
 	kunmap(page);
 	*max = offset + (curr - pptr) * 32 + i - start;
 	HFSPLUS_SB(sb).free_blocks -= *max;
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	dprint(DBG_BITMAP, "-> %u,%u\n", start, *max);
 out:
 	mutex_unlock(&HFSPLUS_SB(sb).alloc_file->i_mutex);
@@ -225,7 +225,7 @@ out:
 	set_page_dirty(page);
 	kunmap(page);
 	HFSPLUS_SB(sb).free_blocks += len;
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	mutex_unlock(&HFSPLUS_SB(sb).alloc_file->i_mutex);
 
 	return 0;
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 5f40236..71868b5 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -305,7 +305,7 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir,
 	inode->i_ctime = CURRENT_TIME_SEC;
 	mark_inode_dirty(inode);
 	HFSPLUS_SB(sb).file_count++;
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 
 	return 0;
 }
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 1bcf597..76fe933 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -333,7 +333,7 @@ struct inode *hfsplus_new_inode(struct super_block *sb, int mode)
 		HFSPLUS_SB(sb).file_count++;
 	insert_inode_hash(inode);
 	mark_inode_dirty(inode);
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 
 	return inode;
 }
@@ -344,7 +344,7 @@ void hfsplus_delete_inode(struct inode *inode)
 
 	if (S_ISDIR(inode->i_mode)) {
 		HFSPLUS_SB(sb).folder_count--;
-		sb->s_dirt = 1;
+		mark_sb_dirty(sb);
 		return;
 	}
 	HFSPLUS_SB(sb).file_count--;
@@ -357,7 +357,7 @@ void hfsplus_delete_inode(struct inode *inode)
 		inode->i_size = 0;
 		hfsplus_file_truncate(inode);
 	}
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 }
 
 void hfsplus_inode_read_fork(struct inode *inode, struct hfsplus_fork_raw *fork)
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 1aab8aa..4be3653 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -104,7 +104,7 @@ static int hfsplus_write_inode(struct inode *inode, int unused)
 	case HFSPLUS_EXT_CNID:
 		if (vhdr->ext_file.total_size != cpu_to_be64(inode->i_size)) {
 			HFSPLUS_SB(inode->i_sb).flags |= HFSPLUS_SB_WRITEBACKUP;
-			inode->i_sb->s_dirt = 1;
+			mark_sb_dirty(inode->i_sb);
 		}
 		hfsplus_inode_write_fork(inode, &vhdr->ext_file);
 		hfs_btree_write(HFSPLUS_SB(inode->i_sb).ext_tree);
@@ -112,7 +112,7 @@ static int hfsplus_write_inode(struct inode *inode, int unused)
 	case HFSPLUS_CAT_CNID:
 		if (vhdr->cat_file.total_size != cpu_to_be64(inode->i_size)) {
 			HFSPLUS_SB(inode->i_sb).flags |= HFSPLUS_SB_WRITEBACKUP;
-			inode->i_sb->s_dirt = 1;
+			mark_sb_dirty(inode->i_sb);
 		}
 		hfsplus_inode_write_fork(inode, &vhdr->cat_file);
 		hfs_btree_write(HFSPLUS_SB(inode->i_sb).cat_tree);
@@ -120,21 +120,21 @@ static int hfsplus_write_inode(struct inode *inode, int unused)
 	case HFSPLUS_ALLOC_CNID:
 		if (vhdr->alloc_file.total_size != cpu_to_be64(inode->i_size)) {
 			HFSPLUS_SB(inode->i_sb).flags |= HFSPLUS_SB_WRITEBACKUP;
-			inode->i_sb->s_dirt = 1;
+			mark_sb_dirty(inode->i_sb);
 		}
 		hfsplus_inode_write_fork(inode, &vhdr->alloc_file);
 		break;
 	case HFSPLUS_START_CNID:
 		if (vhdr->start_file.total_size != cpu_to_be64(inode->i_size)) {
 			HFSPLUS_SB(inode->i_sb).flags |= HFSPLUS_SB_WRITEBACKUP;
-			inode->i_sb->s_dirt = 1;
+			mark_sb_dirty(inode->i_sb);
 		}
 		hfsplus_inode_write_fork(inode, &vhdr->start_file);
 		break;
 	case HFSPLUS_ATTR_CNID:
 		if (vhdr->attr_file.total_size != cpu_to_be64(inode->i_size)) {
 			HFSPLUS_SB(inode->i_sb).flags |= HFSPLUS_SB_WRITEBACKUP;
-			inode->i_sb->s_dirt = 1;
+			mark_sb_dirty(inode->i_sb);
 		}
 		hfsplus_inode_write_fork(inode, &vhdr->attr_file);
 		hfs_btree_write(HFSPLUS_SB(inode->i_sb).attr_tree);
@@ -159,7 +159,7 @@ static void hfsplus_write_super(struct super_block *sb)
 	dprint(DBG_SUPER, "hfsplus_write_super\n");
 
 	lock_super(sb);
-	sb->s_dirt = 0;
+	mark_sb_clean(sb);
 	if (sb->s_flags & MS_RDONLY)
 		/* warn? */
 		goto out;
@@ -206,7 +206,7 @@ static void hfsplus_put_super(struct super_block *sb)
 
 	lock_kernel();
 
-	if (sb->s_dirt)
+	if (sb_is_dirty(sb))
 		hfsplus_write_super(sb);
 	if (!(sb->s_flags & MS_RDONLY) && HFSPLUS_SB(sb).s_vhdr) {
 		struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr;
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 10/19] JFFS2: do not manipulate s_dirt directly
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (9 preceding siblings ...)
  2009-05-27 13:06 ` [PATCH 09/19] HFSPLUS: " Artem Bityutskiy
@ 2009-05-27 13:06 ` Artem Bityutskiy
  2009-05-27 13:06 ` [PATCH 11/19] NILFS: " Artem Bityutskiy
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] JFFS2: do not manipulate s_dirt directly

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/jffs2/os-linux.h |    2 +-
 fs/jffs2/super.c    |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
index 2228380..ad12212 100644
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -147,7 +147,7 @@ void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c);
 /* erase.c */
 static inline void jffs2_erase_pending_trigger(struct jffs2_sb_info *c)
 {
-	OFNI_BS_2SFFJ(c)->s_dirt = 1;
+	mark_sb_dirty(OFNI_BS_2SFFJ(c));
 }
 
 /* background.c */
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index f7bfd3a..5b321fa 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -58,7 +58,7 @@ static void jffs2_write_super(struct super_block *sb)
 	struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
 
 	lock_super(sb);
-	sb->s_dirt = 0;
+	mark_sb_clean(sb);
 
 	if (!(sb->s_flags & MS_RDONLY)) {
 		D1(printk(KERN_DEBUG "jffs2_write_super()\n"));
@@ -193,7 +193,7 @@ static void jffs2_put_super (struct super_block *sb)
 
 	lock_kernel();
 
-	if (sb->s_dirt)
+	if (sb_is_dirty(sb))
 		jffs2_write_super(sb);
 
 	mutex_lock(&c->alloc_sem);
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 11/19] NILFS: do not manipulate s_dirt directly
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (10 preceding siblings ...)
  2009-05-27 13:06 ` [PATCH 10/19] JFFS2: " Artem Bityutskiy
@ 2009-05-27 13:06 ` Artem Bityutskiy
  2009-05-27 13:06 ` [PATCH 12/19] reiserfs: " Artem Bityutskiy
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] NILFS: do not manipulate s_dirt directly

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/nilfs2/segment.c   |    2 +-
 fs/nilfs2/super.c     |   18 +++++++++---------
 fs/nilfs2/the_nilfs.c |    2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index fb70ec3..0dcac79 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2069,7 +2069,7 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci)
 	if (update_sr) {
 		nilfs_set_last_segment(nilfs, segbuf->sb_pseg_start,
 				       segbuf->sb_sum.seg_seq, nilfs->ns_cno++);
-		sbi->s_super->s_dirt = 1;
+		mark_sb_dirty(sbi->s_super);
 
 		clear_bit(NILFS_SC_HAVE_DELTA, &sci->sc_flags);
 		clear_bit(NILFS_SC_DIRTY, &sci->sc_flags);
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 7262e84..6f3707b 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -307,7 +307,7 @@ int nilfs_commit_super(struct nilfs_sb_info *sbi, int dupsb)
 		memcpy(sbp[1], sbp[0], nilfs->ns_sbsize);
 		nilfs->ns_sbwtime[1] = t;
 	}
-	sbi->s_super->s_dirt = 0;
+	mark_sb_clean(sbi->s_super);
 	return nilfs_sync_super(sbi, dupsb);
 }
 
@@ -318,7 +318,7 @@ static void nilfs_put_super(struct super_block *sb)
 
 	lock_kernel();
 
-	if (sb->s_dirt)
+	if (sb_is_dirty(sb))
 		nilfs_write_super(sb);
 
 	nilfs_detach_segment_constructor(sbi);
@@ -344,17 +344,17 @@ static void nilfs_put_super(struct super_block *sb)
  * @sb: super_block
  *
  * nilfs_write_super() gets a fs-dependent lock, writes super block(s), and
- * clears s_dirt.  This function is called in the section protected by
- * lock_super().
+ * clears the superblock.  This function is called in the section protected
+ * by lock_super().
  *
- * The s_dirt flag is managed by each filesystem and we protect it by ns_sem
- * of the struct the_nilfs.  Lock order must be as follows:
+ * The super block s_dirt flag is managed by each filesystem and we protect
+ * it by ns_sem of the struct the_nilfs.  Lock order must be as follows:
  *
  *   1. lock_super()
  *   2.    down_write(&nilfs->ns_sem)
  *
- * Inside NILFS, locking ns_sem is enough to protect s_dirt and the buffer
- * of the super block (nilfs->ns_sbp[]).
+ * Inside NILFS, locking ns_sem is enough to protect the super block s_dirt
+ * and the buffer of the super block (nilfs->ns_sbp[]).
  *
  * In most cases, VFS functions call lock_super() before calling these
  * methods.  So we must be careful not to bring on deadlocks when using
@@ -383,7 +383,7 @@ static void nilfs_write_super(struct super_block *sb)
 		dupsb = sbp[1] && t > nilfs->ns_sbwtime[1] + NILFS_ALTSB_FREQ;
 		nilfs_commit_super(sbi, dupsb);
 	}
-	sb->s_dirt = 0;
+	mark_sb_clean(sb);
 	up_write(&nilfs->ns_sem);
 }
 
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c
index 7f65b3b..5b02f50 100644
--- a/fs/nilfs2/the_nilfs.c
+++ b/fs/nilfs2/the_nilfs.c
@@ -278,7 +278,7 @@ int load_nilfs(struct the_nilfs *nilfs, struct nilfs_sb_info *sbi)
 			goto failed;
 		}
 		if (ri.ri_need_recovery == NILFS_RECOVERY_SR_UPDATED)
-			sbi->s_super->s_dirt = 1;
+			mark_sb_dirty(sbi->s_super);
 	}
 
 	set_nilfs_loaded(nilfs);
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 12/19] reiserfs: do not manipulate s_dirt directly
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (11 preceding siblings ...)
  2009-05-27 13:06 ` [PATCH 11/19] NILFS: " Artem Bityutskiy
@ 2009-05-27 13:06 ` Artem Bityutskiy
  2009-05-27 13:06 ` [PATCH 13/19] SYSV: " Artem Bityutskiy
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] reiserfs: do not manipulate s_dirt directly

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/reiserfs/journal.c |    6 +++---
 fs/reiserfs/resize.c  |    2 +-
 fs/reiserfs/super.c   |   10 +++++-----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 77f5bb7..1d2fb0e 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -3259,7 +3259,7 @@ int journal_mark_dirty(struct reiserfs_transaction_handle *th,
 			       th->t_trans_id, journal->j_trans_id);
 	}
 
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 
 	prepared = test_clear_buffer_journal_prepared(bh);
 	clear_buffer_journal_restore_dirty(bh);
@@ -3554,7 +3554,7 @@ int reiserfs_flush_old_commits(struct super_block *sb)
 			do_journal_end(&th, sb, 1, COMMIT_NOW | WAIT);
 		}
 	}
-	return sb->s_dirt;
+	return sb_is_dirty(sb);
 }
 
 /*
@@ -3984,7 +3984,7 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
 	 ** it tells us if we should continue with the journal_end, or just return
 	 */
 	if (!check_journal_end(th, sb, nblocks, flags)) {
-		sb->s_dirt = 1;
+		mark_sb_dirty(sb);
 		wake_queued_writers(sb);
 		reiserfs_async_progress_wait(sb);
 		goto out;
diff --git a/fs/reiserfs/resize.c b/fs/reiserfs/resize.c
index 238e9d9..9157d38 100644
--- a/fs/reiserfs/resize.c
+++ b/fs/reiserfs/resize.c
@@ -202,7 +202,7 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
 					  (bmap_nr_new - bmap_nr)));
 	PUT_SB_BLOCK_COUNT(s, block_count_new);
 	PUT_SB_BMAP_NR(s, bmap_would_wrap(bmap_nr_new) ? : bmap_nr_new);
-	s->s_dirt = 1;
+	mark_sb_dirty(s);
 
 	journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
 
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 90dcb7b..f45c78f 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -70,8 +70,8 @@ static int reiserfs_sync_fs(struct super_block *s, int wait)
 	if (!journal_begin(&th, s, 1))
 		if (!journal_end_sync(&th, s, 1))
 			reiserfs_flush_old_commits(s);
-	s->s_dirt = 0;	/* Even if it's not true.
-			 * We'll loop forever in sync_supers otherwise */
+	mark_sb_clean(s); /* Even if it's not true.
+			   * We'll loop forever in sync_supers otherwise */
 	reiserfs_write_unlock(s);
 	return 0;
 }
@@ -97,7 +97,7 @@ static int reiserfs_freeze(struct super_block *s)
 			journal_end_sync(&th, s, 1);
 		}
 	}
-	s->s_dirt = 0;
+	mark_sb_clean(s);
 	reiserfs_write_unlock(s);
 	return 0;
 }
@@ -467,7 +467,7 @@ static void reiserfs_put_super(struct super_block *s)
 
 	lock_kernel();
 
-	if (s->s_dirt)
+	if (sb_is_dirty(s))
 		reiserfs_write_super(s);
 
 	/* change file system state to current state if it was mounted with read-write permissions */
@@ -1309,7 +1309,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
 	err = journal_end(&th, s, 10);
 	if (err)
 		goto out_err;
-	s->s_dirt = 0;
+	mark_sb_clean(s);
 
 	if (!(*mount_flags & MS_RDONLY)) {
 		finish_unfinished(s);
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 13/19] SYSV: do not manipulate s_dirt directly
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (12 preceding siblings ...)
  2009-05-27 13:06 ` [PATCH 12/19] reiserfs: " Artem Bityutskiy
@ 2009-05-27 13:06 ` Artem Bityutskiy
  2009-05-27 13:06 ` [PATCH 14/19] UDF: " Artem Bityutskiy
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] SYSV: do not manipulate s_dirt directly

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/sysv/inode.c |    8 ++++----
 fs/sysv/super.c |    2 +-
 fs/sysv/sysv.h  |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c
index a3f45fc..3c5ea5c 100644
--- a/fs/sysv/inode.c
+++ b/fs/sysv/inode.c
@@ -31,7 +31,7 @@
 #include <asm/byteorder.h>
 #include "sysv.h"
 
-/* This is only called on sync() and umount(), when s_dirt=1. */
+/* This is only called on sync() and umount(), when the super block is dirty. */
 static void sysv_write_super(struct super_block *sb)
 {
 	struct sysv_sb_info *sbi = SYSV_SB(sb);
@@ -55,7 +55,7 @@ static void sysv_write_super(struct super_block *sb)
 		mark_buffer_dirty(sbi->s_bh2);
 	}
 clean:
-	sb->s_dirt = 0;
+	mark_sb_clean(sb);
 	unlock_kernel();
 	unlock_super(sb);
 }
@@ -67,7 +67,7 @@ static int sysv_remount(struct super_block *sb, int *flags, char *data)
 	if (sbi->s_forced_ro)
 		*flags |= MS_RDONLY;
 	if (!(*flags & MS_RDONLY))
-		sb->s_dirt = 1;
+		mark_sb_dirty(sb);
 	unlock_super(sb);
 	return 0;
 }
@@ -78,7 +78,7 @@ static void sysv_put_super(struct super_block *sb)
 
 	lock_kernel();
 
-	if (sb->s_dirt)
+	if (sb_is_dirty(sb))
 		sysv_write_super(sb);
 
 	if (!(sb->s_flags & MS_RDONLY)) {
diff --git a/fs/sysv/super.c b/fs/sysv/super.c
index 5a903da..f0d3679 100644
--- a/fs/sysv/super.c
+++ b/fs/sysv/super.c
@@ -347,7 +347,7 @@ static int complete_read_super(struct super_block *sb, int silent, int size)
 		sb->s_flags |= MS_RDONLY;
 	if (sbi->s_truncate)
 		sb->s_root->d_op = &sysv_dentry_operations;
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	return 1;
 }
 
diff --git a/fs/sysv/sysv.h b/fs/sysv/sysv.h
index 5784a31..4d1b784 100644
--- a/fs/sysv/sysv.h
+++ b/fs/sysv/sysv.h
@@ -118,7 +118,7 @@ static inline void dirty_sb(struct super_block *sb)
 	mark_buffer_dirty(sbi->s_bh1);
 	if (sbi->s_bh1 != sbi->s_bh2)
 		mark_buffer_dirty(sbi->s_bh2);
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 }
 
 
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 14/19] UDF: do not manipulate s_dirt directly
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (13 preceding siblings ...)
  2009-05-27 13:06 ` [PATCH 13/19] SYSV: " Artem Bityutskiy
@ 2009-05-27 13:06 ` Artem Bityutskiy
  2009-05-27 13:06 ` [PATCH 15/19] UFS: " Artem Bityutskiy
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] UDF: do not manipulate s_dirt directly

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/udf/super.c   |    6 +++---
 fs/udf/udfdecl.h |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/udf/super.c b/fs/udf/super.c
index e2e06b0..7926436 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1908,7 +1908,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
 	sb->s_op = &udf_sb_ops;
 	sb->s_export_op = &udf_export_ops;
 	sb->dq_op = NULL;
-	sb->s_dirt = 0;
+	mark_sb_clean(sb);
 	sb->s_magic = UDF_SUPER_MAGIC;
 	sb->s_time_gran = 1000;
 
@@ -2035,7 +2035,7 @@ static void udf_error(struct super_block *sb, const char *function,
 
 	if (!(sb->s_flags & MS_RDONLY)) {
 		/* mark sb error */
-		sb->s_dirt = 1;
+		mark_sb_dirty(sb);
 	}
 	va_start(args, fmt);
 	vsnprintf(error_buf, sizeof(error_buf), fmt, args);
@@ -2095,7 +2095,7 @@ static int udf_sync_fs(struct super_block *sb, int wait)
 		 * the buffer for IO
 		 */
 		mark_buffer_dirty(sbi->s_lvid_bh);
-		sb->s_dirt = 0;
+		mark_sb_clean(sb);
 		sbi->s_lvid_dirty = 0;
 	}
 	mutex_unlock(&sbi->s_alloc_mutex);
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index cac51b7..8ad1818 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -119,7 +119,7 @@ static inline void udf_updated_lvid(struct super_block *sb)
 	WARN_ON_ONCE(((struct logicalVolIntegrityDesc *)
 		     bh->b_data)->integrityType !=
 		     cpu_to_le32(LVID_INTEGRITY_TYPE_OPEN));
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	UDF_SB(sb)->s_lvid_dirty = 1;
 }
 
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 15/19] UFS: do not manipulate s_dirt directly
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (14 preceding siblings ...)
  2009-05-27 13:06 ` [PATCH 14/19] UDF: " Artem Bityutskiy
@ 2009-05-27 13:06 ` Artem Bityutskiy
  2009-05-27 13:06 ` [PATCH 16/19] XFS: " Artem Bityutskiy
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] UFS: do not manipulate s_dirt directly

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/ufs/balloc.c |    8 ++++----
 fs/ufs/ialloc.c |    4 ++--
 fs/ufs/super.c  |   10 +++++-----
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index 54c16ec..71a6971 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -122,7 +122,7 @@ void ufs_free_fragments(struct inode *inode, u64 fragment, unsigned count)
 		ubh_ll_rw_block(SWRITE, UCPI_UBH(ucpi));
 		ubh_wait_on_buffer (UCPI_UBH(ucpi));
 	}
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	
 	unlock_super (sb);
 	UFSD("EXIT\n");
@@ -223,7 +223,7 @@ do_more:
 		goto do_more;
 	}
 
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	unlock_super (sb);
 	UFSD("EXIT\n");
 	return;
@@ -571,7 +571,7 @@ static u64 ufs_add_fragments(struct inode *inode, u64 fragment,
 		ubh_ll_rw_block(SWRITE, UCPI_UBH(ucpi));
 		ubh_wait_on_buffer (UCPI_UBH(ucpi));
 	}
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 
 	UFSD("EXIT, fragment %llu\n", (unsigned long long)fragment);
 	
@@ -698,7 +698,7 @@ succed:
 		ubh_ll_rw_block(SWRITE, UCPI_UBH(ucpi));
 		ubh_wait_on_buffer (UCPI_UBH(ucpi));
 	}
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 
 	result += cgno * uspi->s_fpg;
 	UFSD("EXIT3, result %llu\n", (unsigned long long)result);
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index 3527c00..b33cfe6 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -124,7 +124,7 @@ void ufs_free_inode (struct inode * inode)
 		ubh_wait_on_buffer (UCPI_UBH(ucpi));
 	}
 	
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	unlock_super (sb);
 	UFSD("EXIT\n");
 }
@@ -300,7 +300,7 @@ cg_found:
 		ubh_ll_rw_block(SWRITE, UCPI_UBH(ucpi));
 		ubh_wait_on_buffer (UCPI_UBH(ucpi));
 	}
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 
 	inode->i_ino = cg * uspi->s_ipg + bit;
 	inode->i_mode = mode;
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index c97210e..0316f83 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -237,7 +237,7 @@ void ufs_error (struct super_block * sb, const char * function,
 	if (!(sb->s_flags & MS_RDONLY)) {
 		usb1->fs_clean = UFS_FSBAD;
 		ubh_mark_buffer_dirty(USPI_UBH(uspi));
-		sb->s_dirt = 1;
+		mark_sb_dirty(sb);
 		sb->s_flags |= MS_RDONLY;
 	}
 	va_start (args, fmt);
@@ -269,7 +269,7 @@ void ufs_panic (struct super_block * sb, const char * function,
 	if (!(sb->s_flags & MS_RDONLY)) {
 		usb1->fs_clean = UFS_FSBAD;
 		ubh_mark_buffer_dirty(USPI_UBH(uspi));
-		sb->s_dirt = 1;
+		mark_sb_dirty(sb);
 	}
 	va_start (args, fmt);
 	vsnprintf (error_buf, sizeof(error_buf), fmt, args);
@@ -1148,7 +1148,7 @@ static void ufs_write_super(struct super_block *sb)
 					UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time));
 		ufs_put_cstotal(sb);
 	}
-	sb->s_dirt = 0;
+	mark_sb_clean(sb);
 	UFSD("EXIT\n");
 	unlock_kernel();
 	unlock_super(sb);
@@ -1160,7 +1160,7 @@ static void ufs_put_super(struct super_block *sb)
 		
 	UFSD("ENTER\n");
 
-	if (sb->s_dirt)
+	if (sb_is_dirty(sb))
 		ufs_write_super(sb);
 
 	if (!(sb->s_flags & MS_RDONLY))
@@ -1226,7 +1226,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
 			ufs_set_fs_state(sb, usb1, usb3,
 				UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time));
 		ubh_mark_buffer_dirty (USPI_UBH(uspi));
-		sb->s_dirt = 0;
+		mark_sb_clean(sb);
 		sb->s_flags |= MS_RDONLY;
 	} else {
 	/*
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 16/19] XFS: do not manipulate s_dirt directly
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (15 preceding siblings ...)
  2009-05-27 13:06 ` [PATCH 15/19] UFS: " Artem Bityutskiy
@ 2009-05-27 13:06 ` Artem Bityutskiy
  2009-05-27 13:06 ` [PATCH 17/19] VFS: use sb_is_dirty helper Artem Bityutskiy
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] XFS: do not manipulate s_dirt directly

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/xfs/linux-2.6/xfs_super.c |    6 +++---
 fs/xfs/xfs_trans.c           |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index d29218e..4c25456 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -1114,7 +1114,7 @@ xfs_fs_write_super(
 {
 	if (!(sb->s_flags & MS_RDONLY))
 		xfs_sync_fsdata(XFS_M(sb), 0);
-	sb->s_dirt = 0;
+	mark_sb_clean(sb);
 }
 
 STATIC int
@@ -1141,7 +1141,7 @@ xfs_fs_sync_super(
 		error = xfs_quiesce_data(mp);
 	else
 		error = xfs_sync_fsdata(mp, 0);
-	sb->s_dirt = 0;
+	mark_sb_clean(sb);
 
 	if (unlikely(laptop_mode)) {
 		int	prev_sync_seq = mp->m_sync_seq;
@@ -1447,7 +1447,7 @@ xfs_fs_fill_super(
 
 	XFS_SEND_MOUNT(mp, DM_RIGHT_NULL, mtpt, mp->m_fsname);
 
-	sb->s_dirt = 1;
+	mark_sb_dirty(sb);
 	sb->s_magic = XFS_SB_MAGIC;
 	sb->s_blocksize = mp->m_sb.sb_blocksize;
 	sb->s_blocksize_bits = ffs(sb->s_blocksize) - 1;
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 8570b82..2552bae 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -629,7 +629,7 @@ xfs_trans_apply_sb_deltas(
 				  offsetof(xfs_dsb_t, sb_frextents) +
 				  sizeof(sbp->sb_frextents) - 1);
 
-	tp->t_mountp->m_super->s_dirt = 1;
+	mark_sb_dirty(tp->t_mountp->m_super);
 }
 
 /*
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 17/19] VFS: use sb_is_dirty helper
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (16 preceding siblings ...)
  2009-05-27 13:06 ` [PATCH 16/19] XFS: " Artem Bityutskiy
@ 2009-05-27 13:06 ` Artem Bityutskiy
  2009-05-27 13:06 ` [PATCH 18/19] write-back: introduce a helper function Artem Bityutskiy
  2009-05-27 13:07 ` [PATCH 19/19] periodic write-back: do not wake up unnecessarily Artem Bityutskiy
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] VFS: use sb_is_dirty helper

... instead of checking 's_dirt' directly. This is just
a little cleaner and more consistent. We have only 3
VFS helpers which access 's_dirt' now.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/super.c |    4 ++--
 fs/sync.c  |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/super.c b/fs/super.c
index 2ea1586..ef9a24a 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -415,12 +415,12 @@ void sync_supers(void)
 	spin_lock(&sb_lock);
 restart:
 	list_for_each_entry(sb, &super_blocks, s_list) {
-		if (sb->s_op->write_super && sb->s_dirt) {
+		if (sb->s_op->write_super && sb_is_dirty(sb)) {
 			sb->s_count++;
 			spin_unlock(&sb_lock);
 
 			down_read(&sb->s_umount);
-			if (sb->s_root && sb->s_dirt)
+			if (sb->s_root && sb_is_dirty(sb))
 				sb->s_op->write_super(sb);
 			up_read(&sb->s_umount);
 
diff --git a/fs/sync.c b/fs/sync.c
index e9d56f6..12f36d7 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -33,7 +33,7 @@ static int __sync_filesystem(struct super_block *sb, int wait)
 	else
 		sync_quota_sb(sb, -1);
 	sync_inodes_sb(sb, wait);
-	if (sb->s_dirt && sb->s_op->write_super)
+	if (sb_is_dirty(sb) && sb->s_op->write_super)
 		sb->s_op->write_super(sb);
 	if (sb->s_op->sync_fs)
 		sb->s_op->sync_fs(sb, wait);
@@ -162,7 +162,7 @@ int file_fsync(struct file *filp, struct dentry *dentry, int datasync)
 
 	/* sync the superblock to buffers */
 	sb = inode->i_sb;
-	if (sb->s_dirt && sb->s_op->write_super)
+	if (sb_is_dirty(sb) && sb->s_op->write_super)
 		sb->s_op->write_super(sb);
 
 	/* .. finally sync the buffers to disk */
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 18/19] write-back: introduce a helper function
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (17 preceding siblings ...)
  2009-05-27 13:06 ` [PATCH 17/19] VFS: use sb_is_dirty helper Artem Bityutskiy
@ 2009-05-27 13:06 ` Artem Bityutskiy
  2009-05-27 13:07 ` [PATCH 19/19] periodic write-back: do not wake up unnecessarily Artem Bityutskiy
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] write-back: introduce a helper function

This patch is just a clean up and a preparation for the
following periodic write-back optimization patches. It
introduces a helper 'setup_wb_timer()' function which
sets up the periodic write-back timer to the specified
value, or to the default value. The code just looks
neater with this helper.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 mm/page-writeback.c |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 30351f0..8a213a9 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -738,6 +738,21 @@ static DEFINE_TIMER(wb_timer, wb_timer_fn, 0, 0);
 static DEFINE_TIMER(laptop_mode_wb_timer, laptop_timer_fn, 0, 0);
 
 /*
+ * Setup the periodic write-back timer to expires at @expires jiffies. If
+ * @expires is zero, the timer is set up to the default interval.
+ */
+static void setup_wb_timer(unsigned long expires)
+{
+	if (!expires) {
+		/* Setup to the default wake-up period value */
+		expires = jiffies;
+		expires += msecs_to_jiffies(dirty_writeback_interval * 10);
+	}
+
+	mod_timer(&wb_timer, expires);
+}
+
+/*
  * Periodic writeback of "old" data.
  *
  * Define "old": the first time one of an inode's pages is dirtied, we mark the
@@ -792,7 +807,7 @@ static void wb_kupdate(unsigned long arg)
 	if (time_before(next_jif, jiffies + HZ))
 		next_jif = jiffies + HZ;
 	if (dirty_writeback_interval)
-		mod_timer(&wb_timer, next_jif);
+		setup_wb_timer(next_jif);
 }
 
 /*
@@ -803,8 +818,7 @@ int dirty_writeback_centisecs_handler(ctl_table *table, int write,
 {
 	proc_dointvec(table, write, file, buffer, length, ppos);
 	if (dirty_writeback_interval)
-		mod_timer(&wb_timer, jiffies +
-			msecs_to_jiffies(dirty_writeback_interval * 10));
+		setup_wb_timer(0);
 	else
 		del_timer(&wb_timer);
 	return 0;
@@ -813,7 +827,7 @@ int dirty_writeback_centisecs_handler(ctl_table *table, int write,
 static void wb_timer_fn(unsigned long unused)
 {
 	if (pdflush_operation(wb_kupdate, 0) < 0)
-		mod_timer(&wb_timer, jiffies + HZ); /* delay 1 second */
+		setup_wb_timer( jiffies + HZ); /* delay 1 second */
 }
 
 static void laptop_flush(unsigned long unused)
@@ -906,8 +920,7 @@ void __init page_writeback_init(void)
 {
 	int shift;
 
-	mod_timer(&wb_timer,
-		  jiffies + msecs_to_jiffies(dirty_writeback_interval * 10));
+	setup_wb_timer(0);
 	writeback_set_ratelimit();
 	register_cpu_notifier(&ratelimit_nb);
 
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 19/19] periodic write-back: do not wake up unnecessarily
  2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
                   ` (18 preceding siblings ...)
  2009-05-27 13:06 ` [PATCH 18/19] write-back: introduce a helper function Artem Bityutskiy
@ 2009-05-27 13:07 ` Artem Bityutskiy
  19 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 13:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: [PATCH] periodic write-back: do not wake up unnecessarily

This patch is an optimization which is targeted to lessen
power consumption.

At the moment the periodic write-back thread (pdflush) is
woken up every 5 seconds (by default). It wake up and
writes back old dirty dirty data. And even if there are
no dirty data, the thread keeps waking up to find no
dirty data. And it repeats this every 5 seconds.

This patch makes the periodic write-back thread wake up
only when there are dirty data. Otherwise it just sleeps
and does not disturb CPU. Indeed, CPU may be resting in
a low frequency and low power consumption mode - why do
we have to distract it unnecessarily?

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/fs-writeback.c   |   41 ++++++++++++++++++++++++++++
 include/linux/fs.h  |    7 ++---
 mm/page-writeback.c |   74 ++++++++++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 114 insertions(+), 8 deletions(-)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index e0fb2e7..133944c 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -65,6 +65,24 @@ static void writeback_release(struct backing_dev_info *bdi)
 }
 
 /**
+ * enable_pwb - enable periodic write-back after an inode was marked as dirty.
+ * @inode: the inode which was marked as dirty
+ *
+ * This is a helper function for '__mark_inode_dirty()' which enables the
+ * periodic write-back, unless:
+ *   * the backing device @inode belongs to does not support write-back;
+ *   * periodic write-back is already enabled.
+ */
+static void enable_pwb(struct inode *inode)
+{
+	struct backing_dev_info *bdi = inode->i_mapping->backing_dev_info;
+
+	if (bdi_cap_writeback_dirty(bdi) &&
+	    atomic_add_unless(&periodic_wb_enabled, 1, 1))
+		enable_periodic_wb();
+}
+
+/**
  *	__mark_inode_dirty -	internal function
  *	@inode: inode to mark
  *	@flags: what kind of dirty (i.e. I_DIRTY_SYNC)
@@ -164,6 +182,7 @@ void __mark_inode_dirty(struct inode *inode, int flags)
 		if (!was_dirty) {
 			inode->dirtied_when = jiffies;
 			list_move(&inode->i_list, &sb->s_dirty);
+			enable_pwb(inode);
 		}
 	}
 out:
@@ -172,6 +191,28 @@ out:
 
 EXPORT_SYMBOL(__mark_inode_dirty);
 
+/**
+ * mark_sb_dirty - mark super block as dirty.
+ * @sb: the super block to mark as dirty
+ *
+ * This function marks super block @sb as dirty and enables the periodic
+ * write-back, unless it is already enabled. Note, VFS does not serialize the
+ * super block clean/dirty (@sb->s_dirt) state changes, and each FS is
+ * responsible for doing its own serialization.
+ */
+void mark_sb_dirty(struct super_block *sb)
+{
+	sb->s_dirt = 1;
+	/*
+	 * If 'periodic_wb_enabled' is 0, set it to 1 and enable the periodic
+	 * write-back.
+	 */
+	if (atomic_add_unless(&periodic_wb_enabled, 1, 1))
+		enable_periodic_wb();
+}
+
+EXPORT_SYMBOL(mark_sb_dirty);
+
 static int write_inode(struct inode *inode, int sync)
 {
 	if (inode->i_sb->s_op->write_inode && !is_bad_inode(inode))
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 437939c..230e308 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1782,10 +1782,9 @@ extern int get_sb_pseudo(struct file_system_type *, char *,
 extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
 int __put_super_and_need_restart(struct super_block *sb);
 
-static inline void mark_sb_dirty(struct super_block *sb)
-{
-	sb->s_dirt = 1;
-}
+extern atomic_t periodic_wb_enabled;
+extern void enable_periodic_wb(void);
+extern void mark_sb_dirty(struct super_block *sb);
 static inline void mark_sb_clean(struct super_block *sb)
 {
 	sb->s_dirt = 0;
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 8a213a9..1cbb858 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -736,6 +736,9 @@ static void laptop_timer_fn(unsigned long unused);
 
 static DEFINE_TIMER(wb_timer, wb_timer_fn, 0, 0);
 static DEFINE_TIMER(laptop_mode_wb_timer, laptop_timer_fn, 0, 0);
+static DEFINE_SPINLOCK(wb_timer_lock);
+
+atomic_t periodic_wb_enabled;
 
 /*
  * Setup the periodic write-back timer to expires at @expires jiffies. If
@@ -753,6 +756,67 @@ static void setup_wb_timer(unsigned long expires)
 }
 
 /*
+ * Enable the periodic write-back. This function is usually called when
+ * an inode or a super block becomes dirty.
+ */
+void enable_periodic_wb(void)
+{
+	if (dirty_writeback_interval) {
+		spin_lock(&wb_timer_lock);
+		setup_wb_timer(0);
+		spin_unlock(&wb_timer_lock);
+	}
+}
+
+static void set_next_wb_timer(unsigned long expires)
+{
+	int all_clean = 1;
+	struct super_block *sb;
+
+	atomic_set(&periodic_wb_enabled, 0);
+
+	spin_lock(&sb_lock);
+	list_for_each_entry(sb, &super_blocks, s_list) {
+		if (sb->s_dirt)
+			break;
+
+		spin_lock(&inode_lock);
+		if (sb_has_dirty_inodes(sb)) {
+			struct inode *inode;
+			struct backing_dev_info *bdi;
+
+			inode = list_entry(sb->s_inodes.next,
+					   struct inode, i_sb_list);
+			bdi = inode->i_mapping->backing_dev_info;
+			if (bdi_cap_writeback_dirty(bdi)) {
+				spin_unlock(&inode_lock);
+				all_clean = 0;
+				break;
+			}
+		}
+		spin_unlock(&inode_lock);
+	}
+	spin_unlock(&sb_lock);
+
+	spin_lock(&wb_timer_lock);
+	if (all_clean && atomic_read(&periodic_wb_enabled)) {
+		/*
+		 * There are no dirty data, and no one marked an inode or
+		 * super block as dirty. The periodic update timer may be
+		 * deleted. Note, if we race with some other task which has
+		 * just marked something as dirty and just set
+		 * 'periodic_wb_enabled' to 1, then this task will call
+		 * 'enable_periodic_wb()' which will re-enable the 'wb_timer'.
+		 */
+		del_timer(&wb_timer);
+	} else {
+		atomic_set(&periodic_wb_enabled, 1);
+		setup_wb_timer(expires);
+	}
+	spin_unlock(&wb_timer_lock);
+}
+
+/*
  * Periodic writeback of "old" data.
  *
  * Define "old": the first time one of an inode's pages is dirtied, we mark the
@@ -804,10 +868,12 @@ static void wb_kupdate(unsigned long arg)
 		}
 		nr_to_write -= MAX_WRITEBACK_PAGES - wbc.nr_to_write;
 	}
-	if (time_before(next_jif, jiffies + HZ))
-		next_jif = jiffies + HZ;
-	if (dirty_writeback_interval)
-		setup_wb_timer(next_jif);
+
+	if (dirty_writeback_interval) {
+		if (time_before(next_jif, jiffies + HZ))
+			next_jif = jiffies + HZ;
+		set_next_wb_timer(next_jif);
+	}
 }
 
 /*
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCH 00/19] periodic write-back timer optimization
  2009-05-27 12:47         ` Jens Axboe
@ 2009-05-28  6:34           ` Artem Bityutskiy
  2009-05-28  8:18             ` Jens Axboe
  0 siblings, 1 reply; 28+ messages in thread
From: Artem Bityutskiy @ 2009-05-28  6:34 UTC (permalink / raw)
  To: Christoph Hellwig, viro
  Cc: Jens Axboe, Arnd Bergmann, linux-kernel, linux-fsdevel

Jens Axboe wrote:
> That would be great, I would have no problem integrating such a feature.
> It definitely makes sense.

Hi Al, Christoph,

unless you have objections against the whole idea, I wonder if
it would be possible to make the patches which wrap sb->s_dirt
usage go via VFS tree first, and then I'd continue the timer
optimization work separately. IMO, wrapping s_dirt makes sense
in general. I mean, patches 01-17 from this series.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 00/19] periodic write-back timer optimization
  2009-05-28  6:34           ` Artem Bityutskiy
@ 2009-05-28  8:18             ` Jens Axboe
  2009-06-03 11:13               ` Artem Bityutskiy
  0 siblings, 1 reply; 28+ messages in thread
From: Jens Axboe @ 2009-05-28  8:18 UTC (permalink / raw)
  To: Artem Bityutskiy
  Cc: Christoph Hellwig, viro, Arnd Bergmann, linux-kernel, linux-fsdevel

On Thu, May 28 2009, Artem Bityutskiy wrote:
> Jens Axboe wrote:
>> That would be great, I would have no problem integrating such a feature.
>> It definitely makes sense.
>
> Hi Al, Christoph,
>
> unless you have objections against the whole idea, I wonder if
> it would be possible to make the patches which wrap sb->s_dirt
> usage go via VFS tree first, and then I'd continue the timer
> optimization work separately. IMO, wrapping s_dirt makes sense
> in general. I mean, patches 01-17 from this series.

That makese sense, those are totally separate from the actual
functionality.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 00/19] periodic write-back timer optimization
  2009-05-28  8:18             ` Jens Axboe
@ 2009-06-03 11:13               ` Artem Bityutskiy
  0 siblings, 0 replies; 28+ messages in thread
From: Artem Bityutskiy @ 2009-06-03 11:13 UTC (permalink / raw)
  To: Jens Axboe, Christoph Hellwig, viro
  Cc: Arnd Bergmann, linux-kernel, linux-fsdevel

Jens Axboe wrote:
> On Thu, May 28 2009, Artem Bityutskiy wrote:
>> Jens Axboe wrote:
>>> That would be great, I would have no problem integrating such a feature.
>>> It definitely makes sense.
>> Hi Al, Christoph,
>>
>> unless you have objections against the whole idea, I wonder if
>> it would be possible to make the patches which wrap sb->s_dirt
>> usage go via VFS tree first, and then I'd continue the timer
>> optimization work separately. IMO, wrapping s_dirt makes sense
>> in general. I mean, patches 01-17 from this series.
> 
> That makese sense, those are totally separate from the actual
> functionality.

Reminding ping.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2009-06-03 11:14 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-27 13:05 [PATCH 00/19] periodic write-back timer optimization Artem Bityutskiy
2009-05-27 12:23 ` Arnd Bergmann
2009-05-27 12:27   ` Artem Bityutskiy
2009-05-27 12:33     ` Jens Axboe
2009-05-27 12:37       ` Artem Bityutskiy
2009-05-27 12:47         ` Jens Axboe
2009-05-28  6:34           ` Artem Bityutskiy
2009-05-28  8:18             ` Jens Axboe
2009-06-03 11:13               ` Artem Bityutskiy
2009-05-27 13:05 ` [PATCH 01/19] VFS: introduce helpers for manipulation s_dirty flag Artem Bityutskiy
2009-05-27 13:05 ` [PATCH 02/19] AFFS: do not manipulate s_dirt directly Artem Bityutskiy
2009-05-27 13:05 ` [PATCH 03/19] BFS: " Artem Bityutskiy
2009-05-27 13:05 ` [PATCH 04/19] EXOFS: " Artem Bityutskiy
2009-05-27 13:05 ` [PATCH 05/19] EXT2: " Artem Bityutskiy
2009-05-27 13:05 ` [PATCH 06/19] EXT4: " Artem Bityutskiy
2009-05-27 13:05 ` [PATCH 07/19] FAT: " Artem Bityutskiy
2009-05-27 13:05 ` [PATCH 08/19] HFS: " Artem Bityutskiy
2009-05-27 13:06 ` [PATCH 09/19] HFSPLUS: " Artem Bityutskiy
2009-05-27 13:06 ` [PATCH 10/19] JFFS2: " Artem Bityutskiy
2009-05-27 13:06 ` [PATCH 11/19] NILFS: " Artem Bityutskiy
2009-05-27 13:06 ` [PATCH 12/19] reiserfs: " Artem Bityutskiy
2009-05-27 13:06 ` [PATCH 13/19] SYSV: " Artem Bityutskiy
2009-05-27 13:06 ` [PATCH 14/19] UDF: " Artem Bityutskiy
2009-05-27 13:06 ` [PATCH 15/19] UFS: " Artem Bityutskiy
2009-05-27 13:06 ` [PATCH 16/19] XFS: " Artem Bityutskiy
2009-05-27 13:06 ` [PATCH 17/19] VFS: use sb_is_dirty helper Artem Bityutskiy
2009-05-27 13:06 ` [PATCH 18/19] write-back: introduce a helper function Artem Bityutskiy
2009-05-27 13:07 ` [PATCH 19/19] periodic write-back: do not wake up unnecessarily Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).