Commit 0c1a1566 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Konstantin Komarov

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: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent ab055cf9
...@@ -950,6 +950,7 @@ int ntfs_write_begin(struct file *file, struct address_space *mapping, ...@@ -950,6 +950,7 @@ int ntfs_write_begin(struct file *file, struct address_space *mapping,
int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos, int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos,
u32 len, u32 copied, struct page *page, void *fsdata) u32 len, u32 copied, struct page *page, void *fsdata)
{ {
struct folio *folio = page_folio(page);
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
struct ntfs_inode *ni = ntfs_i(inode); struct ntfs_inode *ni = ntfs_i(inode);
u64 valid = ni->i_valid; u64 valid = ni->i_valid;
...@@ -961,23 +962,23 @@ int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos, ...@@ -961,23 +962,23 @@ int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos,
err = attr_data_write_resident(ni, page); err = attr_data_write_resident(ni, page);
ni_unlock(ni); ni_unlock(ni);
if (!err) { if (!err) {
struct buffer_head *head = folio_buffers(folio);
dirty = true; dirty = true;
/* Clear any buffers in page. */ /* Clear any buffers in folio. */
if (page_has_buffers(page)) { if (head) {
struct buffer_head *head, *bh; struct buffer_head *bh = head;
bh = head = page_buffers(page);
do { do {
clear_buffer_dirty(bh); clear_buffer_dirty(bh);
clear_buffer_mapped(bh); clear_buffer_mapped(bh);
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
} while (head != (bh = bh->b_this_page)); } while (head != (bh = bh->b_this_page));
} }
SetPageUptodate(page); folio_mark_uptodate(folio);
err = copied; err = copied;
} }
unlock_page(page); folio_unlock(folio);
put_page(page); folio_put(folio);
} else { } else {
err = generic_write_end(file, mapping, pos, len, copied, page, err = generic_write_end(file, mapping, pos, len, copied, page,
fsdata); fsdata);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment