Comment 28 for bug 185878

Revision history for this message
Bela Lubkin (filbo) wrote :

Oh, I should also mention that when I [binary] patched the `grub-probe` binary to skip the BLKFLSBUF ioctls, everything else was _MUCH_ faster. Transcript:

# export TIME="%e real %U user %S sys"
# for what in fs fs_uuid drive device partmap; do
> /usr/bin/time /usr/sbin/grub-probe --device /dev/sda3 --target=$what
> done
ext2
9.19 real 0.00 user 0.15 sys
4f0c55b5-6bc6-40a4-b239-f0918b84d57c
10.89 real 0.00 user 0.21 sys
(hd0,3)
2.05 real 0.00 user 0.02 sys
/dev/sda3
2.18 real 0.00 user 0.01 sys
part_msdos
2.66 real 0.00 user 0.05 sys
# for what in fs fs_uuid drive device partmap; do
> /usr/bin/time /tmp/grub-probe --device /dev/sda3 --target=$what
> done
ext2
0.03 real 0.00 user 0.00 sys
4f0c55b5-6bc6-40a4-b239-f0918b84d57c
0.00 real 0.00 user 0.00 sys
(hd0,3)
0.00 real 0.00 user 0.00 sys
/dev/sda3
0.00 real 0.00 user 0.00 sys
part_msdos
0.00 real 0.00 user 0.00 sys
# mount | grep sda3
/dev/sda3 on / type ext4 (rw,errors=remount-ro)
# diff -up <(objdump -d /usr/sbin/grub-probe) <(objdump -d /tmp/grub-probe)
--- /dev/fd/63 2009-12-11 14:21:05.687644648 -0800
+++ /dev/fd/62 2009-12-11 14:21:05.696688380 -0800
@@ -1,5 +1,5 @@

-/usr/sbin/grub-probe: file format elf64-x86-64
+/tmp/grub-probe: file format elf64-x86-64

 Disassembly of section .init:
@@ -1480,7 +1480,7 @@ Disassembly of section .text:
   402807: 0f 88 5e 02 00 00 js 402a6b <fflush@plt+0x13c3>
   40280d: 31 d2 xor %edx,%edx
   40280f: 89 c7 mov %eax,%edi
- 402811: be 61 12 00 00 mov $0x1261,%esi
+ 402811: be 5e 12 00 00 mov $0x125e,%esi
   402816: 31 c0 xor %eax,%eax
   402818: e8 8b eb ff ff callq 4013a8 <ioctl@plt>
   40281d: 85 db test %ebx,%ebx

# grep x12.9[47] /usr/src/linux-headers-`uname -r`/include/linux/fs.h
#define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */
#define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */