cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] seq_file: Use larger buffer to reduce time traversing lists
Date: Fri, 01 Jun 2012 08:54:56 -0700	[thread overview]
Message-ID: <1338566096.16842.6.camel@joe2Laptop> (raw)
In-Reply-To: <1338547193.2708.16.camel@menhir>

On Fri, 2012-06-01 at 11:39 +0100, Steven Whitehouse wrote:
> I've just been taking a look at the seq_read() code,
[]

nice improvement.  trivial style comment:

> diff --git a/fs/seq_file.c b/fs/seq_file.c
[]
> @@ -169,6 +171,16 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
>  	 */
>  	m->version = file->f_version;
>  
> +	if ((m->size < bsize) || !m->buf) {
> +		kfree(m->buf);
> +		m->size = 0;
> +		m->buf = kmalloc(m->size = bsize, GFP_KERNEL|__GFP_NOWARN);

You can remove the m->size = 0 line and
can you please add a space around the |?
It's a bit dense and too easy to read it
as a single word.
 
> +		if (!m->buf)
> +			m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL);
> +		if (!m->buf)
> +			goto Enomem;

Mixed case label?

> @@ -277,6 +289,11 @@ Done:
>  		m->read_pos += copied;
>  	}
>  	file->f_version = m->version;
> +	if (m->size > PAGE_SIZE) {
> +		kfree(m->buf);
> +		m->buf = NULL;
> +		m->size = 0;
> +	}
>  	mutex_unlock(&m->lock);
>  	return copied;
>  Enomem:

Oh, it wasn't you.  nevermind...



      parent reply	other threads:[~2012-06-01 15:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-01 10:39 [Cluster-devel] seq_file: Use larger buffer to reduce time traversing lists Steven Whitehouse
     [not found] ` <1338552626.2760.1510.camel@edumazet-glaptop>
2012-06-01 12:24   ` Steven Whitehouse
     [not found]     ` <1338554890.2760.1517.camel@edumazet-glaptop>
2012-06-01 13:14       ` Steven Whitehouse
     [not found]         ` <1338557229.2760.1520.camel@edumazet-glaptop>
2012-06-01 14:18           ` Steven Whitehouse
     [not found]             ` <1338562627.2760.1526.camel@edumazet-glaptop>
2012-06-01 15:28               ` Steven Whitehouse
     [not found]               ` <1338562897.2760.1528.camel@edumazet-glaptop>
     [not found]                 ` <1338563900.2760.1529.camel@edumazet-glaptop>
2012-06-01 15:30                   ` Steven Whitehouse
     [not found]   ` <1338552870.2760.1512.camel@edumazet-glaptop>
2012-06-01 12:26     ` Steven Whitehouse
2012-06-01 15:54 ` Joe Perches [this message]

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=1338566096.16842.6.camel@joe2Laptop \
    --to=joe@perches.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).