aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2012-12-25 13:28:54 -0500
committerTheodore Ts'o <tytso@mit.edu>2012-12-25 13:28:54 -0500
commit4520fb3c3690f2643006d85f09ecb74554c10e95 (patch)
tree2355adc52f5d861073e37ed9b4cb8ccc165cd519
parentd7961c7fa4d2e3c3f12be67e21ba8799b5a7238a (diff)
ext4: split off ext4_journalled_invalidatepage()
In data=journal mode we don't need delalloc or DIO handling in invalidatepage and similarly in other modes we don't need the journal handling. So split invalidatepage implementations. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/ext4/inode.c23
-rw-r--r--include/trace/events/ext4.h14
2 files changed, 29 insertions, 8 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index cb1c1ab2720b..12d3fbcff59f 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2880,8 +2880,6 @@ static void ext4_invalidatepage_free_endio(struct page *page, unsigned long offs
2880 2880
2881static void ext4_invalidatepage(struct page *page, unsigned long offset) 2881static void ext4_invalidatepage(struct page *page, unsigned long offset)
2882{ 2882{
2883 journal_t *journal = EXT4_JOURNAL(page->mapping->host);
2884
2885 trace_ext4_invalidatepage(page, offset); 2883 trace_ext4_invalidatepage(page, offset);
2886 2884
2887 /* 2885 /*
@@ -2889,16 +2887,27 @@ static void ext4_invalidatepage(struct page *page, unsigned long offset)
2889 */ 2887 */
2890 if (ext4_should_dioread_nolock(page->mapping->host)) 2888 if (ext4_should_dioread_nolock(page->mapping->host))
2891 ext4_invalidatepage_free_endio(page, offset); 2889 ext4_invalidatepage_free_endio(page, offset);
2890
2891 /* No journalling happens on data buffers when this function is used */
2892 WARN_ON(page_has_buffers(page) && buffer_jbd(page_buffers(page)));
2893
2894 block_invalidatepage(page, offset);
2895}
2896
2897static void ext4_journalled_invalidatepage(struct page *page,
2898 unsigned long offset)
2899{
2900 journal_t *journal = EXT4_JOURNAL(page->mapping->host);
2901
2902 trace_ext4_journalled_invalidatepage(page, offset);
2903
2892 /* 2904 /*
2893 * If it's a full truncate we just forget about the pending dirtying 2905 * If it's a full truncate we just forget about the pending dirtying
2894 */ 2906 */
2895 if (offset == 0) 2907 if (offset == 0)
2896 ClearPageChecked(page); 2908 ClearPageChecked(page);
2897 2909
2898 if (journal) 2910 jbd2_journal_invalidatepage(journal, page, offset);
2899 jbd2_journal_invalidatepage(journal, page, offset);
2900 else
2901 block_invalidatepage(page, offset);
2902} 2911}
2903 2912
2904static int ext4_releasepage(struct page *page, gfp_t wait) 2913static int ext4_releasepage(struct page *page, gfp_t wait)
@@ -3264,7 +3273,7 @@ static const struct address_space_operations ext4_journalled_aops = {
3264 .write_end = ext4_journalled_write_end, 3273 .write_end = ext4_journalled_write_end,
3265 .set_page_dirty = ext4_journalled_set_page_dirty, 3274 .set_page_dirty = ext4_journalled_set_page_dirty,
3266 .bmap = ext4_bmap, 3275 .bmap = ext4_bmap,
3267 .invalidatepage = ext4_invalidatepage, 3276 .invalidatepage = ext4_journalled_invalidatepage,
3268 .releasepage = ext4_releasepage, 3277 .releasepage = ext4_releasepage,
3269 .direct_IO = ext4_direct_IO, 3278 .direct_IO = ext4_direct_IO,
3270 .is_partially_uptodate = block_is_partially_uptodate, 3279 .is_partially_uptodate = block_is_partially_uptodate,
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index f6372b011366..7e8c36bc7082 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -451,7 +451,7 @@ DEFINE_EVENT(ext4__page_op, ext4_releasepage,
451 TP_ARGS(page) 451 TP_ARGS(page)
452); 452);
453 453
454TRACE_EVENT(ext4_invalidatepage, 454DECLARE_EVENT_CLASS(ext4_invalidatepage_op,
455 TP_PROTO(struct page *page, unsigned long offset), 455 TP_PROTO(struct page *page, unsigned long offset),
456 456
457 TP_ARGS(page, offset), 457 TP_ARGS(page, offset),
@@ -477,6 +477,18 @@ TRACE_EVENT(ext4_invalidatepage,
477 (unsigned long) __entry->index, __entry->offset) 477 (unsigned long) __entry->index, __entry->offset)
478); 478);
479 479
480DEFINE_EVENT(ext4_invalidatepage_op, ext4_invalidatepage,
481 TP_PROTO(struct page *page, unsigned long offset),
482
483 TP_ARGS(page, offset)
484);
485
486DEFINE_EVENT(ext4_invalidatepage_op, ext4_journalled_invalidatepage,
487 TP_PROTO(struct page *page, unsigned long offset),
488
489 TP_ARGS(page, offset)
490);
491
480TRACE_EVENT(ext4_discard_blocks, 492TRACE_EVENT(ext4_discard_blocks,
481 TP_PROTO(struct super_block *sb, unsigned long long blk, 493 TP_PROTO(struct super_block *sb, unsigned long long blk,
482 unsigned long long count), 494 unsigned long long count),