mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
ext4: Convert invalidatepage to invalidate_folio
Extensive changes, but fairly mechanical. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Tested-by: Mike Marshall <hubcap@omnibond.com> # orangefs Tested-by: David Howells <dhowells@redhat.com> # afs
This commit is contained in:
@@ -86,7 +86,7 @@ EXPORT_SYMBOL(jbd2_journal_start_commit);
|
||||
EXPORT_SYMBOL(jbd2_journal_force_commit_nested);
|
||||
EXPORT_SYMBOL(jbd2_journal_wipe);
|
||||
EXPORT_SYMBOL(jbd2_journal_blocks_per_page);
|
||||
EXPORT_SYMBOL(jbd2_journal_invalidatepage);
|
||||
EXPORT_SYMBOL(jbd2_journal_invalidate_folio);
|
||||
EXPORT_SYMBOL(jbd2_journal_try_to_free_buffers);
|
||||
EXPORT_SYMBOL(jbd2_journal_force_commit);
|
||||
EXPORT_SYMBOL(jbd2_journal_inode_ranged_write);
|
||||
|
@@ -2219,14 +2219,14 @@ static int __dispose_buffer(struct journal_head *jh, transaction_t *transaction)
|
||||
}
|
||||
|
||||
/*
|
||||
* jbd2_journal_invalidatepage
|
||||
* jbd2_journal_invalidate_folio
|
||||
*
|
||||
* This code is tricky. It has a number of cases to deal with.
|
||||
*
|
||||
* There are two invariants which this code relies on:
|
||||
*
|
||||
* i_size must be updated on disk before we start calling invalidatepage on the
|
||||
* data.
|
||||
* i_size must be updated on disk before we start calling invalidate_folio
|
||||
* on the data.
|
||||
*
|
||||
* This is done in ext3 by defining an ext3_setattr method which
|
||||
* updates i_size before truncate gets going. By maintaining this
|
||||
@@ -2428,9 +2428,9 @@ zap_buffer_unlocked:
|
||||
}
|
||||
|
||||
/**
|
||||
* jbd2_journal_invalidatepage()
|
||||
* jbd2_journal_invalidate_folio()
|
||||
* @journal: journal to use for flush...
|
||||
* @page: page to flush
|
||||
* @folio: folio to flush
|
||||
* @offset: start of the range to invalidate
|
||||
* @length: length of the range to invalidate
|
||||
*
|
||||
@@ -2439,30 +2439,29 @@ zap_buffer_unlocked:
|
||||
* the page is straddling i_size. Caller then has to wait for current commit
|
||||
* and try again.
|
||||
*/
|
||||
int jbd2_journal_invalidatepage(journal_t *journal,
|
||||
struct page *page,
|
||||
unsigned int offset,
|
||||
unsigned int length)
|
||||
int jbd2_journal_invalidate_folio(journal_t *journal, struct folio *folio,
|
||||
size_t offset, size_t length)
|
||||
{
|
||||
struct buffer_head *head, *bh, *next;
|
||||
unsigned int stop = offset + length;
|
||||
unsigned int curr_off = 0;
|
||||
int partial_page = (offset || length < PAGE_SIZE);
|
||||
int partial_page = (offset || length < folio_size(folio));
|
||||
int may_free = 1;
|
||||
int ret = 0;
|
||||
|
||||
if (!PageLocked(page))
|
||||
if (!folio_test_locked(folio))
|
||||
BUG();
|
||||
if (!page_has_buffers(page))
|
||||
head = folio_buffers(folio);
|
||||
if (!head)
|
||||
return 0;
|
||||
|
||||
BUG_ON(stop > PAGE_SIZE || stop < length);
|
||||
BUG_ON(stop > folio_size(folio) || stop < length);
|
||||
|
||||
/* We will potentially be playing with lists other than just the
|
||||
* data lists (especially for journaled data mode), so be
|
||||
* cautious in our locking. */
|
||||
|
||||
head = bh = page_buffers(page);
|
||||
bh = head;
|
||||
do {
|
||||
unsigned int next_off = curr_off + bh->b_size;
|
||||
next = bh->b_this_page;
|
||||
@@ -2485,8 +2484,8 @@ int jbd2_journal_invalidatepage(journal_t *journal,
|
||||
} while (bh != head);
|
||||
|
||||
if (!partial_page) {
|
||||
if (may_free && try_to_free_buffers(page))
|
||||
J_ASSERT(!page_has_buffers(page));
|
||||
if (may_free && try_to_free_buffers(&folio->page))
|
||||
J_ASSERT(!folio_buffers(folio));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user