Commit 67e6682f authored by Dave Kleikamp's avatar Dave Kleikamp

JFS: Make sure special inode data is written after journal is flushed

This patch makes sure that data that we tried to flush before the journal
was completely written actually gets pushed to disk.

To avoid duplicating code, moved common code to write_special_inodes().
Signed-off-by: default avatarDave Kleikamp <shaggy@linux.vnet.ibm.com>
parent 29a424f2
...@@ -208,6 +208,17 @@ static struct lmStat { ...@@ -208,6 +208,17 @@ static struct lmStat {
} lmStat; } lmStat;
#endif #endif
static void write_special_inodes(struct jfs_log *log,
int (*writer)(struct address_space *))
{
struct jfs_sb_info *sbi;
list_for_each_entry(sbi, &log->sb_list, log_list) {
writer(sbi->ipbmap->i_mapping);
writer(sbi->ipimap->i_mapping);
writer(sbi->direct_inode->i_mapping);
}
}
/* /*
* NAME: lmLog() * NAME: lmLog()
...@@ -935,22 +946,13 @@ static int lmLogSync(struct jfs_log * log, int hard_sync) ...@@ -935,22 +946,13 @@ static int lmLogSync(struct jfs_log * log, int hard_sync)
struct lrd lrd; struct lrd lrd;
int lsn; int lsn;
struct logsyncblk *lp; struct logsyncblk *lp;
struct jfs_sb_info *sbi;
unsigned long flags; unsigned long flags;
/* push dirty metapages out to disk */ /* push dirty metapages out to disk */
if (hard_sync) if (hard_sync)
list_for_each_entry(sbi, &log->sb_list, log_list) { write_special_inodes(log, filemap_fdatawrite);
filemap_fdatawrite(sbi->ipbmap->i_mapping);
filemap_fdatawrite(sbi->ipimap->i_mapping);
filemap_fdatawrite(sbi->direct_inode->i_mapping);
}
else else
list_for_each_entry(sbi, &log->sb_list, log_list) { write_special_inodes(log, filemap_flush);
filemap_flush(sbi->ipbmap->i_mapping);
filemap_flush(sbi->ipimap->i_mapping);
filemap_flush(sbi->direct_inode->i_mapping);
}
/* /*
* forward syncpt * forward syncpt
...@@ -1536,7 +1538,6 @@ void jfs_flush_journal(struct jfs_log *log, int wait) ...@@ -1536,7 +1538,6 @@ void jfs_flush_journal(struct jfs_log *log, int wait)
{ {
int i; int i;
struct tblock *target = NULL; struct tblock *target = NULL;
struct jfs_sb_info *sbi;
/* jfs_write_inode may call us during read-only mount */ /* jfs_write_inode may call us during read-only mount */
if (!log) if (!log)
...@@ -1598,11 +1599,7 @@ void jfs_flush_journal(struct jfs_log *log, int wait) ...@@ -1598,11 +1599,7 @@ void jfs_flush_journal(struct jfs_log *log, int wait)
if (wait < 2) if (wait < 2)
return; return;
list_for_each_entry(sbi, &log->sb_list, log_list) { write_special_inodes(log, filemap_fdatawrite);
filemap_fdatawrite(sbi->ipbmap->i_mapping);
filemap_fdatawrite(sbi->ipimap->i_mapping);
filemap_fdatawrite(sbi->direct_inode->i_mapping);
}
/* /*
* If there was recent activity, we may need to wait * If there was recent activity, we may need to wait
...@@ -1611,6 +1608,7 @@ void jfs_flush_journal(struct jfs_log *log, int wait) ...@@ -1611,6 +1608,7 @@ void jfs_flush_journal(struct jfs_log *log, int wait)
if ((!list_empty(&log->cqueue)) || !list_empty(&log->synclist)) { if ((!list_empty(&log->cqueue)) || !list_empty(&log->synclist)) {
for (i = 0; i < 200; i++) { /* Too much? */ for (i = 0; i < 200; i++) { /* Too much? */
msleep(250); msleep(250);
write_special_inodes(log, filemap_fdatawrite);
if (list_empty(&log->cqueue) && if (list_empty(&log->cqueue) &&
list_empty(&log->synclist)) list_empty(&log->synclist))
break; break;
......
...@@ -68,7 +68,7 @@ int jfs_umount(struct super_block *sb) ...@@ -68,7 +68,7 @@ int jfs_umount(struct super_block *sb)
/* /*
* Wait for outstanding transactions to be written to log: * Wait for outstanding transactions to be written to log:
*/ */
jfs_flush_journal(log, 2); jfs_flush_journal(log, 1);
/* /*
* close fileset inode allocation map (aka fileset inode) * close fileset inode allocation map (aka fileset inode)
...@@ -146,7 +146,7 @@ int jfs_umount_rw(struct super_block *sb) ...@@ -146,7 +146,7 @@ int jfs_umount_rw(struct super_block *sb)
* *
* remove file system from log active file system list. * remove file system from log active file system list.
*/ */
jfs_flush_journal(log, 2); jfs_flush_journal(log, 1);
/* /*
* Make sure all metadata makes it to disk * Make sure all metadata makes it to disk
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment