diff options
author | Sage Weil <sage@newdream.net> | 2011-08-04 11:21:30 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2011-10-25 19:10:15 -0400 |
commit | 0d66a487c120012f33fbcd6af5cbf0a0cad71557 (patch) | |
tree | be876b3a9a76e59e08165a661166be8507c25d9a /fs/ceph | |
parent | 83817e35cbd9b36db955a22418c9e30324353587 (diff) |
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) | |||
268 | * start an async read(ahead) operation. return nr_pages we submitted | 268 | * start an async read(ahead) operation. return nr_pages we submitted |
269 | * a read for on success, or negative error code. | 269 | * a read for on success, or negative error code. |
270 | */ | 270 | */ |
271 | static int start_read(struct inode *inode, struct list_head *page_list) | 271 | static int start_read(struct inode *inode, struct list_head *page_list, int max) |
272 | { | 272 | { |
273 | struct ceph_osd_client *osdc = | 273 | struct ceph_osd_client *osdc = |
274 | &ceph_inode_to_client(inode)->client->osdc; | 274 | &ceph_inode_to_client(inode)->client->osdc; |
@@ -292,6 +292,8 @@ static int start_read(struct inode *inode, struct list_head *page_list) | |||
292 | break; | 292 | break; |
293 | nr_pages++; | 293 | nr_pages++; |
294 | next_index++; | 294 | next_index++; |
295 | if (max && nr_pages == max) | ||
296 | break; | ||
295 | } | 297 | } |
296 | len = nr_pages << PAGE_CACHE_SHIFT; | 298 | len = nr_pages << PAGE_CACHE_SHIFT; |
297 | dout("start_read %p nr_pages %d is %lld~%lld\n", inode, nr_pages, | 299 | 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, | |||
358 | struct list_head *page_list, unsigned nr_pages) | 360 | struct list_head *page_list, unsigned nr_pages) |
359 | { | 361 | { |
360 | struct inode *inode = file->f_dentry->d_inode; | 362 | struct inode *inode = file->f_dentry->d_inode; |
363 | struct ceph_fs_client *fsc = ceph_inode_to_client(inode); | ||
361 | int rc = 0; | 364 | int rc = 0; |
365 | int max = 0; | ||
366 | |||
367 | if (fsc->mount_options->rsize >= PAGE_CACHE_SIZE) | ||
368 | max = (fsc->mount_options->rsize + PAGE_CACHE_SIZE - 1) | ||
369 | >> PAGE_SHIFT; | ||
362 | 370 | ||
363 | dout("readpages %p file %p nr_pages %d\n", inode, file, nr_pages); | 371 | dout("readpages %p file %p nr_pages %d max %d\n", inode, file, nr_pages, |
372 | max); | ||
364 | while (!list_empty(page_list)) { | 373 | while (!list_empty(page_list)) { |
365 | rc = start_read(inode, page_list); | 374 | rc = start_read(inode, page_list, max); |
366 | if (rc < 0) | 375 | if (rc < 0) |
367 | goto out; | 376 | goto out; |
368 | BUG_ON(rc == 0); | 377 | BUG_ON(rc == 0); |