Skip to content

Commit

Permalink
hfsplus: always use hfsplus_sync_fs to write the volume header
Browse files Browse the repository at this point in the history
Remove opencoded writing of the volume header in hfsplus_fill_super
and hfsplus_put_super and offload it to hfsplus_sync_fs.  In the
put_super case this means we only write the superblock once instead
of twice.

Signed-off-by: Christoph Hellwig <hch@tuxera.com>
  • Loading branch information
Christoph Hellwig authored and Christoph Hellwig committed Nov 23, 2010
1 parent 6d1bbfc commit 3b5ce8a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions fs/hfsplus/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,14 @@ static void hfsplus_put_super(struct super_block *sb)
if (!sb->s_fs_info)
return;

if (sb->s_dirt)
hfsplus_write_super(sb);
if (!(sb->s_flags & MS_RDONLY) && sbi->s_vhdr) {
struct hfsplus_vh *vhdr = sbi->s_vhdr;

vhdr->modify_date = hfsp_now2mt();
vhdr->attributes |= cpu_to_be32(HFSPLUS_VOL_UNMNT);
vhdr->attributes &= cpu_to_be32(~HFSPLUS_VOL_INCNSTNT);
mark_buffer_dirty(sbi->s_vhbh);
sync_dirty_buffer(sbi->s_vhbh);

hfsplus_sync_fs(sb, 1);
}

hfs_btree_close(sbi->cat_tree);
Expand Down Expand Up @@ -447,8 +445,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
be32_add_cpu(&vhdr->write_count, 1);
vhdr->attributes &= cpu_to_be32(~HFSPLUS_VOL_UNMNT);
vhdr->attributes |= cpu_to_be32(HFSPLUS_VOL_INCNSTNT);
mark_buffer_dirty(sbi->s_vhbh);
sync_dirty_buffer(sbi->s_vhbh);
hfsplus_sync_fs(sb, 1);

if (!sbi->hidden_dir) {
mutex_lock(&sbi->vh_mutex);
Expand Down

0 comments on commit 3b5ce8a

Please sign in to comment.