diff options
author | Josef Bacik <josef@toxicpanda.com> | 2024-09-30 15:45:09 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2024-10-25 17:05:49 +0200 |
commit | aaa32429da09a9afa0f54a197733d757334ed169 (patch) | |
tree | 151937d09e1f6ca5e683e55523c64d5df5e267bd /fs/fuse | |
parent | virtiofs: use GFP_NOFS when enqueuing request through kworker (diff) | |
download | linux-aaa32429da09a9afa0f54a197733d757334ed169.tar.xz linux-aaa32429da09a9afa0f54a197733d757334ed169.zip |
fuse: use fuse_range_is_writeback() instead of iterating pages
fuse_send_readpages() waits for writeback on each page. This can be
replaced by a single call to fuse_range_is_writeback().
[SzM: split this off from "fuse: convert readahead to use folios"]
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/file.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 1943945c7370..f495ddd9e9ad 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -992,12 +992,17 @@ static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file) static void fuse_readahead(struct readahead_control *rac) { struct inode *inode = rac->mapping->host; + struct fuse_inode *fi = get_fuse_inode(inode); struct fuse_conn *fc = get_fuse_conn(inode); unsigned int i, max_pages, nr_pages = 0; + pgoff_t first = readahead_index(rac); + pgoff_t last = first + readahead_count(rac) - 1; if (fuse_is_bad(inode)) return; + wait_event(fi->page_waitq, !fuse_range_is_writeback(inode, first, last)); + max_pages = min_t(unsigned int, fc->max_pages, fc->max_read / PAGE_SIZE); @@ -1024,8 +1029,6 @@ static void fuse_readahead(struct readahead_control *rac) ap = &ia->ap; nr_pages = __readahead_batch(rac, ap->pages, nr_pages); for (i = 0; i < nr_pages; i++) { - fuse_wait_on_page_writeback(inode, - readahead_index(rac) + i); ap->descs[i].length = PAGE_SIZE; } ap->num_pages = nr_pages; |