[PATCHv2 4/6] hfs: simplify a bit checking for R/O
From: Artem Bityutskiy
Date: Thu Jul 12 2012 - 10:28:08 EST
From: Artem Bityutskiy <artem.bityutskiy@xxxxxxxxxxxxxxx>
We have the following pattern in 2 places in HFS
if (!RDONLY)
hfs_mdb_commit();
This patch pushes the RDONLY check down to 'hfs_mdb_commit()'. This will
make the following patches a bit simpler.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@xxxxxxxxxxxxxxx>
---
fs/hfs/inode.c | 3 +--
fs/hfs/mdb.c | 3 +++
fs/hfs/super.c | 3 +--
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index daf3d63..629eba4 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -646,8 +646,7 @@ static int hfs_file_fsync(struct file *filp, loff_t start, loff_t end,
sb = inode->i_sb;
if (sb->s_dirt) {
sb->s_dirt = 0;
- if (!(sb->s_flags & MS_RDONLY))
- hfs_mdb_commit(sb);
+ hfs_mdb_commit(sb);
}
/* .. finally sync the buffers to disk */
err = sync_blockdev(sb->s_bdev);
diff --git a/fs/hfs/mdb.c b/fs/hfs/mdb.c
index 7a32240..5fd51a5 100644
--- a/fs/hfs/mdb.c
+++ b/fs/hfs/mdb.c
@@ -260,6 +260,9 @@ void hfs_mdb_commit(struct super_block *sb)
{
struct hfs_mdb *mdb = HFS_SB(sb)->mdb;
+ if (sb->s_flags & MS_RDONLY)
+ return;
+
lock_buffer(HFS_SB(sb)->mdb_bh);
if (test_and_clear_bit(HFS_FLG_MDB_DIRTY, &HFS_SB(sb)->flags)) {
/* These parameters may have been modified, so write them back */
diff --git a/fs/hfs/super.c b/fs/hfs/super.c
index 47e4119..0730135 100644
--- a/fs/hfs/super.c
+++ b/fs/hfs/super.c
@@ -53,8 +53,7 @@ static void hfs_write_super(struct super_block *sb)
sb->s_dirt = 0;
/* sync everything to the buffers */
- if (!(sb->s_flags & MS_RDONLY))
- hfs_mdb_commit(sb);
+ hfs_mdb_commit(sb);
}
static int hfs_sync_fs(struct super_block *sb, int wait)
--
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/