Skip to content

Commit 0c1a156

Browse files
Matthew Wilcox (Oracle)aalexandrovich
authored andcommitted
ntfs3: Convert ntfs_write_end() to work on a folio
Convert the passed page back into a folio and use the folio APIs, saving a few hidden calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Konstantin Komarov <[email protected]>
1 parent ab055cf commit 0c1a156

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

fs/ntfs3/inode.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,7 @@ int ntfs_write_begin(struct file *file, struct address_space *mapping,
950950
int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos,
951951
u32 len, u32 copied, struct page *page, void *fsdata)
952952
{
953+
struct folio *folio = page_folio(page);
953954
struct inode *inode = mapping->host;
954955
struct ntfs_inode *ni = ntfs_i(inode);
955956
u64 valid = ni->i_valid;
@@ -961,23 +962,23 @@ int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos,
961962
err = attr_data_write_resident(ni, page);
962963
ni_unlock(ni);
963964
if (!err) {
965+
struct buffer_head *head = folio_buffers(folio);
964966
dirty = true;
965-
/* Clear any buffers in page. */
966-
if (page_has_buffers(page)) {
967-
struct buffer_head *head, *bh;
967+
/* Clear any buffers in folio. */
968+
if (head) {
969+
struct buffer_head *bh = head;
968970

969-
bh = head = page_buffers(page);
970971
do {
971972
clear_buffer_dirty(bh);
972973
clear_buffer_mapped(bh);
973974
set_buffer_uptodate(bh);
974975
} while (head != (bh = bh->b_this_page));
975976
}
976-
SetPageUptodate(page);
977+
folio_mark_uptodate(folio);
977978
err = copied;
978979
}
979-
unlock_page(page);
980-
put_page(page);
980+
folio_unlock(folio);
981+
folio_put(folio);
981982
} else {
982983
err = generic_write_end(file, mapping, pos, len, copied, page,
983984
fsdata);

0 commit comments

Comments
 (0)