grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC] FIEMAP and disk sync issues


From: Vladimir 'φ-coder/phcoder' Serbinenko
Subject: [RFC] FIEMAP and disk sync issues
Date: Fri, 27 Jan 2012 14:28:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20120104 Icedove/8.0

Hello, all. When someone installs using blocklists (discouraged and unreliable), we use GRUB internal fs reader in order to determine core.img blocklists. With Linux we call fsync and an ioctl on partition in order to flush the cache. I also tried adding "sync" which didn't make any difference. Unfortunately it doesn't seem to be good enough on some filesystems e.g. ext2 (ext3 and ext4 seem to work). Does anyone know how to ensure flush of a file AND of all filesystem metadata needed to read it? Alternatively we can ask Linux itself to tell us the blocks the file resides in. There are 2 ioctls for this: FIBMAP and FIEMAP. FIBMAP is unfortunately limited to 32-bit blocks. Most of FS supported by both GRUB and Linux lack FIEMAP. If we exclude the 32-bit fs (which will work fine with FIBMAP as long as it uses the same block size as underlying FS, which seems reasonable but I haven't verified it) (minix1/2/3, reiserfs, hfs, jfs, udf, fat, affs) and read-only filesystems (unsuitable for install) (iso9660, romfs, squash4), the remaining trouble is NTFS and HFS+. So with this approach we'll be unable to install on >2TiB HFS+ or NTFS filesystems. I see following possibilities: - Someone write fiemap support for HFS+ and NTFS. This would be probably the best approach - We find a way to flush disk reliably. This would eliminate the necessity of having different branches for Linux and rest. - Ask Linux devs if they are willing to provide FIBMAP64 since internally 64-bits are used. Another problem with FIBMAP/FIEMAP is that fuse-mounted BFS lacks them altogether. We will need to find some other way of doing BFS install. Also some COW filesystems may supply a somewhat valid blocklist with FIBMAP/FIEMAP but which is unusable to GRUB because of COW nature. So we need an FS-whitelist.
Experiment patch attached.
Any thoughts?

--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko

Attachment: fiemap.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]