mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
fuse: support large folios for writethrough writes
Add support for folios larger than one page size for writethrough writes. Signed-off-by: Joanne Koong <joannelkoong@gmail.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
63c69ad3d1
commit
d60a6015e1
|
|
@ -1146,7 +1146,8 @@ static ssize_t fuse_fill_write_pages(struct fuse_io_args *ia,
|
|||
size_t tmp;
|
||||
struct folio *folio;
|
||||
pgoff_t index = pos >> PAGE_SHIFT;
|
||||
unsigned bytes = min(PAGE_SIZE - offset, num);
|
||||
unsigned int bytes;
|
||||
unsigned int folio_offset;
|
||||
|
||||
again:
|
||||
folio = __filemap_get_folio(mapping, index, FGP_WRITEBEGIN,
|
||||
|
|
@ -1159,7 +1160,10 @@ static ssize_t fuse_fill_write_pages(struct fuse_io_args *ia,
|
|||
if (mapping_writably_mapped(mapping))
|
||||
flush_dcache_folio(folio);
|
||||
|
||||
tmp = copy_folio_from_iter_atomic(folio, offset, bytes, ii);
|
||||
folio_offset = ((index - folio->index) << PAGE_SHIFT) + offset;
|
||||
bytes = min(folio_size(folio) - folio_offset, num);
|
||||
|
||||
tmp = copy_folio_from_iter_atomic(folio, folio_offset, bytes, ii);
|
||||
flush_dcache_folio(folio);
|
||||
|
||||
if (!tmp) {
|
||||
|
|
@ -1179,6 +1183,7 @@ static ssize_t fuse_fill_write_pages(struct fuse_io_args *ia,
|
|||
}
|
||||
|
||||
ap->folios[ap->num_folios] = folio;
|
||||
ap->descs[ap->num_folios].offset = folio_offset;
|
||||
ap->descs[ap->num_folios].length = tmp;
|
||||
ap->num_folios++;
|
||||
|
||||
|
|
@ -1186,11 +1191,11 @@ static ssize_t fuse_fill_write_pages(struct fuse_io_args *ia,
|
|||
pos += tmp;
|
||||
num -= tmp;
|
||||
offset += tmp;
|
||||
if (offset == PAGE_SIZE)
|
||||
if (offset == folio_size(folio))
|
||||
offset = 0;
|
||||
|
||||
/* If we copied full page, mark it uptodate */
|
||||
if (tmp == PAGE_SIZE)
|
||||
/* If we copied full folio, mark it uptodate */
|
||||
if (tmp == folio_size(folio))
|
||||
folio_mark_uptodate(folio);
|
||||
|
||||
if (folio_test_uptodate(folio)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user