]> git.baikalelectronics.ru Git - kernel.git/commit
hpfs: optimize quad buffer loading
authorMikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Tue, 28 Jan 2014 23:11:33 +0000 (00:11 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 3 Feb 2014 00:24:07 +0000 (16:24 -0800)
commitac7b8947c41fcb026da12f4cf4781993ff74f929
tree3ecae7ff3391cfcd628c2d78acee83a78e9de66e
parentbbeeb2e1f1dcdc409fed8eda49fc8d51c6735f81
hpfs: optimize quad buffer loading

HPFS needs to load 4 consecutive 512-byte sectors when accessing the
directory nodes or bitmaps.  We can't switch to 2048-byte block size
because files are allocated in the units of 512-byte sectors.

Previously, the driver would allocate a 2048-byte area using kmalloc,
copy the data from four buffers to this area and eventually copy them
back if they were modified.

In the current implementation of the buffer cache, buffers are allocated
in the pagecache.  That means that 4 consecutive 512-byte buffers are
stored in consecutive areas in the kernel address space.  So, we don't
need to allocate extra memory and copy the content of the buffers there.

This patch optimizes the code to avoid copying the buffers.  It checks
if the four buffers are stored in contiguous memory - if they are not,
it falls back to allocating a 2048-byte area and copying data there.

Signed-off-by: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/hpfs/buffer.c