]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: fix readpages when not all pages are found
authorSage Weil <sage@newdream.net>
Fri, 3 Oct 2008 20:59:49 +0000 (13:59 -0700)
committerSage Weil <sage@newdream.net>
Fri, 3 Oct 2008 21:00:32 +0000 (14:00 -0700)
Adjust the request len, page count when fewer than the desired
number of pages are found.

src/kernel/osd_client.c

index 75a8b05947789df92bdc8de6d3feba348f6cdc89..fbff834a128dad808be2d36f8a2ce94999df2a72 100644 (file)
@@ -743,6 +743,7 @@ int ceph_osdc_readpages(struct ceph_osd_client *osdc,
                        struct list_head *page_list, int num_pages)
 {
        struct ceph_osd_request *req;
+       struct ceph_osd_request_head *reqhead;
        struct page *page;
        pgoff_t next_index;
        int contig_pages;
@@ -779,8 +780,9 @@ int ceph_osdc_readpages(struct ceph_osd_client *osdc,
                goto out;
        len = min((contig_pages << PAGE_CACHE_SHIFT) - (off & ~PAGE_CACHE_MASK),
                  len);
-       dout(10, "readpages contig page extent is %llu~%llu\n", off, len);
-
+       req->r_num_pages = contig_pages;
+       reqhead = req->r_request->front.iov_base;
+       reqhead->length = cpu_to_le64(len);
        dout(10, "readpages final extent is %llu~%llu -> %d pages\n",
             off, len, req->r_num_pages);
        rc = do_sync_request(osdc, req);