diff options
| author | Joanne Koong <joannelkoong@gmail.com> | 2025-05-12 15:58:33 -0700 |
|---|---|---|
| committer | Miklos Szeredi <mszeredi@redhat.com> | 2025-05-29 12:31:23 +0200 |
| commit | d60a6015e1a2848fc04237bd37ac65b204772313 (patch) | |
| tree | 2a0b7925abd6a6606b07905b630621a6ff476214 /fs/fuse | |
| parent | fuse: refactor fuse_fill_write_pages() (diff) | |
| download | linux-d60a6015e1a2848fc04237bd37ac65b204772313.tar.gz linux-d60a6015e1a2848fc04237bd37ac65b204772313.zip | |
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>
Diffstat (limited to 'fs/fuse')
| -rw-r--r-- | fs/fuse/file.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 6b77daa2fbce..2d9bc484e87a 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -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)) { |
