Skip to content

Commit

Permalink
reiserfs: Convert from invalidatepage to invalidate_folio
Browse files Browse the repository at this point in the history
This is a straightforward conversion.

Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
Tested-by: Damien Le Moal <[email protected]>
Acked-by: Damien Le Moal <[email protected]>
Tested-by: Mike Marshall <[email protected]> # orangefs
Tested-by: David Howells <[email protected]> # afs
  • Loading branch information
Matthew Wilcox (Oracle) committed Mar 15, 2022
1 parent 2a40be8 commit d97dfc9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
26 changes: 13 additions & 13 deletions fs/reiserfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -3094,7 +3094,7 @@ void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode)
* decide if this buffer needs to stay around for data logging or ordered
* write purposes
*/
static int invalidatepage_can_drop(struct inode *inode, struct buffer_head *bh)
static int invalidate_folio_can_drop(struct inode *inode, struct buffer_head *bh)
{
int ret = 1;
struct reiserfs_journal *j = SB_JOURNAL(inode->i_sb);
Expand Down Expand Up @@ -3147,26 +3147,26 @@ static int invalidatepage_can_drop(struct inode *inode, struct buffer_head *bh)
return ret;
}

/* clm -- taken from fs/buffer.c:block_invalidate_page */
static void reiserfs_invalidatepage(struct page *page, unsigned int offset,
unsigned int length)
/* clm -- taken from fs/buffer.c:block_invalidate_folio */
static void reiserfs_invalidate_folio(struct folio *folio, size_t offset,
size_t length)
{
struct buffer_head *head, *bh, *next;
struct inode *inode = page->mapping->host;
struct inode *inode = folio->mapping->host;
unsigned int curr_off = 0;
unsigned int stop = offset + length;
int partial_page = (offset || length < PAGE_SIZE);
int partial_page = (offset || length < folio_size(folio));
int ret = 1;

BUG_ON(!PageLocked(page));
BUG_ON(!folio_test_locked(folio));

if (!partial_page)
ClearPageChecked(page);
folio_clear_checked(folio);

if (!page_has_buffers(page))
head = folio_buffers(folio);
if (!head)
goto out;

head = page_buffers(page);
bh = head;
do {
unsigned int next_off = curr_off + bh->b_size;
Expand All @@ -3179,7 +3179,7 @@ static void reiserfs_invalidatepage(struct page *page, unsigned int offset,
* is this block fully invalidated?
*/
if (offset <= curr_off) {
if (invalidatepage_can_drop(inode, bh))
if (invalidate_folio_can_drop(inode, bh))
reiserfs_unmap_buffer(bh);
else
ret = 0;
Expand All @@ -3194,7 +3194,7 @@ static void reiserfs_invalidatepage(struct page *page, unsigned int offset,
* so real IO is not possible anymore.
*/
if (!partial_page && ret) {
ret = try_to_release_page(page, 0);
ret = filemap_release_folio(folio, 0);
/* maybe should BUG_ON(!ret); - neilb */
}
out:
Expand Down Expand Up @@ -3430,7 +3430,7 @@ const struct address_space_operations reiserfs_address_space_operations = {
.readpage = reiserfs_readpage,
.readahead = reiserfs_readahead,
.releasepage = reiserfs_releasepage,
.invalidatepage = reiserfs_invalidatepage,
.invalidate_folio = reiserfs_invalidate_folio,
.write_begin = reiserfs_write_begin,
.write_end = reiserfs_write_end,
.bmap = reiserfs_aop_bmap,
Expand Down
4 changes: 2 additions & 2 deletions fs/reiserfs/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,8 +858,8 @@ static int write_ordered_buffers(spinlock_t * lock,
ret = -EIO;
}
/*
* ugly interaction with invalidatepage here.
* reiserfs_invalidate_page will pin any buffer that has a
* ugly interaction with invalidate_folio here.
* reiserfs_invalidate_folio will pin any buffer that has a
* valid journal head from an older transaction. If someone
* else sets our buffer dirty after we write it in the first
* loop, and then someone truncates the page away, nobody
Expand Down

0 comments on commit d97dfc9

Please sign in to comment.