Skip to content

Commit 4cb7602

Browse files
author
Darrick J. Wong
committed
xfs: remove unnecessary dstmap in xattr scrubber
Replace bitmap_and with bitmap_intersects in the xattr leaf block scrubber, since we only care if there's overlap between the used space bitmap and the free space bitmap. This means we don't need dstmap any more, and can thus reduce the memory requirements. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com>
1 parent ee366fe commit 4cb7602

2 files changed

Lines changed: 4 additions & 15 deletions

File tree

fs/xfs/scrub/attr.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ xchk_setup_xattr_buf(
3636

3737
/*
3838
* We need enough space to read an xattr value from the file or enough
39-
* space to hold three copies of the xattr free space bitmap. We don't
39+
* space to hold two copies of the xattr free space bitmap. We don't
4040
* need the buffer space for both purposes at the same time.
4141
*/
42-
sz = 3 * sizeof(long) * BITS_TO_LONGS(sc->mp->m_attr_geo->blksize);
42+
sz = 2 * sizeof(long) * BITS_TO_LONGS(sc->mp->m_attr_geo->blksize);
4343
sz = max_t(size_t, sz, value_size);
4444

4545
/*
@@ -223,7 +223,6 @@ xchk_xattr_check_freemap(
223223
struct xfs_attr3_icleaf_hdr *leafhdr)
224224
{
225225
unsigned long *freemap = xchk_xattr_freemap(sc);
226-
unsigned long *dstmap = xchk_xattr_dstmap(sc);
227226
unsigned int mapsize = sc->mp->m_attr_geo->blksize;
228227
int i;
229228

@@ -237,7 +236,7 @@ xchk_xattr_check_freemap(
237236
}
238237

239238
/* Look for bits that are set in freemap and are marked in use. */
240-
return bitmap_and(dstmap, freemap, map, mapsize) == 0;
239+
return !bitmap_intersects(freemap, map, mapsize);
241240
}
242241

243242
/*

fs/xfs/scrub/attr.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ struct xchk_xattr_buf {
2121
* Each bitmap contains enough bits to track every byte in an attr
2222
* block (rounded up to the size of an unsigned long). The attr block
2323
* used space bitmap starts at the beginning of the buffer; the free
24-
* space bitmap follows immediately after; and we have a third buffer
25-
* for storing intermediate bitmap results.
24+
* space bitmap follows immediately after.
2625
*/
2726
uint8_t buf[];
2827
};
@@ -56,13 +55,4 @@ xchk_xattr_freemap(
5655
BITS_TO_LONGS(sc->mp->m_attr_geo->blksize);
5756
}
5857

59-
/* A bitmap used to hold temporary results. */
60-
static inline unsigned long *
61-
xchk_xattr_dstmap(
62-
struct xfs_scrub *sc)
63-
{
64-
return xchk_xattr_freemap(sc) +
65-
BITS_TO_LONGS(sc->mp->m_attr_geo->blksize);
66-
}
67-
6858
#endif /* __XFS_SCRUB_ATTR_H__ */

0 commit comments

Comments
 (0)