Skip to content

Commit ca3ac4b

Browse files
Matthew Wilcox (Oracle)cmaiolino
authored andcommitted
xfs: Use abs_diff instead of XFS_ABSDIFF
We have a central definition for this function since 2023, used by a number of different parts of the kernel. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Carlos Maiolino <cem@kernel.org>
1 parent 9b47d37 commit ca3ac4b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

fs/xfs/libxfs/xfs_alloc.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ struct kmem_cache *xfs_extfree_item_cache;
3333

3434
struct workqueue_struct *xfs_alloc_wq;
3535

36-
#define XFS_ABSDIFF(a,b) (((a) <= (b)) ? ((b) - (a)) : ((a) - (b)))
37-
3836
#define XFSA_FIXUP_BNO_OK 1
3937
#define XFSA_FIXUP_CNT_OK 2
4038

@@ -410,8 +408,8 @@ xfs_alloc_compute_diff(
410408
if (newbno1 != NULLAGBLOCK && newbno2 != NULLAGBLOCK) {
411409
if (newlen1 < newlen2 ||
412410
(newlen1 == newlen2 &&
413-
XFS_ABSDIFF(newbno1, wantbno) >
414-
XFS_ABSDIFF(newbno2, wantbno)))
411+
abs_diff(newbno1, wantbno) >
412+
abs_diff(newbno2, wantbno)))
415413
newbno1 = newbno2;
416414
} else if (newbno2 != NULLAGBLOCK)
417415
newbno1 = newbno2;
@@ -427,7 +425,7 @@ xfs_alloc_compute_diff(
427425
} else
428426
newbno1 = freeend - wantlen;
429427
*newbnop = newbno1;
430-
return newbno1 == NULLAGBLOCK ? 0 : XFS_ABSDIFF(newbno1, wantbno);
428+
return newbno1 == NULLAGBLOCK ? 0 : abs_diff(newbno1, wantbno);
431429
}
432430

433431
/*

0 commit comments

Comments
 (0)