提交 66bfaadc 编写于 作者: J Jeff Layton

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: NPavel Shilovsky <piastry@etersoft.ru>
Signed-off-by: NJeff Layton <jlayton@redhat.com>
上级 5eba8ab3
...@@ -3182,6 +3182,22 @@ cifs_get_volume_info(char *mount_data, const char *devname) ...@@ -3182,6 +3182,22 @@ cifs_get_volume_info(char *mount_data, const char *devname)
return volume_info; return volume_info;
} }
/* make sure ra_pages is a multiple of rsize */
static inline unsigned int
cifs_ra_pages(struct cifs_sb_info *cifs_sb)
{
unsigned int reads;
unsigned int rsize_pages = cifs_sb->rsize / PAGE_CACHE_SIZE;
if (rsize_pages >= default_backing_dev_info.ra_pages)
return default_backing_dev_info.ra_pages;
else if (rsize_pages == 0)
return rsize_pages;
reads = default_backing_dev_info.ra_pages / rsize_pages;
return reads * rsize_pages;
}
int int
cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info) cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
{ {
...@@ -3200,8 +3216,6 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info) ...@@ -3200,8 +3216,6 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
if (rc) if (rc)
return rc; return rc;
cifs_sb->bdi.ra_pages = default_backing_dev_info.ra_pages;
#ifdef CONFIG_CIFS_DFS_UPCALL #ifdef CONFIG_CIFS_DFS_UPCALL
try_mount_again: try_mount_again:
/* cleanup activities if we're chasing a referral */ /* cleanup activities if we're chasing a referral */
...@@ -3269,6 +3283,9 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info) ...@@ -3269,6 +3283,9 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
cifs_sb->wsize = cifs_negotiate_wsize(tcon, volume_info); cifs_sb->wsize = cifs_negotiate_wsize(tcon, volume_info);
cifs_sb->rsize = cifs_negotiate_rsize(tcon, volume_info); cifs_sb->rsize = cifs_negotiate_rsize(tcon, volume_info);
/* tune readahead according to rsize */
cifs_sb->bdi.ra_pages = cifs_ra_pages(cifs_sb);
remote_path_check: remote_path_check:
#ifdef CONFIG_CIFS_DFS_UPCALL #ifdef CONFIG_CIFS_DFS_UPCALL
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册