[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] File readahead buffering
From: |
Colin D Bennett |
Subject: |
[PATCH] File readahead buffering |
Date: |
Tue, 22 Jul 2008 08:43:47 -0700 |
This patch speeds up loading a TGA image on my test system from 29
seconds to approximately 1 second.
I noticed that on my 1 GHz test system running from an IDE CompactFlash
drive, loading a certain TGA image in GRUB takes about 29 seconds.
This seems pretty outrageous, so after looking at the code I hacked the
TGA reader code to read the entire TGA image file into memory with a
single grub_file_read() call. This made it much faster. Therefore, I
concluded that the problem was that each of the one- to four-byte
reads done by the TGA reader was causing an actual device read. It
seems that it is the file subsystem's responsibility to do file
buffering, so I implemented it in `kern/file.c'.
It turns out that when booting GRUB from IDE, if file buffering is
used, GRUB hangs right after the "GRUB" message, early in the boot
process. So I added a flag that allows grub_main() to enable buffering
when it is safe to do so. It always worked file from an ISO image
(generated with grub-mkrescue) in VMware and QEMU, but when I actually
installed GRUB to my CompactFlash drive and booted it, it hung after
"GRUB" if file buffering was enabled at the start.
It may be poor style to expose `grub_file_buffering_enabled' as a
global variable in file.h, but after I refactored it as a function, I
wondered whether the overhead of creating a whole new function as a
'setter' was wasteful since it would be called only once. Please
advise if you prefer it as a function, or if there is a better solution.
Regards,
Colin
file-buffering.patch
Description: Text Data
signature.asc
Description: PGP signature
- [PATCH] File readahead buffering,
Colin D Bennett <=
- Re: [PATCH] File readahead buffering, Pavel Roskin, 2008/07/22
- Re: [PATCH] File readahead buffering, Colin D Bennett, 2008/07/22
- Re: [PATCH] File readahead buffering, Bean, 2008/07/22
- Re: [PATCH] File readahead buffering, Javier MartÃn, 2008/07/22
- Re: [PATCH] File readahead buffering, Colin D Bennett, 2008/07/23
- Re: [PATCH] File readahead buffering, Colin D Bennett, 2008/07/23
- Re: [PATCH] File readahead buffering, Bean, 2008/07/24
- Re: [PATCH] File readahead buffering, Colin D Bennett, 2008/07/26