Skip to content

Commit eb84090

Browse files
committed
xfs: revert "xfs: fix rmap key and record comparison functions"
This reverts commit 6ff646b. Your maintainer committed a major braino in the rmap code by adding the attr fork, bmbt, and unwritten extent usage bits into rmap record key comparisons. While XFS uses the usage bits *in the rmap records* for cross-referencing metadata in xfs_scrub and xfs_repair, it only needs the owner and offset information to distinguish between reverse mappings of the same physical extent into the data fork of a file at multiple offsets. The other bits are not important for key comparisons for index lookups, and never have been. Eric Sandeen reports that this causes regressions in generic/299, so undo this patch before it does more damage. Reported-by: Eric Sandeen <sandeen@sandeen.net> Fixes: 6ff646b ("xfs: fix rmap key and record comparison functions") Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
1 parent 883a790 commit eb84090

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

fs/xfs/libxfs/xfs_rmap_btree.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ xfs_rmapbt_key_diff(
243243
else if (y > x)
244244
return -1;
245245

246-
x = be64_to_cpu(kp->rm_offset);
247-
y = xfs_rmap_irec_offset_pack(rec);
246+
x = XFS_RMAP_OFF(be64_to_cpu(kp->rm_offset));
247+
y = rec->rm_offset;
248248
if (x > y)
249249
return 1;
250250
else if (y > x)
@@ -275,8 +275,8 @@ xfs_rmapbt_diff_two_keys(
275275
else if (y > x)
276276
return -1;
277277

278-
x = be64_to_cpu(kp1->rm_offset);
279-
y = be64_to_cpu(kp2->rm_offset);
278+
x = XFS_RMAP_OFF(be64_to_cpu(kp1->rm_offset));
279+
y = XFS_RMAP_OFF(be64_to_cpu(kp2->rm_offset));
280280
if (x > y)
281281
return 1;
282282
else if (y > x)
@@ -390,8 +390,8 @@ xfs_rmapbt_keys_inorder(
390390
return 1;
391391
else if (a > b)
392392
return 0;
393-
a = be64_to_cpu(k1->rmap.rm_offset);
394-
b = be64_to_cpu(k2->rmap.rm_offset);
393+
a = XFS_RMAP_OFF(be64_to_cpu(k1->rmap.rm_offset));
394+
b = XFS_RMAP_OFF(be64_to_cpu(k2->rmap.rm_offset));
395395
if (a <= b)
396396
return 1;
397397
return 0;
@@ -420,8 +420,8 @@ xfs_rmapbt_recs_inorder(
420420
return 1;
421421
else if (a > b)
422422
return 0;
423-
a = be64_to_cpu(r1->rmap.rm_offset);
424-
b = be64_to_cpu(r2->rmap.rm_offset);
423+
a = XFS_RMAP_OFF(be64_to_cpu(r1->rmap.rm_offset));
424+
b = XFS_RMAP_OFF(be64_to_cpu(r2->rmap.rm_offset));
425425
if (a <= b)
426426
return 1;
427427
return 0;

0 commit comments

Comments
 (0)