diff options
author | Linus Torvalds | 2010-01-19 00:09:21 +0100 |
---|---|---|
committer | Karel Zak | 2010-01-19 00:13:16 +0100 |
commit | a67bb3bff5dc51400294fdfb4c77c0827afd5d14 (patch) | |
tree | 4ac5f1a4272d0d95106634ef0e044eb6bffc787b /shlibs/blkid/src/probe.c | |
parent | libblkid: call read() per FAT root dir entry (diff) | |
download | kernel-qcow2-util-linux-a67bb3bff5dc51400294fdfb4c77c0827afd5d14.tar.gz kernel-qcow2-util-linux-a67bb3bff5dc51400294fdfb4c77c0827afd5d14.tar.xz kernel-qcow2-util-linux-a67bb3bff5dc51400294fdfb4c77c0827afd5d14.zip |
libblkid: disable read-ahead when probing device files
Read-ahead doesn't work very well on device probing, and can hurt a lot
when we do essentially random accesses on very slow devices. So disable it
if possible.
[kzak@redhat.com: - add posix_fadvise() configure test]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/blkid/src/probe.c')
-rw-r--r-- | shlibs/blkid/src/probe.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/shlibs/blkid/src/probe.c b/shlibs/blkid/src/probe.c index 2d3cafec4..b2c96a6b2 100644 --- a/shlibs/blkid/src/probe.c +++ b/shlibs/blkid/src/probe.c @@ -640,6 +640,10 @@ int blkid_probe_set_device(blkid_probe pr, int fd, pr->mode = 0; pr->blkssz = 0; +#if defined(POSIX_FADV_RANDOM) && defined(HAVE_POSIX_FADVISE) + /* Disable read-ahead */ + posix_fadvise(fd, 0, 0, POSIX_FADV_RANDOM); +#endif if (size) pr->size = size; else { |