ocfs2: add some missing address space callbacks
authorJoel Becker <joel.becker@oracle.com>
Thu, 4 Jan 2007 22:54:41 +0000 (14:54 -0800)
committerMark Fasheh <mark.fasheh@oracle.com>
Wed, 14 Mar 2007 21:37:16 +0000 (14:37 -0700)
Under load, OCFS2 would crash in invalidate_inode_pages2_range() because
invalidate_complete_page2() was unable to invalidate a page.  It would
appear that JBD is holding on to the page.  ext3 has a specific
->releasepage() handler to cover this case.

Steal ext3's ->releasepage(), ->invalidatepage(), and ->migratepage(), as
they appear completely appropriate for OCFS2.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
fs/ocfs2/aops.c

index 93628b02ef5d8899658834e093195e9a702a8693..875c1144381752be4bfa7df83788b104c3b05b7f 100644 (file)
@@ -614,6 +614,27 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
        ocfs2_rw_unlock(inode, 0);
 }
 
+/*
+ * ocfs2_invalidatepage() and ocfs2_releasepage() are shamelessly stolen
+ * from ext3.  PageChecked() bits have been removed as OCFS2 does not
+ * do journalled data.
+ */
+static void ocfs2_invalidatepage(struct page *page, unsigned long offset)
+{
+       journal_t *journal = OCFS2_SB(page->mapping->host->i_sb)->journal->j_journal;
+
+       journal_invalidatepage(journal, page, offset);
+}
+
+static int ocfs2_releasepage(struct page *page, gfp_t wait)
+{
+       journal_t *journal = OCFS2_SB(page->mapping->host->i_sb)->journal->j_journal;
+
+       if (!page_has_buffers(page))
+               return 0;
+       return journal_try_to_free_buffers(journal, page, wait);
+}
+
 static ssize_t ocfs2_direct_IO(int rw,
                               struct kiocb *iocb,
                               const struct iovec *iov,
@@ -661,5 +682,8 @@ const struct address_space_operations ocfs2_aops = {
        .commit_write   = ocfs2_commit_write,
        .bmap           = ocfs2_bmap,
        .sync_page      = block_sync_page,
-       .direct_IO      = ocfs2_direct_IO
+       .direct_IO      = ocfs2_direct_IO,
+       .invalidatepage = ocfs2_invalidatepage,
+       .releasepage    = ocfs2_releasepage,
+       .migratepage    = buffer_migrate_page,
 };