mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 21:21:41 +00:00
ntfs3: Convert attr_data_write_resident to use a folio
Now that both callers of attr_data_write_resident() have a folio, pass it in and use memcpy_from_folio() to handle all the gnarly highmem multi-page problems. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
parent
0c1a156644
commit
d0c3df6277
@ -1266,7 +1266,7 @@ int attr_data_read_resident(struct ntfs_inode *ni, struct folio *folio)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int attr_data_write_resident(struct ntfs_inode *ni, struct page *page)
|
||||
int attr_data_write_resident(struct ntfs_inode *ni, struct folio *folio)
|
||||
{
|
||||
u64 vbo;
|
||||
struct mft_inode *mi;
|
||||
@ -1282,17 +1282,13 @@ int attr_data_write_resident(struct ntfs_inode *ni, struct page *page)
|
||||
return E_NTFS_NONRESIDENT;
|
||||
}
|
||||
|
||||
vbo = page->index << PAGE_SHIFT;
|
||||
vbo = folio->index << PAGE_SHIFT;
|
||||
data_size = le32_to_cpu(attr->res.data_size);
|
||||
if (vbo < data_size) {
|
||||
char *data = resident_data(attr);
|
||||
char *kaddr = kmap_atomic(page);
|
||||
u32 use = data_size - vbo;
|
||||
size_t len = min(data_size - vbo, folio_size(folio));
|
||||
|
||||
if (use > PAGE_SIZE)
|
||||
use = PAGE_SIZE;
|
||||
memcpy(data + vbo, kaddr, use);
|
||||
kunmap_atomic(kaddr);
|
||||
memcpy_from_folio(data + vbo, folio, 0, len);
|
||||
mi->dirty = true;
|
||||
}
|
||||
ni->i_valid = data_size;
|
||||
|
@ -871,7 +871,7 @@ static int ntfs_resident_writepage(struct folio *folio,
|
||||
return -EIO;
|
||||
|
||||
ni_lock(ni);
|
||||
ret = attr_data_write_resident(ni, &folio->page);
|
||||
ret = attr_data_write_resident(ni, folio);
|
||||
ni_unlock(ni);
|
||||
|
||||
if (ret != E_NTFS_NONRESIDENT)
|
||||
@ -959,7 +959,7 @@ int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos,
|
||||
|
||||
if (is_resident(ni)) {
|
||||
ni_lock(ni);
|
||||
err = attr_data_write_resident(ni, page);
|
||||
err = attr_data_write_resident(ni, folio);
|
||||
ni_unlock(ni);
|
||||
if (!err) {
|
||||
struct buffer_head *head = folio_buffers(folio);
|
||||
|
@ -435,7 +435,7 @@ int attr_set_size(struct ntfs_inode *ni, enum ATTR_TYPE type,
|
||||
int attr_data_get_block(struct ntfs_inode *ni, CLST vcn, CLST clen, CLST *lcn,
|
||||
CLST *len, bool *new, bool zero);
|
||||
int attr_data_read_resident(struct ntfs_inode *ni, struct folio *folio);
|
||||
int attr_data_write_resident(struct ntfs_inode *ni, struct page *page);
|
||||
int attr_data_write_resident(struct ntfs_inode *ni, struct folio *folio);
|
||||
int attr_load_runs_vcn(struct ntfs_inode *ni, enum ATTR_TYPE type,
|
||||
const __le16 *name, u8 name_len, struct runs_tree *run,
|
||||
CLST vcn);
|
||||
|
Loading…
Reference in New Issue
Block a user