diff options
author | Sage Weil <sage@newdream.net> | 2011-08-04 08:21:30 -0700 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2011-10-25 16:10:15 -0700 |
commit | 0d66a487c120012f33fbcd6af5cbf0a0cad71557 (patch) | |
tree | be876b3a9a76e59e08165a661166be8507c25d9a /fs/ceph | |
parent | 83817e35cbd9b36db955a22418c9e30324353587 (diff) | |
download | linux-0d66a487c120012f33fbcd6af5cbf0a0cad71557.tar.bz2 |
ceph: implement (optional) max read size
The 'rsize' mount option limits the maximum size of an individual
read(ahead) operation that is sent off to an OSD. This is distinct from
'rasize', which controls the size of the readahead window.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/addr.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 5bb39a50f904..5ffee90d9fb5 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -268,7 +268,7 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg) * start an async read(ahead) operation. return nr_pages we submitted * a read for on success, or negative error code. */ -static int start_read(struct inode *inode, struct list_head *page_list) +static int start_read(struct inode *inode, struct list_head *page_list, int max) { struct ceph_osd_client *osdc = &ceph_inode_to_client(inode)->client->osdc; @@ -292,6 +292,8 @@ static int start_read(struct inode *inode, struct list_head *page_list) break; nr_pages++; next_index++; + if (max && nr_pages == max) + break; } len = nr_pages << PAGE_CACHE_SHIFT; dout("start_read %p nr_pages %d is %lld~%lld\n", inode, nr_pages, @@ -358,11 +360,18 @@ static int ceph_readpages(struct file *file, struct address_space *mapping, struct list_head *page_list, unsigned nr_pages) { struct inode *inode = file->f_dentry->d_inode; + struct ceph_fs_client *fsc = ceph_inode_to_client(inode); int rc = 0; + int max = 0; + + if (fsc->mount_options->rsize >= PAGE_CACHE_SIZE) + max = (fsc->mount_options->rsize + PAGE_CACHE_SIZE - 1) + >> PAGE_SHIFT; - dout("readpages %p file %p nr_pages %d\n", inode, file, nr_pages); + dout("readpages %p file %p nr_pages %d max %d\n", inode, file, nr_pages, + max); while (!list_empty(page_list)) { - rc = start_read(inode, page_list); + rc = start_read(inode, page_list, max); if (rc < 0) goto out; BUG_ON(rc == 0); |