aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2011-10-19 15:30:35 -0400
committerJeff Layton <jlayton@redhat.com>2011-10-19 15:30:35 -0400
commit66bfaadc3da74fecb4ba8b03f6b81d5f58b031fa (patch)
tree6f0303db8a60ce0d6044ab5a48fbf6bd391b7bd4 /fs/cifs/connect.c
parent5eba8ab3606621f7e175ae9f521d71f3ac534f82 (diff)
cifs: tune bdi.ra_pages in accordance with the rsize
Tune bdi.ra_pages to be a multiple of the rsize. This prevents the VFS from asking for pages that require small reads to satisfy. Reviewed-and-Tested-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Jeff Layton <jlayton@redhat.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 06dfaacfea5d..f70d87d6ba61 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3182,6 +3182,22 @@ cifs_get_volume_info(char *mount_data, const char *devname)
3182 return volume_info; 3182 return volume_info;
3183} 3183}
3184 3184
3185/* make sure ra_pages is a multiple of rsize */
3186static inline unsigned int
3187cifs_ra_pages(struct cifs_sb_info *cifs_sb)
3188{
3189 unsigned int reads;
3190 unsigned int rsize_pages = cifs_sb->rsize / PAGE_CACHE_SIZE;
3191
3192 if (rsize_pages >= default_backing_dev_info.ra_pages)
3193 return default_backing_dev_info.ra_pages;
3194 else if (rsize_pages == 0)
3195 return rsize_pages;
3196
3197 reads = default_backing_dev_info.ra_pages / rsize_pages;
3198 return reads * rsize_pages;
3199}
3200
3185int 3201int
3186cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info) 3202cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
3187{ 3203{
@@ -3200,8 +3216,6 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
3200 if (rc) 3216 if (rc)
3201 return rc; 3217 return rc;
3202 3218
3203 cifs_sb->bdi.ra_pages = default_backing_dev_info.ra_pages;
3204
3205#ifdef CONFIG_CIFS_DFS_UPCALL 3219#ifdef CONFIG_CIFS_DFS_UPCALL
3206try_mount_again: 3220try_mount_again:
3207 /* cleanup activities if we're chasing a referral */ 3221 /* cleanup activities if we're chasing a referral */
@@ -3269,6 +3283,9 @@ try_mount_again:
3269 cifs_sb->wsize = cifs_negotiate_wsize(tcon, volume_info); 3283 cifs_sb->wsize = cifs_negotiate_wsize(tcon, volume_info);
3270 cifs_sb->rsize = cifs_negotiate_rsize(tcon, volume_info); 3284 cifs_sb->rsize = cifs_negotiate_rsize(tcon, volume_info);
3271 3285
3286 /* tune readahead according to rsize */
3287 cifs_sb->bdi.ra_pages = cifs_ra_pages(cifs_sb);
3288
3272remote_path_check: 3289remote_path_check:
3273#ifdef CONFIG_CIFS_DFS_UPCALL 3290#ifdef CONFIG_CIFS_DFS_UPCALL
3274 /* 3291 /*