* Slight inefficiency in fs/buffer.c::__block_prepare_write() ?
@ 2002-06-14 17:27 Oleg Drokin
0 siblings, 0 replies; only message in thread
From: Oleg Drokin @ 2002-06-14 17:27 UTC (permalink / raw)
To: linux-kernel
Hello!
It seems there is slight inefficiency in __block_prepare_write() function
in fs/buffer.c
It seems ennecessary READ request might be scheduled when all useful info
in page was rewritten anyway.
Offending code is this:
if (!buffer_uptodate(bh) &&
(block_start < from || block_end > to)) {
ll_rw_block(READ, 1, &bh);
*wait_bh++=bh;
}
Suppose we have a 4k page with underlying buffer of 4k size (for simplicity)
filled with 500 bytes.
Now if we write 550 bytes to that page right from the start,
READ request would be scheduled, though it is totally pointless.
Such a code exists both in 2.4 and 2.5 kernels.
Am I overlooking something or is patch like below needed?
Bye,
Oleg
===== buffer.c 1.66 vs edited =====
--- 1.66/fs/buffer.c Sun May 12 04:26:20 2002
+++ edited/buffer.c Fri Jun 14 21:16:32 2002
@@ -1591,7 +1591,8 @@
continue;
}
if (!buffer_uptodate(bh) &&
- (block_start < from || block_end > to)) {
+ (block_start < from || block_end > to) &&
+ !(from == block_start && to > inode -> i_size)) {
ll_rw_block(READ, 1, &bh);
*wait_bh++=bh;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-06-14 17:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-14 17:27 Slight inefficiency in fs/buffer.c::__block_prepare_write() ? Oleg Drokin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox