Skip to content

Commit aaa3242

Browse files
josefbacikMiklos Szeredi
authored andcommitted
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 <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]>
1 parent 86b74eb commit aaa3242

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/fuse/file.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,12 +992,17 @@ static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file)
992992
static void fuse_readahead(struct readahead_control *rac)
993993
{
994994
struct inode *inode = rac->mapping->host;
995+
struct fuse_inode *fi = get_fuse_inode(inode);
995996
struct fuse_conn *fc = get_fuse_conn(inode);
996997
unsigned int i, max_pages, nr_pages = 0;
998+
pgoff_t first = readahead_index(rac);
999+
pgoff_t last = first + readahead_count(rac) - 1;
9971000

9981001
if (fuse_is_bad(inode))
9991002
return;
10001003

1004+
wait_event(fi->page_waitq, !fuse_range_is_writeback(inode, first, last));
1005+
10011006
max_pages = min_t(unsigned int, fc->max_pages,
10021007
fc->max_read / PAGE_SIZE);
10031008

@@ -1024,8 +1029,6 @@ static void fuse_readahead(struct readahead_control *rac)
10241029
ap = &ia->ap;
10251030
nr_pages = __readahead_batch(rac, ap->pages, nr_pages);
10261031
for (i = 0; i < nr_pages; i++) {
1027-
fuse_wait_on_page_writeback(inode,
1028-
readahead_index(rac) + i);
10291032
ap->descs[i].length = PAGE_SIZE;
10301033
}
10311034
ap->num_pages = nr_pages;

0 commit comments

Comments
 (0)