]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ceph: improve readahead for file holes
authorYan, Zheng <zyan@redhat.com>
Mon, 7 Sep 2015 07:46:24 +0000 (15:46 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 8 Sep 2015 20:14:30 +0000 (23:14 +0300)
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>
fs/ceph/addr.c

index 98933350331c47d362248a28fd539ad6bec507aa..6471e28e0586b443513fb5261d951d521464359b 100644 (file)
@@ -276,7 +276,7 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)
        for (i = 0; i < num_pages; i++) {
                struct page *page = osd_data->pages[i];
 
-               if (rc < 0)
+               if (rc < 0 && rc != ENOENT)
                        goto unlock;
                if (bytes < (int)PAGE_CACHE_SIZE) {
                        /* zero (remainder of) page */