]> git.baikalelectronics.ru Git - kernel.git/commit
block: add one-hit cache for disk partition lookup
authorJens Axboe <jens.axboe@oracle.com>
Fri, 24 Oct 2008 10:52:42 +0000 (12:52 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 29 Dec 2008 07:29:51 +0000 (08:29 +0100)
commit690a3ebc33c3c7dfc79e8af5ac3ea18f71458ba2
treebd96916615d04228cc9492ae198ed5012d5ee86a
parentf093fc1b482187f7e473364df54bd8861496c22d
block: add one-hit cache for disk partition lookup

disk_map_sector_rcu() returns a partition from a sector offset,
which we use for IO statistics on a per-partition basis. The
lookup itself is an O(N) list lookup, where N is the number of
partitions. This actually hurts performance quite a bit, even
on the lower end partitions. On higher numbered partitions,
it can get pretty bad.

Solve this by adding a one-hit cache for partition lookup.
This makes the lookup O(1) for the case where we do most IO to
one partition. Even for mixed partition workloads, amortized cost
is pretty close to O(1) since the natural IO batching makes the
one-hit cache last for lots of IOs.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
block/genhd.c
include/linux/genhd.h