Skip to content

Commit 02cb8bb

Browse files
committed
Suuport volumes with the 0x80 incompatible feature
The official newfs_apfs now sets a 0x80 incompatible feature in all volumes by default. The feature is undocumented as far as I know, but after some testing it would seem that its effect is to set a flag in preallocated extents. I can't imagine why such a feature would be incompatible instead of read-only compatible, so there is a chance that I'm missing something important, but for now enable support and let's see if anything breaks. By the way, no real changes are needed here because we don't preallocate extents ourselves, and we put existing preallocated extents through the same CoW as all the others. The only problem remaining is that writes after the end of a file will not flip the "preallocation" flags that may be set in previous blocks, but neither the official fsck nor the driver seem to care about this. I just don't get what this flag is for, which is a little scary of course. Signed-off-by: Ernesto A. Fernández <[email protected]>
1 parent 6e7371a commit 02cb8bb

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

super.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,10 +1299,6 @@ static int apfs_check_vol_features(struct super_block *sb)
12991299
apfs_warn(sb, "PFK is not supported");
13001300
return -EINVAL;
13011301
}
1302-
if (features & APFS_INCOMPAT_EXTENT_PREALLOC_FLAG) {
1303-
apfs_warn(sb, "extent prealloc flag is not supported");
1304-
return -EINVAL;
1305-
}
13061302
if (features & APFS_INCOMPAT_SECONDARY_FSROOT) {
13071303
apfs_warn(sb, "secondary fsroot is not supported");
13081304
return -EINVAL;
@@ -1314,6 +1310,16 @@ static int apfs_check_vol_features(struct super_block *sb)
13141310
}
13151311
apfs_info(sb, "volume is sealed");
13161312
}
1313+
/*
1314+
* As far as I can see, all this feature seems to do is define a new
1315+
* flag (which I call APFS_FILE_EXTENT_PREALLOCATED) for extents that
1316+
* are fully after the end of their file. I don't get why this change
1317+
* is incompatible instead of read-only compatible, so I fear I might
1318+
* be missing something. I will never be certain though, so for now
1319+
* allow the mount and hope for the best.
1320+
*/
1321+
if (features & APFS_INCOMPAT_EXTENT_PREALLOC_FLAG)
1322+
apfs_warn(sb, "extent prealloc flag is set");
13171323

13181324
features = le64_to_cpu(vsb_raw->apfs_fs_flags);
13191325
/* Some encrypted volumes are readable anyway */

0 commit comments

Comments
 (0)