Skip to content

Commit 7fbc6df

Browse files
Christoph HellwigAl Viro
authored andcommitted
hfsplus: add ->sync_fs
Add a ->sync_fs method for data integrity syncs, and reimplement ->write_super ontop of it. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 58bc5bb commit 7fbc6df

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

‎fs/hfsplus/super.c‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,14 @@ static void hfsplus_clear_inode(struct inode *inode)
152152
}
153153
}
154154

155-
static void hfsplus_write_super(struct super_block *sb)
155+
static int hfsplus_sync_fs(struct super_block *sb, int wait)
156156
{
157157
struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr;
158158

159159
dprint(DBG_SUPER, "hfsplus_write_super\n");
160160

161161
lock_super(sb);
162162
sb->s_dirt = 0;
163-
if (sb->s_flags & MS_RDONLY)
164-
/* warn? */
165-
goto out;
166163

167164
vhdr->free_blocks = cpu_to_be32(HFSPLUS_SB(sb).free_blocks);
168165
vhdr->next_alloc = cpu_to_be32(HFSPLUS_SB(sb).next_alloc);
@@ -194,8 +191,16 @@ static void hfsplus_write_super(struct super_block *sb)
194191
}
195192
HFSPLUS_SB(sb).flags &= ~HFSPLUS_SB_WRITEBACKUP;
196193
}
197-
out:
198194
unlock_super(sb);
195+
return 0;
196+
}
197+
198+
static void hfsplus_write_super(struct super_block *sb)
199+
{
200+
if (!(sb->s_flags & MS_RDONLY))
201+
hfsplus_sync_fs(sb, 1);
202+
else
203+
sb->s_dirt = 0;
199204
}
200205

201206
static void hfsplus_put_super(struct super_block *sb)
@@ -290,6 +295,7 @@ static const struct super_operations hfsplus_sops = {
290295
.clear_inode = hfsplus_clear_inode,
291296
.put_super = hfsplus_put_super,
292297
.write_super = hfsplus_write_super,
298+
.sync_fs = hfsplus_sync_fs,
293299
.statfs = hfsplus_statfs,
294300
.remount_fs = hfsplus_remount,
295301
.show_options = hfsplus_show_options,

0 commit comments

Comments
 (0)