Skip to content

Commit 4383868

Browse files
ukernelidryomov
authored andcommitted
ceph: improve readahead for file holes
When readahead encounters file holes, osd reply returns error -ENOENT, finish_read() skips adding pages to the the page cache. So readahead does not work for file holes. The fix is adding zero pages to the page cache when -ENOENT is returned. Signed-off-by: Yan, Zheng <zyan@redhat.com>
1 parent 55b0b31 commit 4383868

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ceph/addr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)
276276
for (i = 0; i < num_pages; i++) {
277277
struct page *page = osd_data->pages[i];
278278

279-
if (rc < 0)
279+
if (rc < 0 && rc != ENOENT)
280280
goto unlock;
281281
if (bytes < (int)PAGE_CACHE_SIZE) {
282282
/* zero (remainder of) page */

0 commit comments

Comments
 (0)