* [PATCH] vfs: simply the code logic
@ 2012-07-21 15:38 zwu.kernel
2012-07-21 16:34 ` Matthew Wilcox
0 siblings, 1 reply; 2+ messages in thread
From: zwu.kernel @ 2012-07-21 15:38 UTC (permalink / raw)
To: viro; +Cc: linux-fsdevel, linux-kernel, Zhi Yong Wu
From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
fs/block_dev.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index c2bbe1f..0f268d3 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -396,10 +396,7 @@ static loff_t block_llseek(struct file *file, loff_t offset, int origin)
goto out;
}
if (offset >= 0 && offset <= size) {
- if (offset != file->f_pos) {
- file->f_pos = offset;
- }
- retval = offset;
+ retval = file->f_pos = offset;
}
out:
mutex_unlock(&bd_inode->i_mutex);
--
1.7.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] vfs: simply the code logic
2012-07-21 15:38 [PATCH] vfs: simply the code logic zwu.kernel
@ 2012-07-21 16:34 ` Matthew Wilcox
0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2012-07-21 16:34 UTC (permalink / raw)
To: zwu.kernel; +Cc: viro, linux-fsdevel, linux-kernel, Zhi Yong Wu
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."
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-07-21 16:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-21 15:38 [PATCH] vfs: simply the code logic zwu.kernel
2012-07-21 16:34 ` Matthew Wilcox
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).