diff options
author | NeilBrown <neilb@suse.de> | 2006-03-26 04:37:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-26 11:56:55 -0500 |
commit | 2ff28e22bdb8727fbc7d7889807bc5a73aae56c5 (patch) | |
tree | f7418aa963d729bf9fe8bd44d6c9b6e424a6c6bf | |
parent | 3978d7179d3849848df8a37dd0a5acc20bcb8750 (diff) |
[PATCH] Make address_space_operations->invalidatepage return void
The return value of this function is never used, so let's be honest and
declare it as void.
Some places where invalidatepage returned 0, I have inserted comments
suggesting a BUG_ON.
[akpm@osdl.org: JBD BUG fix]
[akpm@osdl.org: rework for git-nfs]
[akpm@osdl.org: don't go BUG in block_invalidate_page()]
Signed-off-by: Neil Brown <neilb@suse.de>
Acked-by: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/afs/file.c | 6 | ||||
-rw-r--r-- | fs/buffer.c | 18 | ||||
-rw-r--r-- | fs/ext3/inode.c | 4 | ||||
-rw-r--r-- | fs/jbd/transaction.c | 13 | ||||
-rw-r--r-- | fs/jfs/jfs_metapage.c | 7 | ||||
-rw-r--r-- | fs/nfs/file.c | 3 | ||||
-rw-r--r-- | fs/reiserfs/inode.c | 8 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 4 | ||||
-rw-r--r-- | include/linux/buffer_head.h | 4 | ||||
-rw-r--r-- | include/linux/fs.h | 2 | ||||
-rw-r--r-- | include/linux/jbd.h | 2 |
11 files changed, 33 insertions, 38 deletions
diff --git a/fs/afs/file.c b/fs/afs/file.c index 150b19227922..7bb716887e29 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c | |||
@@ -28,7 +28,7 @@ static int afs_file_release(struct inode *inode, struct file *file); | |||
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | static int afs_file_readpage(struct file *file, struct page *page); | 30 | static int afs_file_readpage(struct file *file, struct page *page); |
31 | static int afs_file_invalidatepage(struct page *page, unsigned long offset); | 31 | static void afs_file_invalidatepage(struct page *page, unsigned long offset); |
32 | static int afs_file_releasepage(struct page *page, gfp_t gfp_flags); | 32 | static int afs_file_releasepage(struct page *page, gfp_t gfp_flags); |
33 | 33 | ||
34 | struct inode_operations afs_file_inode_operations = { | 34 | struct inode_operations afs_file_inode_operations = { |
@@ -212,7 +212,7 @@ int afs_cache_get_page_cookie(struct page *page, | |||
212 | /* | 212 | /* |
213 | * invalidate part or all of a page | 213 | * invalidate part or all of a page |
214 | */ | 214 | */ |
215 | static int afs_file_invalidatepage(struct page *page, unsigned long offset) | 215 | static void afs_file_invalidatepage(struct page *page, unsigned long offset) |
216 | { | 216 | { |
217 | int ret = 1; | 217 | int ret = 1; |
218 | 218 | ||
@@ -238,11 +238,11 @@ static int afs_file_invalidatepage(struct page *page, unsigned long offset) | |||
238 | if (!PageWriteback(page)) | 238 | if (!PageWriteback(page)) |
239 | ret = page->mapping->a_ops->releasepage(page, | 239 | ret = page->mapping->a_ops->releasepage(page, |
240 | 0); | 240 | 0); |
241 | /* possibly should BUG_ON(!ret); - neilb */ | ||
241 | } | 242 | } |
242 | } | 243 | } |
243 | 244 | ||
244 | _leave(" = %d", ret); | 245 | _leave(" = %d", ret); |
245 | return ret; | ||
246 | } /* end afs_file_invalidatepage() */ | 246 | } /* end afs_file_invalidatepage() */ |
247 | 247 | ||
248 | /*****************************************************************************/ | 248 | /*****************************************************************************/ |
diff --git a/fs/buffer.c b/fs/buffer.c index 0b9456fd074f..f25f58096428 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -1593,11 +1593,10 @@ EXPORT_SYMBOL(try_to_release_page); | |||
1593 | * point. Because the caller is about to free (and possibly reuse) those | 1593 | * point. Because the caller is about to free (and possibly reuse) those |
1594 | * blocks on-disk. | 1594 | * blocks on-disk. |
1595 | */ | 1595 | */ |
1596 | int block_invalidatepage(struct page *page, unsigned long offset) | 1596 | void block_invalidatepage(struct page *page, unsigned long offset) |
1597 | { | 1597 | { |
1598 | struct buffer_head *head, *bh, *next; | 1598 | struct buffer_head *head, *bh, *next; |
1599 | unsigned int curr_off = 0; | 1599 | unsigned int curr_off = 0; |
1600 | int ret = 1; | ||
1601 | 1600 | ||
1602 | BUG_ON(!PageLocked(page)); | 1601 | BUG_ON(!PageLocked(page)); |
1603 | if (!page_has_buffers(page)) | 1602 | if (!page_has_buffers(page)) |
@@ -1624,19 +1623,18 @@ int block_invalidatepage(struct page *page, unsigned long offset) | |||
1624 | * so real IO is not possible anymore. | 1623 | * so real IO is not possible anymore. |
1625 | */ | 1624 | */ |
1626 | if (offset == 0) | 1625 | if (offset == 0) |
1627 | ret = try_to_release_page(page, 0); | 1626 | try_to_release_page(page, 0); |
1628 | out: | 1627 | out: |
1629 | return ret; | 1628 | return; |
1630 | } | 1629 | } |
1631 | EXPORT_SYMBOL(block_invalidatepage); | 1630 | EXPORT_SYMBOL(block_invalidatepage); |
1632 | 1631 | ||
1633 | int do_invalidatepage(struct page *page, unsigned long offset) | 1632 | void do_invalidatepage(struct page *page, unsigned long offset) |
1634 | { | 1633 | { |
1635 | int (*invalidatepage)(struct page *, unsigned long); | 1634 | void (*invalidatepage)(struct page *, unsigned long); |
1636 | invalidatepage = page->mapping->a_ops->invalidatepage; | 1635 | invalidatepage = page->mapping->a_ops->invalidatepage ? : |
1637 | if (invalidatepage == NULL) | 1636 | block_invalidatepage; |
1638 | invalidatepage = block_invalidatepage; | 1637 | (*invalidatepage)(page, offset); |
1639 | return (*invalidatepage)(page, offset); | ||
1640 | } | 1638 | } |
1641 | 1639 | ||
1642 | /* | 1640 | /* |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 2c361377e0a5..76e22c9c9c6c 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -1430,7 +1430,7 @@ ext3_readpages(struct file *file, struct address_space *mapping, | |||
1430 | return mpage_readpages(mapping, pages, nr_pages, ext3_get_block); | 1430 | return mpage_readpages(mapping, pages, nr_pages, ext3_get_block); |
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | static int ext3_invalidatepage(struct page *page, unsigned long offset) | 1433 | static void ext3_invalidatepage(struct page *page, unsigned long offset) |
1434 | { | 1434 | { |
1435 | journal_t *journal = EXT3_JOURNAL(page->mapping->host); | 1435 | journal_t *journal = EXT3_JOURNAL(page->mapping->host); |
1436 | 1436 | ||
@@ -1440,7 +1440,7 @@ static int ext3_invalidatepage(struct page *page, unsigned long offset) | |||
1440 | if (offset == 0) | 1440 | if (offset == 0) |
1441 | ClearPageChecked(page); | 1441 | ClearPageChecked(page); |
1442 | 1442 | ||
1443 | return journal_invalidatepage(journal, page, offset); | 1443 | journal_invalidatepage(journal, page, offset); |
1444 | } | 1444 | } |
1445 | 1445 | ||
1446 | static int ext3_releasepage(struct page *page, gfp_t wait) | 1446 | static int ext3_releasepage(struct page *page, gfp_t wait) |
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index ada31fa272e3..c609f5034fcd 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c | |||
@@ -1873,16 +1873,15 @@ zap_buffer_unlocked: | |||
1873 | } | 1873 | } |
1874 | 1874 | ||
1875 | /** | 1875 | /** |
1876 | * int journal_invalidatepage() | 1876 | * void journal_invalidatepage() |
1877 | * @journal: journal to use for flush... | 1877 | * @journal: journal to use for flush... |
1878 | * @page: page to flush | 1878 | * @page: page to flush |
1879 | * @offset: length of page to invalidate. | 1879 | * @offset: length of page to invalidate. |
1880 | * | 1880 | * |
1881 | * Reap page buffers containing data after offset in page. | 1881 | * Reap page buffers containing data after offset in page. |
1882 | * | 1882 | * |
1883 | * Return non-zero if the page's buffers were successfully reaped. | ||
1884 | */ | 1883 | */ |
1885 | int journal_invalidatepage(journal_t *journal, | 1884 | void journal_invalidatepage(journal_t *journal, |
1886 | struct page *page, | 1885 | struct page *page, |
1887 | unsigned long offset) | 1886 | unsigned long offset) |
1888 | { | 1887 | { |
@@ -1893,7 +1892,7 @@ int journal_invalidatepage(journal_t *journal, | |||
1893 | if (!PageLocked(page)) | 1892 | if (!PageLocked(page)) |
1894 | BUG(); | 1893 | BUG(); |
1895 | if (!page_has_buffers(page)) | 1894 | if (!page_has_buffers(page)) |
1896 | return 1; | 1895 | return; |
1897 | 1896 | ||
1898 | /* We will potentially be playing with lists other than just the | 1897 | /* We will potentially be playing with lists other than just the |
1899 | * data lists (especially for journaled data mode), so be | 1898 | * data lists (especially for journaled data mode), so be |
@@ -1916,11 +1915,9 @@ int journal_invalidatepage(journal_t *journal, | |||
1916 | } while (bh != head); | 1915 | } while (bh != head); |
1917 | 1916 | ||
1918 | if (!offset) { | 1917 | if (!offset) { |
1919 | if (!may_free || !try_to_free_buffers(page)) | 1918 | if (may_free && try_to_free_buffers(page)) |
1920 | return 0; | 1919 | J_ASSERT(!page_has_buffers(page)); |
1921 | J_ASSERT(!page_has_buffers(page)); | ||
1922 | } | 1920 | } |
1923 | return 1; | ||
1924 | } | 1921 | } |
1925 | 1922 | ||
1926 | /* | 1923 | /* |
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 5fbaeaadccd3..8508043849f3 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c | |||
@@ -578,14 +578,13 @@ static int metapage_releasepage(struct page *page, gfp_t gfp_mask) | |||
578 | return 0; | 578 | return 0; |
579 | } | 579 | } |
580 | 580 | ||
581 | static int metapage_invalidatepage(struct page *page, unsigned long offset) | 581 | static void metapage_invalidatepage(struct page *page, unsigned long offset) |
582 | { | 582 | { |
583 | BUG_ON(offset); | 583 | BUG_ON(offset); |
584 | 584 | ||
585 | if (PageWriteback(page)) | 585 | BUG_ON(PageWriteback(page)); |
586 | return 0; | ||
587 | 586 | ||
588 | return metapage_releasepage(page, 0); | 587 | metapage_releasepage(page, 0); |
589 | } | 588 | } |
590 | 589 | ||
591 | struct address_space_operations jfs_metapage_aops = { | 590 | struct address_space_operations jfs_metapage_aops = { |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 5263b2864a44..dee49a0cb995 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -318,10 +318,9 @@ static int nfs_commit_write(struct file *file, struct page *page, unsigned offse | |||
318 | return status; | 318 | return status; |
319 | } | 319 | } |
320 | 320 | ||
321 | static int nfs_invalidate_page(struct page *page, unsigned long offset) | 321 | static void nfs_invalidate_page(struct page *page, unsigned long offset) |
322 | { | 322 | { |
323 | /* FIXME: we really should cancel any unstarted writes on this page */ | 323 | /* FIXME: we really should cancel any unstarted writes on this page */ |
324 | return 1; | ||
325 | } | 324 | } |
326 | 325 | ||
327 | static int nfs_release_page(struct page *page, gfp_t gfp) | 326 | static int nfs_release_page(struct page *page, gfp_t gfp) |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index d60f6238c66a..62e18c19b446 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -2793,7 +2793,7 @@ static int invalidatepage_can_drop(struct inode *inode, struct buffer_head *bh) | |||
2793 | } | 2793 | } |
2794 | 2794 | ||
2795 | /* clm -- taken from fs/buffer.c:block_invalidate_page */ | 2795 | /* clm -- taken from fs/buffer.c:block_invalidate_page */ |
2796 | static int reiserfs_invalidatepage(struct page *page, unsigned long offset) | 2796 | static void reiserfs_invalidatepage(struct page *page, unsigned long offset) |
2797 | { | 2797 | { |
2798 | struct buffer_head *head, *bh, *next; | 2798 | struct buffer_head *head, *bh, *next; |
2799 | struct inode *inode = page->mapping->host; | 2799 | struct inode *inode = page->mapping->host; |
@@ -2832,10 +2832,12 @@ static int reiserfs_invalidatepage(struct page *page, unsigned long offset) | |||
2832 | * The get_block cached value has been unconditionally invalidated, | 2832 | * The get_block cached value has been unconditionally invalidated, |
2833 | * so real IO is not possible anymore. | 2833 | * so real IO is not possible anymore. |
2834 | */ | 2834 | */ |
2835 | if (!offset && ret) | 2835 | if (!offset && ret) { |
2836 | ret = try_to_release_page(page, 0); | 2836 | ret = try_to_release_page(page, 0); |
2837 | /* maybe should BUG_ON(!ret); - neilb */ | ||
2838 | } | ||
2837 | out: | 2839 | out: |
2838 | return ret; | 2840 | return; |
2839 | } | 2841 | } |
2840 | 2842 | ||
2841 | static int reiserfs_set_page_dirty(struct page *page) | 2843 | static int reiserfs_set_page_dirty(struct page *page) |
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 97fc056130eb..4f2476f188b0 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
@@ -1442,14 +1442,14 @@ xfs_vm_readpages( | |||
1442 | return mpage_readpages(mapping, pages, nr_pages, xfs_get_block); | 1442 | return mpage_readpages(mapping, pages, nr_pages, xfs_get_block); |
1443 | } | 1443 | } |
1444 | 1444 | ||
1445 | STATIC int | 1445 | STATIC void |
1446 | xfs_vm_invalidatepage( | 1446 | xfs_vm_invalidatepage( |
1447 | struct page *page, | 1447 | struct page *page, |
1448 | unsigned long offset) | 1448 | unsigned long offset) |
1449 | { | 1449 | { |
1450 | xfs_page_trace(XFS_INVALIDPAGE_ENTER, | 1450 | xfs_page_trace(XFS_INVALIDPAGE_ENTER, |
1451 | page->mapping->host, page, offset); | 1451 | page->mapping->host, page, offset); |
1452 | return block_invalidatepage(page, offset); | 1452 | block_invalidatepage(page, offset); |
1453 | } | 1453 | } |
1454 | 1454 | ||
1455 | struct address_space_operations xfs_address_space_operations = { | 1455 | struct address_space_operations xfs_address_space_operations = { |
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 27dd97b3fce9..da917ed096a3 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h | |||
@@ -189,8 +189,8 @@ extern int buffer_heads_over_limit; | |||
189 | * address_spaces. | 189 | * address_spaces. |
190 | */ | 190 | */ |
191 | int try_to_release_page(struct page * page, gfp_t gfp_mask); | 191 | int try_to_release_page(struct page * page, gfp_t gfp_mask); |
192 | int block_invalidatepage(struct page *page, unsigned long offset); | 192 | void block_invalidatepage(struct page *page, unsigned long offset); |
193 | int do_invalidatepage(struct page *page, unsigned long offset); | 193 | void do_invalidatepage(struct page *page, unsigned long offset); |
194 | int block_write_full_page(struct page *page, get_block_t *get_block, | 194 | int block_write_full_page(struct page *page, get_block_t *get_block, |
195 | struct writeback_control *wbc); | 195 | struct writeback_control *wbc); |
196 | int block_read_full_page(struct page*, get_block_t*); | 196 | int block_read_full_page(struct page*, get_block_t*); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 972435d4df5c..9674679525f9 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -369,7 +369,7 @@ struct address_space_operations { | |||
369 | int (*commit_write)(struct file *, struct page *, unsigned, unsigned); | 369 | int (*commit_write)(struct file *, struct page *, unsigned, unsigned); |
370 | /* Unfortunately this kludge is needed for FIBMAP. Don't use it */ | 370 | /* Unfortunately this kludge is needed for FIBMAP. Don't use it */ |
371 | sector_t (*bmap)(struct address_space *, sector_t); | 371 | sector_t (*bmap)(struct address_space *, sector_t); |
372 | int (*invalidatepage) (struct page *, unsigned long); | 372 | void (*invalidatepage) (struct page *, unsigned long); |
373 | int (*releasepage) (struct page *, gfp_t); | 373 | int (*releasepage) (struct page *, gfp_t); |
374 | ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, | 374 | ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, |
375 | loff_t offset, unsigned long nr_segs); | 375 | loff_t offset, unsigned long nr_segs); |
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 4fc7dffd66ef..6a425e370cb3 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h | |||
@@ -895,7 +895,7 @@ extern int journal_dirty_metadata (handle_t *, struct buffer_head *); | |||
895 | extern void journal_release_buffer (handle_t *, struct buffer_head *); | 895 | extern void journal_release_buffer (handle_t *, struct buffer_head *); |
896 | extern int journal_forget (handle_t *, struct buffer_head *); | 896 | extern int journal_forget (handle_t *, struct buffer_head *); |
897 | extern void journal_sync_buffer (struct buffer_head *); | 897 | extern void journal_sync_buffer (struct buffer_head *); |
898 | extern int journal_invalidatepage(journal_t *, | 898 | extern void journal_invalidatepage(journal_t *, |
899 | struct page *, unsigned long); | 899 | struct page *, unsigned long); |
900 | extern int journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); | 900 | extern int journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); |
901 | extern int journal_stop(handle_t *); | 901 | extern int journal_stop(handle_t *); |