All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 5/5] cifs: tune bdi.ra_pages in accordance with the rsize
Date: Tue,  6 Sep 2011 10:27:21 -0400	[thread overview]
Message-ID: <1315319241-21637-6-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1315319241-21637-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

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.

Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 fs/cifs/connect.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 02bc0e2..ca32275 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3156,6 +3156,22 @@ cifs_get_volume_info(char *mount_data, const char *devname)
 	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
 cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
 {
@@ -3174,8 +3190,6 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
 	if (rc)
 		return rc;
 
-	cifs_sb->bdi.ra_pages = default_backing_dev_info.ra_pages;
-
 #ifdef CONFIG_CIFS_DFS_UPCALL
 try_mount_again:
 	/* cleanup activities if we're chasing a referral */
@@ -3243,6 +3257,9 @@ try_mount_again:
 	cifs_sb->wsize = cifs_negotiate_wsize(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:
 #ifdef CONFIG_CIFS_DFS_UPCALL
 	/*
-- 
1.7.6

  parent reply	other threads:[~2011-09-06 14:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-06 14:27 [PATCH 0/5] cifs: allow cifs to do readpages larger and asynchronously (try #5) Jeff Layton
     [not found] ` <1315319241-21637-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-09-06 14:27   ` [PATCH 1/5] cifs: fix protocol definition for READ_RSP Jeff Layton
2011-09-06 14:27   ` [PATCH 2/5] cifs: add cifs_async_readv Jeff Layton
     [not found]     ` <1315319241-21637-3-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-10-11  9:30       ` Pavel Shilovsky
     [not found]         ` <CAKywueRSTX8BT3BJymT+PdCEkVbzCEd+mV=UZa0e3-PZLej7qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-11 10:26           ` Jeff Layton
     [not found]             ` <20111011062617.25376724-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2011-10-11 10:51               ` Pavel Shilovsky
2011-09-06 14:27   ` [PATCH 3/5] cifs: convert cifs_readpages to use async reads Jeff Layton
2011-09-06 14:27   ` [PATCH 4/5] cifs: allow for larger rsize= options and change defaults Jeff Layton
     [not found]     ` <1315319241-21637-5-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-10-11  9:17       ` Pavel Shilovsky
     [not found]         ` <CAKywueTHW1mR1gpO27Kxhxuy++bpMu4R8V=inr4-+gtDWa3ceQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-11 10:20           ` Jeff Layton
2011-09-06 14:27   ` Jeff Layton [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-10-19 13:24 [PATCH 0/5] cifs: allow cifs to do readpages larger and asynchronously (try #7) Jeff Layton
     [not found] ` <1319030695-4115-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-10-19 13:24   ` [PATCH 5/5] cifs: tune bdi.ra_pages in accordance with the rsize Jeff Layton
2011-10-11 12:35 [PATCH 0/5] cifs: allow cifs to do readpages larger and asynchronously (try #6) Jeff Layton
     [not found] ` <1318336527-13648-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-10-11 12:35   ` [PATCH 5/5] cifs: tune bdi.ra_pages in accordance with the rsize Jeff Layton
2011-09-01 21:29 [PATCH 0/5] cifs: allow cifs to do readpages larger and asynchronously (try #4) Jeff Layton
     [not found] ` <1314912588-20435-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-09-01 21:29   ` [PATCH 5/5] cifs: tune bdi.ra_pages in accordance with the rsize Jeff Layton
2011-08-30 14:46 [PATCH 0/5] cifs: allow cifs to do readpages larger and asynchronously (try #3) Jeff Layton
     [not found] ` <1314715574-23431-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-08-30 14:46   ` [PATCH 5/5] cifs: tune bdi.ra_pages in accordance with the rsize Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1315319241-21637-6-git-send-email-jlayton@redhat.com \
    --to=jlayton-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.