fs: improve ramfs_truncate speed
During sequential writes into single file, fs layer is consequently
calling ramfs_truncate() function. When file size grows
ramfs_truncate() takes more and more time to complete, due to
interations through all already written data chunks. As an example
loading ~450M image using usb fastboot protocol took over 500s to
complete.

Use ramfs_find_chunk() function to search for last chunk of data in
ramfs_truncate() implementation, which saves a lot of loop
iterations. As a result loading ~450M image using usb fastboot
protocol takes around 25s now.

Tested-by: Maciej Zagrabski <m.zagrabski@grinn-global.com>
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent 5154902 commit 383b9348d7af2ba9caad23c08fd6553d014457a9
@Marcin Niestroj Marcin Niestroj authored on 26 Sep 2018
Sascha Hauer committed on 8 Oct 2018
Showing 1 changed file
View
fs/ramfs.c