]> rtime.felk.cvut.cz Git - linux-imx.git/commit
dio: zero struct dio with kzalloc instead of manually
authorZach Brown <zach.brown@oracle.com>
Tue, 21 Aug 2007 00:12:01 +0000 (17:12 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 21 Aug 2007 05:50:25 +0000 (22:50 -0700)
commit848c4dd5153c7a0de55470ce99a8e13a63b4703f
tree4defb21d98037a96a3a90e83eaf85a10b46f0571
parent38f061c5714265fa8481cc0b7795aa8fe81b45be
dio: zero struct dio with kzalloc instead of manually

This patch uses kzalloc to zero all of struct dio rather than manually
trying to track which fields we rely on being zero.  It passed aio+dio
stress testing and some bug regression testing on ext3.

This patch was introduced by Linus in the conversation that lead up to
Badari's minimal fix to manually zero .map_bh.b_state in commit:

  6a648fa72161d1f6468dabd96c5d3c0db04f598a

It makes the code a bit smaller.  Maybe a couple fewer cachelines to
load, if we're lucky:

   text    data     bss     dec     hex filename
3285925  568506 1304616 5159047  4eb887 vmlinux
3285797  568506 1304616 5158919  4eb807 vmlinux.patched

I was unable to measure a stable difference in the number of cpu cycles
spent in blockdev_direct_IO() when pushing aio+dio 256K reads at
~340MB/s.

So the resulting intent of the patch isn't a performance gain but to
avoid exposing ourselves to the risk of finding another field like
.map_bh.b_state where we rely on zeroing but don't enforce it in the
code.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/direct-io.c