Re: patch: improve generic_file_buffered_write() (2nd try 2/2)

From: Bernd Schubert
Date: Wed Sep 05 2007 - 13:49:41 EST


I guess when aio was introduced this was probably forgotten. For small chunks
or synchronous i/o the likehood is correct, but for big data chunks and aio
the likehood is false.

Signed-off-by: Bernd Schubert <bs@xxxxxxxxx>
Signed-off-by: Goswin von Brederlow <goswin@xxxxxxxxxxxxxxx>

Index: linux-2.6.20.3/mm/filemap.c
===================================================================
--- linux-2.6.20.3.orig/mm/filemap.c 2007-09-05 18:51:59.000000000 +0200
+++ linux-2.6.20.3/mm/filemap.c 2007-09-05 18:53:12.000000000 +0200
@@ -2100,7 +2100,7 @@
/*
* handle partial DIO write. Adjust cur_iov if needed.
*/
- if (likely(nr_segs == 1))
+ if (nr_segs == 1)
buf = iov->iov_base + written;
else {
filemap_set_next_iovec(&cur_iov, &iov_base, written);
@@ -2167,7 +2167,7 @@
vmtruncate(inode, isize);
}
}
- if (likely(nr_segs == 1))
+ if (nr_segs == 1)
copied = filemap_copy_from_user(page, offset,
buf, bytes);
else
@@ -2213,7 +2213,7 @@
count -= copied;
pos += copied;
buf += copied;
- if (unlikely(nr_segs > 1)) {
+ if (nr_segs > 1) {
filemap_set_next_iovec(&cur_iov,
&iov_base, copied);
if (count)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/