Skip to contentSkip to conversation

cifs: set ra_pages in backing_dev_info

PATCH In review Jeff Layton 2 participants 3 messages Mar 25, 2011 – Mar 28, 2011 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: set ra_pages in backing_dev_info

Commit 522440ed made cifs set backing_dev_info on the mapping attached to new inodes. This change caused a fairly significant read performance regression, as cifs started doing page-sized reads exclusively.

By virtue of the fact that they're allocated as part of cifs_sb_info by kzalloc, the ra_pages on cifs BDIs get set to 0, which prevents any readahead. This forces the normal read codepaths to use readpage instead of readpages causing a four-fold increase in the number of read calls with the default rsize.

Fix it by setting ra_pages in the BDI to the same value as that in the default_backing_dev_info.

---
 fs/cifs/cifsfs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/cifs/cifsfs.c +1 -0
index 1af2470..fb6a2ad 100644
@@ -131,6 +131,7 @@ cifs_read_super(struct super_block *sb, void *data,
 		kfree(cifs_sb);
 		return rc;
 	}
+	cifs_sb->bdi.ra_pages = default_backing_dev_info.ra_pages;
 
 #ifdef CONFIG_CIFS_DFS_UPCALL
 	/* copy mount params to sb for use in submounts */
Signature · 1 line
1.7.4.1
#2 lore raw
In reply to a message not in the archive
Quoted 25 lines · On Fri, 25 Mar 2011 16:25:57 -0400 Jeff Layton…

Commit 522440ed made cifs set backing_dev_info on the mapping attached to new inodes. This change caused a fairly significant read performance regression, as cifs started doing page-sized reads exclusively.

By virtue of the fact that they're allocated as part of cifs_sb_info by kzalloc, the ra_pages on cifs BDIs get set to 0, which prevents any readahead. This forces the normal read codepaths to use readpage instead of readpages causing a four-fold increase in the number of read calls with the default rsize.

Fix it by setting ra_pages in the BDI to the same value as that in the default_backing_dev_info.

---
 fs/cifs/cifsfs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/cifs/cifsfs.c +0 -0
index 1af2470..fb6a2ad 100644

fs/cifs/cifsfs.c cifs_read_super(struct super_block *sb, void *data, · line 137

Quoted 7 lines
fs/cifs/cifsfs.c +1 -0
@@ -131,6 +131,7 @@ cifs_read_super(struct super_block *sb, void *data,
 		kfree(cifs_sb);
 		return rc;
 	}
+	cifs_sb->bdi.ra_pages = default_backing_dev_info.ra_pages;
 
 #ifdef CONFIG_CIFS_DFS_UPCALL
 	/* copy mount params to sb for use in submounts */

Forgot to mention that this fixes the following kernel.org bug:

    https://bugzilla.kernel.org/show_bug.cgi?id=31662

...look there if you're curious about the gory details...

Signature · 1 line
Jeff Layton <[email protected]>
#3 lore raw
In reply to a message not in the archive

added bug number to the patch description and merged into cifs-2.6.git

Quoted 36 lines · Jeff Layton

Commit 522440ed made cifs set backing_dev_info on the mapping attached to new inodes. This change caused a fairly significant read performance regression, as cifs started doing page-sized reads exclusively.

By virtue of the fact that they're allocated as part of cifs_sb_info by kzalloc, the ra_pages on cifs BDIs get set to 0, which prevents any readahead. This forces the normal read codepaths to use readpage instead of readpages causing a four-fold increase in the number of read calls with the default rsize.

Fix it by setting ra_pages in the BDI to the same value as that in the default_backing_dev_info.

---
 fs/cifs/cifsfs.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
fs/cifs/cifsfs.c +1 -1
index 1af2470..fb6a2ad 100644
@@ -131,6 +131,7 @@ cifs_read_super(struct super_block *sb, void *data,
                kfree(cifs_sb);
                return rc;
        }
+       cifs_sb->bdi.ra_pages = default_backing_dev_info.ra_pages;
 
  #ifdef CONFIG_CIFS_DFS_UPCALL
        /* copy mount params to sb for use in submounts */
--

1.7.4.1

Signature · 3 lines
Thanks,

Steve