Skip to content

Commit ad43ffd

Browse files
Christoph HellwigAl Viro
authored andcommitted
sysv: 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 7fbc6df commit ad43ffd

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

‎fs/sysv/inode.c‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,13 @@
3131
#include <asm/byteorder.h>
3232
#include "sysv.h"
3333

34-
/* This is only called on sync() and umount(), when s_dirt=1. */
35-
static void sysv_write_super(struct super_block *sb)
34+
static int sysv_sync_fs(struct super_block *sb, int wait)
3635
{
3736
struct sysv_sb_info *sbi = SYSV_SB(sb);
3837
unsigned long time = get_seconds(), old_time;
3938

4039
lock_super(sb);
4140
lock_kernel();
42-
if (sb->s_flags & MS_RDONLY)
43-
goto clean;
4441

4542
/*
4643
* If we are going to write out the super block,
@@ -54,10 +51,19 @@ static void sysv_write_super(struct super_block *sb)
5451
*sbi->s_sb_time = cpu_to_fs32(sbi, time);
5552
mark_buffer_dirty(sbi->s_bh2);
5653
}
57-
clean:
58-
sb->s_dirt = 0;
54+
5955
unlock_kernel();
6056
unlock_super(sb);
57+
58+
return 0;
59+
}
60+
61+
static void sysv_write_super(struct super_block *sb)
62+
{
63+
if (!(sb->s_flags & MS_RDONLY))
64+
sysv_sync_fs(sb, 1);
65+
else
66+
sb->s_dirt = 0;
6167
}
6268

6369
static int sysv_remount(struct super_block *sb, int *flags, char *data)
@@ -345,6 +351,7 @@ const struct super_operations sysv_sops = {
345351
.delete_inode = sysv_delete_inode,
346352
.put_super = sysv_put_super,
347353
.write_super = sysv_write_super,
354+
.sync_fs = sysv_sync_fs,
348355
.remount_fs = sysv_remount,
349356
.statfs = sysv_statfs,
350357
};

0 commit comments

Comments
 (0)