From 28ea4298e380d73203890c0f42de68e9798396d8 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sun, 15 Feb 2009 05:51:19 +0000 Subject: volume_id: abort early on read failures. should help with probing missing fdd's --- util-linux/volume_id/util.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'util-linux/volume_id/util.c') diff --git a/util-linux/volume_id/util.c b/util-linux/volume_id/util.c index 1a1b3f92e..dd75c7ba1 100644 --- a/util-linux/volume_id/util.c +++ b/util-linux/volume_id/util.c @@ -254,9 +254,15 @@ void *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) dbg("requested 0x%x bytes, got 0x%x bytes", (unsigned) len, (unsigned) read_len); err: - /* id->seekbuf_len or id->sbbuf_len is wrong now! Fixing. - * Most likely user will not do any additional - * calls anyway, it's a corrupted fs or something. */ + /* No filesystem can be this tiny. It's most likely + * non-associated loop device, empty drive and so on. + * Flag it, making it possible to short circuit future + * accesses. Rationale: + * users complained of slow blkid due to empty floppy drives. + */ + if (off < 64*1024) + id->error = 1; + /* id->seekbuf_len or id->sbbuf_len is wrong now! Fixing. */ volume_id_free_buffer(id); return NULL; } -- cgit v1.2.3