[PATCH] flush new iag from bd_inode's mapping (2 of 2)

[email protected] (Dave Kleikamp) Wed, 15 Dec 2004 10:20:37 -0600 (CST)
Newsgroups gmane.comp.file-systems.jfs.patches
Message-ID <[email protected]>
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/12/07 15:38:26-06:00 [email protected] 
#   JFS: flush new iag from bd_inode's mapping
#   
#   This is a fix to help jfs work with grub.  A new IAG is created in
#   the bd_inode's mapping, but subsequently modified in a different
#   mapping.  We should invalidate the former page to keep grub from
#   using that cached page.  It isn't useful to have it cached anyway,
#   since jfs will never access it again through that mapping.
#   
#   Signed-off-by: Dave Kleikamp <[email protected]>
# 
diff -Nru a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
--- a/fs/jfs/jfs_imap.c	2004-12-15 10:18:41 -06:00
+++ b/fs/jfs/jfs_imap.c	2004-12-15 10:18:41 -06:00
@@ -2604,6 +2604,12 @@
 		for (i = 0; i < SMAPSZ; i++)
 			iagp->inosmap[i] = cpu_to_le32(ONES);
 
+		/*
+		 * Invalidate the page after writing and syncing it.
+		 * After it's initialized, we access it in a different
+		 * address space
+		 */
+		set_bit(META_discard, &mp->flag);
 		flush_metapage(mp);
 
 		/*
diff -Nru a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
--- a/fs/jfs/jfs_metapage.c	2004-12-15 10:18:41 -06:00
+++ b/fs/jfs/jfs_metapage.c	2004-12-15 10:18:41 -06:00
@@ -396,14 +396,6 @@
 
 	jfs_info("__write_metapage: mp = 0x%p", mp);
 
-	if (test_bit(META_discard, &mp->flag)) {
-		/*
-		 * This metadata is no longer valid
-		 */
-		clear_bit(META_dirty, &mp->flag);
-		return;
-	}
-
 	page_index = mp->page->index;
 	page_offset =
 	    (mp->index - (page_index << l2BlocksPerPage)) << l2bsize;
@@ -549,6 +541,7 @@
 				goto again;
 			}
 
+			clear_bit(META_dirty, &mp->flag);
 			set_bit(META_discard, &mp->flag);
 			spin_unlock(&meta_lock);
 		} else {