linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: zwu.kernel@gmail.com
Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Subject: Re: [PATCH] vfs: simply the code logic
Date: Sat, 21 Jul 2012 10:34:53 -0600	[thread overview]
Message-ID: <20120721163453.GB31693@parisc-linux.org> (raw)
In-Reply-To: <1342885099-22662-1-git-send-email-zwu.kernel@gmail.com>

On Sat, Jul 21, 2012 at 11:38:19PM +0800, zwu.kernel@gmail.com wrote:
>  	if (offset >= 0 && offset <= size) {
> -		if (offset != file->f_pos) {
> -			file->f_pos = offset;
> -		}
> -		retval = offset;
> +		retval = file->f_pos = offset;
>  	}

But now you're writing to f_pos unconditionally.  That may cause
cacheline bouncing.  NAK.

Plus, you're now using a less-well-known feature of C, so while it's fewer
lines of code, it's not necessarily a simplification.

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

      reply	other threads:[~2012-07-21 16:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-21 15:38 [PATCH] vfs: simply the code logic zwu.kernel
2012-07-21 16:34 ` Matthew Wilcox [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=20120721163453.GB31693@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wuzhy@linux.vnet.ibm.com \
    --cc=zwu.kernel@gmail.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).