Skip to content

Commit 48a325a

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: remove xfs_buf_is_vmapped
No need to look at the page count if we can simply call is_vmalloc_addr on bp->b_addr. This prepares for eventualy removing the b_page_count field. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
1 parent 51e1099 commit 48a325a

1 file changed

Lines changed: 3 additions & 17 deletions

File tree

fs/xfs/xfs_buf.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,6 @@ static inline bool xfs_buf_is_uncached(struct xfs_buf *bp)
5555
return bp->b_rhash_key == XFS_BUF_DADDR_NULL;
5656
}
5757

58-
static inline int
59-
xfs_buf_is_vmapped(
60-
struct xfs_buf *bp)
61-
{
62-
/*
63-
* Return true if the buffer is vmapped.
64-
*
65-
* b_addr is null if the buffer is not mapped, but the code is clever
66-
* enough to know it doesn't have to map a single page, so the check has
67-
* to be both for b_addr and bp->b_page_count > 1.
68-
*/
69-
return bp->b_addr && bp->b_page_count > 1;
70-
}
71-
7258
static inline int
7359
xfs_buf_vmap_len(
7460
struct xfs_buf *bp)
@@ -212,7 +198,7 @@ xfs_buf_free_pages(
212198

213199
ASSERT(bp->b_flags & _XBF_PAGES);
214200

215-
if (xfs_buf_is_vmapped(bp))
201+
if (is_vmalloc_addr(bp->b_addr))
216202
vm_unmap_ram(bp->b_addr, bp->b_page_count);
217203

218204
for (i = 0; i < bp->b_page_count; i++) {
@@ -1298,7 +1284,7 @@ __xfs_buf_ioend(
12981284
trace_xfs_buf_iodone(bp, _RET_IP_);
12991285

13001286
if (bp->b_flags & XBF_READ) {
1301-
if (!bp->b_error && xfs_buf_is_vmapped(bp))
1287+
if (!bp->b_error && bp->b_addr && is_vmalloc_addr(bp->b_addr))
13021288
invalidate_kernel_vmap_range(bp->b_addr,
13031289
xfs_buf_vmap_len(bp));
13041290
if (!bp->b_error && bp->b_ops)
@@ -1479,7 +1465,7 @@ xfs_buf_submit_bio(
14791465
__bio_add_page(bio, bp->b_pages[p], PAGE_SIZE, 0);
14801466
bio->bi_iter.bi_size = size; /* limit to the actual size used */
14811467

1482-
if (xfs_buf_is_vmapped(bp))
1468+
if (bp->b_addr && is_vmalloc_addr(bp->b_addr))
14831469
flush_kernel_vmap_range(bp->b_addr,
14841470
xfs_buf_vmap_len(bp));
14851471
}

0 commit comments

Comments
 (0)