linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v2.1 11/17] NILFS: do not manipulate s_dirt directly
  2009-06-05 13:05 ` [PATCH v2.1 11/17] NILFS: " Artem Bityutskiy
@ 2009-06-05 12:04   ` Ryusuke Konishi
  0 siblings, 0 replies; 21+ messages in thread
From: Ryusuke Konishi @ 2009-06-05 12:04 UTC (permalink / raw)
  To: Artem Bityutskiy
  Cc: viro, Artem.Bityutskiy, konishi.ryusuke, linux-kernel, hch,
	linux-fsdevel, users

On Fri,  5 Jun 2009 16:05:49 +0300, Artem Bityutskiy wrote:
> From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> 
> ... use new VFS helpers instead.
> 
> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> Cc: users@nilfs.org
> Cc: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp>

Acked-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

> ---
>  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 (is_sb_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	[flat|nested] 21+ messages in thread

* [PATCH v2.1 00/17] abstract out the super block clean/dirty state
@ 2009-06-05 13:05 Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 01/17] VFS: introduce helpers for manipulation s_dirty flag Artem Bityutskiy
                   ` (16 more replies)
  0 siblings, 17 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-kernel, linux-fsdevel, Christoph Hellwig

Hi,

here is an updated sent of trivial patches which abstract out the super block
clean/dirty state. This is the same as v2, but it has 'sb_is_dirty()' renamed
to 'is_sb_dirty()'. The v2 patches were here:
http://marc.info/?l=linux-kernel&m=124410571830989&w=2

This patchset introduces the following 3 new helper VFS functions:

* static inline void mark_sb_dirty(struct super_block *sb)
* static inline void mark_sb_clean(struct super_block *sb)
* static inline int is_sb_dirty(struct super_block *sb)

With these patches the whole Linux kernel tree has only 3 places where
'sb->s_dirt' is referred.

These patches were previously sent as part of periodic write-back optimization
series here: http://marc.info/?l=linux-kernel&m=124342331127886&w=2

Because of the overlap with Jens' "per-bdi write-back" work, I have to work
on top of Jens' patches. However, it would be easier for me if my preparation
"abstracting sb->s_dirt" patches were merged earlier, at 2.6.31 merge window.
I think they make sense in general. I would then continue working on the second
part separately.

The patches were made on top of the VFS tree:
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6.git for-next

commit f932bb0daca28ffe69ec876043cac00bc9b50147
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Tue May 12 07:37:56 2009 -0400

    Fix nobh_truncate_page() to not pass stack garbage to get_block()

And they are also available at
git://git.infradead.org/users/dedekind/misc-2.6.git sb-helpers-v2

Thanks.

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

* [PATCH v2.1 01/17] VFS: introduce helpers for manipulation s_dirty flag
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 02/17] AFFS: do not manipulate s_dirt directly Artem Bityutskiy
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy,
	Al Viro

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

This patch introduces 3 new VFS helpers: 'mark_sb_dirty()',
'mark_sb_clean()', and 'is_sb_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>
Cc: Al Viro <viro@zeniv.linux.org.uk>
---
 include/linux/fs.h |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 73242c3..2d67017 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1782,6 +1782,23 @@ 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);
 
+/*
+ * Note, VFS does not provide any protection for the super block clean/dirty
+ * state. File-systems should take care of this.
+ */
+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 is_sb_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] 21+ messages in thread

* [PATCH v2.1 02/17] AFFS: do not manipulate s_dirt directly
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 01/17] VFS: introduce helpers for manipulation s_dirty flag Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 03/17] BFS: " Artem Bityutskiy
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy,
	Roman Zippel

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
 fs/affs/bitmap.c |    4 ++--
 fs/affs/super.c  |   12 ++++++++----
 2 files changed, 10 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..8c105d5 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -64,9 +64,13 @@ 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 */
+		/* 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 +526,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 (is_sb_dirty(sb))
 			affs_write_super(sb);
 		affs_free_bitmap(sb);
 	} else
-- 
1.6.0.6


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

* [PATCH v2.1 03/17] BFS: do not manipulate s_dirt directly
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 01/17] VFS: introduce helpers for manipulation s_dirty flag Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 02/17] AFFS: do not manipulate s_dirt directly Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 04/17] EXOFS: " Artem Bityutskiy
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy,
	Tigran A. Aivazian

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Tigran A. Aivazian <tigran@aivazian.fsnet.co.uk>
---
 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 (is_sb_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] 21+ messages in thread

* [PATCH v2.1 04/17] EXOFS: do not manipulate s_dirt directly
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
                   ` (2 preceding siblings ...)
  2009-06-05 13:05 ` [PATCH v2.1 03/17] BFS: " Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 05/17] EXT2: " Artem Bityutskiy
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Acked-by: Boaz Harrosh <bharrosh@panasas.com>
---
 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] 21+ messages in thread

* [PATCH v2.1 05/17] EXT2: do not manipulate s_dirt directly
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
                   ` (3 preceding siblings ...)
  2009-06-05 13:05 ` [PATCH v2.1 04/17] EXOFS: " Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 06/17] EXT4: " Artem Bityutskiy
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy,
	linux-ext4

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: linux-ext4@vger.kernel.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 (is_sb_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] 21+ messages in thread

* [PATCH v2.1 06/17] EXT4: do not manipulate s_dirt directly
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
                   ` (4 preceding siblings ...)
  2009-06-05 13:05 ` [PATCH v2.1 05/17] EXT2: " Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 07/17] FAT: " Artem Bityutskiy
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy,
	linux-ext4, Theodore Ts'o

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: linux-ext4@vger.kernel.org
Cc: Theodore Ts'o <tytso@mit.edu>
---
 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 (is_sb_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] 21+ messages in thread

* [PATCH v2.1 07/17] FAT: do not manipulate s_dirt directly
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
                   ` (5 preceding siblings ...)
  2009-06-05 13:05 ` [PATCH v2.1 06/17] EXT4: " Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 08/17] HFS: " Artem Bityutskiy
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy,
	OGAWA Hirofumi

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---
 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 (is_sb_dirty(sb))
 		fat_write_super(sb);
 
 	if (sbi->nls_disk) {
-- 
1.6.0.6


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

* [PATCH v2.1 08/17] HFS: do not manipulate s_dirt directly
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
                   ` (6 preceding siblings ...)
  2009-06-05 13:05 ` [PATCH v2.1 07/17] FAT: " Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 09/17] HFSPLUS: " Artem Bityutskiy
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy,
	Roman Zippel

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Roman Zippel <zippel@linux-m68k.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 (is_sb_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] 21+ messages in thread

* [PATCH v2.1 09/17] HFSPLUS: do not manipulate s_dirt directly
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
                   ` (7 preceding siblings ...)
  2009-06-05 13:05 ` [PATCH v2.1 08/17] HFS: " Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 10/17] JFFS2: " Artem Bityutskiy
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
 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 (is_sb_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] 21+ messages in thread

* [PATCH v2.1 10/17] JFFS2: do not manipulate s_dirt directly
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
                   ` (8 preceding siblings ...)
  2009-06-05 13:05 ` [PATCH v2.1 09/17] HFSPLUS: " Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  2009-06-06  7:25   ` David Woodhouse
  2009-06-05 13:05 ` [PATCH v2.1 11/17] NILFS: " Artem Bityutskiy
                   ` (6 subsequent siblings)
  16 siblings, 1 reply; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy,
	David Woodhouse, linux-mtd

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.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 (is_sb_dirty(sb))
 		jffs2_write_super(sb);
 
 	mutex_lock(&c->alloc_sem);
-- 
1.6.0.6


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

* [PATCH v2.1 11/17] NILFS: do not manipulate s_dirt directly
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
                   ` (9 preceding siblings ...)
  2009-06-05 13:05 ` [PATCH v2.1 10/17] JFFS2: " Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  2009-06-05 12:04   ` Ryusuke Konishi
  2009-06-05 13:05 ` [PATCH v2.1 12/17] reiserfs: " Artem Bityutskiy
                   ` (5 subsequent siblings)
  16 siblings, 1 reply; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy,
	users, KONISHI Ryusuke

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: users@nilfs.org
Cc: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp>
---
 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 (is_sb_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] 21+ messages in thread

* [PATCH v2.1 12/17] reiserfs: do not manipulate s_dirt directly
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
                   ` (10 preceding siblings ...)
  2009-06-05 13:05 ` [PATCH v2.1 11/17] NILFS: " Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 13/17] SYSV: " Artem Bityutskiy
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy,
	reiserfs-devel

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: reiserfs-devel@vger.kernel.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 is_sb_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 (is_sb_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] 21+ messages in thread

* [PATCH v2.1 13/17] SYSV: do not manipulate s_dirt directly
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
                   ` (11 preceding siblings ...)
  2009-06-05 13:05 ` [PATCH v2.1 12/17] reiserfs: " Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 14/17] UDF: " Artem Bityutskiy
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

... 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 (is_sb_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] 21+ messages in thread

* [PATCH v2.1 14/17] UDF: do not manipulate s_dirt directly
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
                   ` (12 preceding siblings ...)
  2009-06-05 13:05 ` [PATCH v2.1 13/17] SYSV: " Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 15/17] UFS: " Artem Bityutskiy
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Jan Kara <jack@suse.cz>
---
 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] 21+ messages in thread

* [PATCH v2.1 15/17] UFS: do not manipulate s_dirt directly
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
                   ` (13 preceding siblings ...)
  2009-06-05 13:05 ` [PATCH v2.1 14/17] UDF: " Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 16/17] XFS: " Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 17/17] VFS: use is_sb_dirty helper Artem Bityutskiy
  16 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy,
	Evgeniy Dushistov

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Evgeniy Dushistov <dushistov@mail.ru>
---
 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 (is_sb_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] 21+ messages in thread

* [PATCH v2.1 16/17] XFS: do not manipulate s_dirt directly
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
                   ` (14 preceding siblings ...)
  2009-06-05 13:05 ` [PATCH v2.1 15/17] UFS: " Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  2009-06-05 13:05 ` [PATCH v2.1 17/17] VFS: use is_sb_dirty helper Artem Bityutskiy
  16 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy,
	xfs-masters

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

... use new VFS helpers instead.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Acked-by: Felix Blyakher <felixb@sgi.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: xfs-masters@oss.sgi.com
---
 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] 21+ messages in thread

* [PATCH v2.1 17/17] VFS: use is_sb_dirty helper
  2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
                   ` (15 preceding siblings ...)
  2009-06-05 13:05 ` [PATCH v2.1 16/17] XFS: " Artem Bityutskiy
@ 2009-06-05 13:05 ` Artem Bityutskiy
  16 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-05 13:05 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Artem Bityutskiy,
	Al Viro

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

... 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>
Cc: Al Viro <viro@zeniv.linux.org.uk>
---
 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 && is_sb_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 && is_sb_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 (is_sb_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 (is_sb_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] 21+ messages in thread

* Re: [PATCH v2.1 10/17] JFFS2: do not manipulate s_dirt directly
  2009-06-05 13:05 ` [PATCH v2.1 10/17] JFFS2: " Artem Bityutskiy
@ 2009-06-06  7:25   ` David Woodhouse
  2009-06-07  9:21     ` Artem Bityutskiy
  0 siblings, 1 reply; 21+ messages in thread
From: David Woodhouse @ 2009-06-06  7:25 UTC (permalink / raw)
  To: Artem Bityutskiy
  Cc: Al Viro, linux-kernel, linux-fsdevel, Christoph Hellwig,
	Artem Bityutskiy, linux-mtd

On Fri, 2009-06-05 at 16:05 +0300, Artem Bityutskiy wrote:
> From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> 
> ... use new VFS helpers instead.
> 
> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: linux-mtd@lists.infradead.org

Presumably this is intended for Al's tree rather than mine? I could
massage it and apply it here, but then someone would just have to
massage it back when they eventually get merged.

Acked-by: David Woodhouse <David.Woodhouse@intel.com>

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


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

* Re: [PATCH v2.1 10/17] JFFS2: do not manipulate s_dirt directly
  2009-06-06  7:25   ` David Woodhouse
@ 2009-06-07  9:21     ` Artem Bityutskiy
  0 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2009-06-07  9:21 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Al Viro, linux-kernel, linux-fsdevel, Christoph Hellwig,
	Artem Bityutskiy, linux-mtd

On Sat, 2009-06-06 at 08:25 +0100, David Woodhouse wrote:
> On Fri, 2009-06-05 at 16:05 +0300, Artem Bityutskiy wrote:
> > From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> > 
> > ... use new VFS helpers instead.
> > 
> > Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> > Cc: David Woodhouse <dwmw2@infradead.org>
> > Cc: linux-mtd@lists.infradead.org
> 
> Presumably this is intended for Al's tree rather than mine? I could
> massage it and apply it here, but then someone would just have to
> massage it back when they eventually get merged.
> 
> Acked-by: David Woodhouse <David.Woodhouse@intel.com>

Thanks. Sure, this is for Al, I've just CCed FS maintainers to show them
the change.

-- 
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] 21+ messages in thread

end of thread, other threads:[~2009-06-07  9:23 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-05 13:05 [PATCH v2.1 00/17] abstract out the super block clean/dirty state Artem Bityutskiy
2009-06-05 13:05 ` [PATCH v2.1 01/17] VFS: introduce helpers for manipulation s_dirty flag Artem Bityutskiy
2009-06-05 13:05 ` [PATCH v2.1 02/17] AFFS: do not manipulate s_dirt directly Artem Bityutskiy
2009-06-05 13:05 ` [PATCH v2.1 03/17] BFS: " Artem Bityutskiy
2009-06-05 13:05 ` [PATCH v2.1 04/17] EXOFS: " Artem Bityutskiy
2009-06-05 13:05 ` [PATCH v2.1 05/17] EXT2: " Artem Bityutskiy
2009-06-05 13:05 ` [PATCH v2.1 06/17] EXT4: " Artem Bityutskiy
2009-06-05 13:05 ` [PATCH v2.1 07/17] FAT: " Artem Bityutskiy
2009-06-05 13:05 ` [PATCH v2.1 08/17] HFS: " Artem Bityutskiy
2009-06-05 13:05 ` [PATCH v2.1 09/17] HFSPLUS: " Artem Bityutskiy
2009-06-05 13:05 ` [PATCH v2.1 10/17] JFFS2: " Artem Bityutskiy
2009-06-06  7:25   ` David Woodhouse
2009-06-07  9:21     ` Artem Bityutskiy
2009-06-05 13:05 ` [PATCH v2.1 11/17] NILFS: " Artem Bityutskiy
2009-06-05 12:04   ` Ryusuke Konishi
2009-06-05 13:05 ` [PATCH v2.1 12/17] reiserfs: " Artem Bityutskiy
2009-06-05 13:05 ` [PATCH v2.1 13/17] SYSV: " Artem Bityutskiy
2009-06-05 13:05 ` [PATCH v2.1 14/17] UDF: " Artem Bityutskiy
2009-06-05 13:05 ` [PATCH v2.1 15/17] UFS: " Artem Bityutskiy
2009-06-05 13:05 ` [PATCH v2.1 16/17] XFS: " Artem Bityutskiy
2009-06-05 13:05 ` [PATCH v2.1 17/17] VFS: use is_sb_dirty helper 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).