aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDave Kleikamp <shaggy@linux.vnet.ibm.com>2007-10-10 12:11:24 -0400
committerDave Kleikamp <shaggy@linux.vnet.ibm.com>2008-01-03 14:11:37 -0500
commit67e6682f18b3bf812a994ae027ff87174a297ae8 (patch)
tree83be09c8232ecb9f7af9683a1b48f97767f573c5 /fs
parent29a424f28390752a4ca2349633aaacc6be494db5 (diff)
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: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/jfs/jfs_logmgr.c32
-rw-r--r--fs/jfs/jfs_umount.c4
2 files changed, 17 insertions, 19 deletions
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index 15a3974cdeeb..2370716d57ad 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -208,6 +208,17 @@ static struct lmStat {
208} lmStat; 208} lmStat;
209#endif 209#endif
210 210
211static void write_special_inodes(struct jfs_log *log,
212 int (*writer)(struct address_space *))
213{
214 struct jfs_sb_info *sbi;
215
216 list_for_each_entry(sbi, &log->sb_list, log_list) {
217 writer(sbi->ipbmap->i_mapping);
218 writer(sbi->ipimap->i_mapping);
219 writer(sbi->direct_inode->i_mapping);
220 }
221}
211 222
212/* 223/*
213 * NAME: lmLog() 224 * NAME: lmLog()
@@ -935,22 +946,13 @@ static int lmLogSync(struct jfs_log * log, int hard_sync)
935 struct lrd lrd; 946 struct lrd lrd;
936 int lsn; 947 int lsn;
937 struct logsyncblk *lp; 948 struct logsyncblk *lp;
938 struct jfs_sb_info *sbi;
939 unsigned long flags; 949 unsigned long flags;
940 950
941 /* push dirty metapages out to disk */ 951 /* push dirty metapages out to disk */
942 if (hard_sync) 952 if (hard_sync)
943 list_for_each_entry(sbi, &log->sb_list, log_list) { 953 write_special_inodes(log, filemap_fdatawrite);
944 filemap_fdatawrite(sbi->ipbmap->i_mapping);
945 filemap_fdatawrite(sbi->ipimap->i_mapping);
946 filemap_fdatawrite(sbi->direct_inode->i_mapping);
947 }
948 else 954 else
949 list_for_each_entry(sbi, &log->sb_list, log_list) { 955 write_special_inodes(log, filemap_flush);
950 filemap_flush(sbi->ipbmap->i_mapping);
951 filemap_flush(sbi->ipimap->i_mapping);
952 filemap_flush(sbi->direct_inode->i_mapping);
953 }
954 956
955 /* 957 /*
956 * forward syncpt 958 * forward syncpt
@@ -1536,7 +1538,6 @@ void jfs_flush_journal(struct jfs_log *log, int wait)
1536{ 1538{
1537 int i; 1539 int i;
1538 struct tblock *target = NULL; 1540 struct tblock *target = NULL;
1539 struct jfs_sb_info *sbi;
1540 1541
1541 /* jfs_write_inode may call us during read-only mount */ 1542 /* jfs_write_inode may call us during read-only mount */
1542 if (!log) 1543 if (!log)
@@ -1598,11 +1599,7 @@ void jfs_flush_journal(struct jfs_log *log, int wait)
1598 if (wait < 2) 1599 if (wait < 2)
1599 return; 1600 return;
1600 1601
1601 list_for_each_entry(sbi, &log->sb_list, log_list) { 1602 write_special_inodes(log, filemap_fdatawrite);
1602 filemap_fdatawrite(sbi->ipbmap->i_mapping);
1603 filemap_fdatawrite(sbi->ipimap->i_mapping);
1604 filemap_fdatawrite(sbi->direct_inode->i_mapping);
1605 }
1606 1603
1607 /* 1604 /*
1608 * If there was recent activity, we may need to wait 1605 * 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 if ((!list_empty(&log->cqueue)) || !list_empty(&log->synclist)) { 1608 if ((!list_empty(&log->cqueue)) || !list_empty(&log->synclist)) {
1612 for (i = 0; i < 200; i++) { /* Too much? */ 1609 for (i = 0; i < 200; i++) { /* Too much? */
1613 msleep(250); 1610 msleep(250);
1611 write_special_inodes(log, filemap_fdatawrite);
1614 if (list_empty(&log->cqueue) && 1612 if (list_empty(&log->cqueue) &&
1615 list_empty(&log->synclist)) 1613 list_empty(&log->synclist))
1616 break; 1614 break;
diff --git a/fs/jfs/jfs_umount.c b/fs/jfs/jfs_umount.c
index 7971f37534a3..adcf92d3b603 100644
--- a/fs/jfs/jfs_umount.c
+++ b/fs/jfs/jfs_umount.c
@@ -68,7 +68,7 @@ int jfs_umount(struct super_block *sb)
68 /* 68 /*
69 * Wait for outstanding transactions to be written to log: 69 * Wait for outstanding transactions to be written to log:
70 */ 70 */
71 jfs_flush_journal(log, 2); 71 jfs_flush_journal(log, 1);
72 72
73 /* 73 /*
74 * close fileset inode allocation map (aka fileset inode) 74 * close fileset inode allocation map (aka fileset inode)
@@ -146,7 +146,7 @@ int jfs_umount_rw(struct super_block *sb)
146 * 146 *
147 * remove file system from log active file system list. 147 * remove file system from log active file system list.
148 */ 148 */
149 jfs_flush_journal(log, 2); 149 jfs_flush_journal(log, 1);
150 150
151 /* 151 /*
152 * Make sure all metadata makes it to disk 152 * Make sure all metadata makes it to disk