|
|
f725e3 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
f725e3 |
From: Eric Sandeen <sandeen@sandeen.net>
|
|
|
f725e3 |
Date: Tue, 15 May 2018 14:55:55 -0500
|
|
|
f725e3 |
Subject: [PATCH] xfs: accept filesystem with sparse inodes
|
|
|
f725e3 |
|
|
|
f725e3 |
The sparse inode metadata format became a mkfs.xfs default in
|
|
|
f725e3 |
xfsprogs-4.16.0, and such filesystems are now rejected by grub as
|
|
|
f725e3 |
containing an incompatible feature.
|
|
|
f725e3 |
|
|
|
f725e3 |
In essence, this feature allows xfs to allocate inodes into fragmented
|
|
|
f725e3 |
freespace. (Without this feature, if xfs could not allocate contiguous
|
|
|
f725e3 |
space for 64 new inodes, inode creation would fail.)
|
|
|
f725e3 |
|
|
|
f725e3 |
In practice, the disk format change is restricted to the inode btree,
|
|
|
f725e3 |
which as far as I can tell is not used by grub. If all you're doing
|
|
|
f725e3 |
today is parsing a directory, reading an inode number, and converting
|
|
|
f725e3 |
that inode number to a disk location, then ignoring this feature
|
|
|
f725e3 |
should be fine, so I've added it to XFS_SB_FEAT_INCOMPAT_SUPPORTED
|
|
|
f725e3 |
|
|
|
f725e3 |
I did some brief testing of this patch by hacking up the regression
|
|
|
f725e3 |
tests to completely fragment freespace on the test xfs filesystem, and
|
|
|
f725e3 |
then write a large-ish number of inodes to consume any existing
|
|
|
f725e3 |
contiguous 64-inode chunk. This way any files the grub tests add and
|
|
|
f725e3 |
traverse would be in such a fragmented inode allocation. Tests passed,
|
|
|
f725e3 |
but I'm not sure how to cleanly integrate that into the test harness.
|
|
|
f725e3 |
|
|
|
f725e3 |
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
f725e3 |
---
|
|
|
f725e3 |
grub-core/fs/xfs.c | 16 +++++++++++++++-
|
|
|
f725e3 |
1 file changed, 15 insertions(+), 1 deletion(-)
|
|
|
f725e3 |
|
|
|
f725e3 |
diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
|
|
|
f725e3 |
index 72492915533..852155b1bf3 100644
|
|
|
f725e3 |
--- a/grub-core/fs/xfs.c
|
|
|
f725e3 |
+++ b/grub-core/fs/xfs.c
|
|
|
f725e3 |
@@ -76,8 +76,22 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|
|
f725e3 |
|
|
|
f725e3 |
/* incompat feature flags */
|
|
|
f725e3 |
#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */
|
|
|
f725e3 |
+#define XFS_SB_FEAT_INCOMPAT_SPINODES (1 << 1) /* sparse inode chunks */
|
|
|
f725e3 |
+#define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */
|
|
|
f725e3 |
+
|
|
|
f725e3 |
+/*
|
|
|
f725e3 |
+ * Directory entries with ftype are explicitly handled by grub code.
|
|
|
f725e3 |
+ *
|
|
|
f725e3 |
+ * We do not currently verify metadata UUID, so it is safe to read filesystems
|
|
|
f725e3 |
+ * with the XFS_SB_FEAT_INCOMPAT_META_UUID feature.
|
|
|
f725e3 |
+ *
|
|
|
f725e3 |
+ * We do not currently read the inode btrees, so it is safe to read filesystems
|
|
|
f725e3 |
+ * with the XFS_SB_FEAT_INCOMPAT_SPINODES feature.
|
|
|
f725e3 |
+ */
|
|
|
f725e3 |
#define XFS_SB_FEAT_INCOMPAT_SUPPORTED \
|
|
|
f725e3 |
- (XFS_SB_FEAT_INCOMPAT_FTYPE)
|
|
|
f725e3 |
+ (XFS_SB_FEAT_INCOMPAT_FTYPE | \
|
|
|
f725e3 |
+ XFS_SB_FEAT_INCOMPAT_SPINODES | \
|
|
|
f725e3 |
+ XFS_SB_FEAT_INCOMPAT_META_UUID)
|
|
|
f725e3 |
|
|
|
f725e3 |
struct grub_xfs_sblock
|
|
|
f725e3 |
{
|