1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (c) 2023-2024 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <djwong@kernel.org>
6 #ifndef __XFS_BUF_MEM_H__
7 #define __XFS_BUF_MEM_H__
9 #define XMBUF_BLOCKSIZE (PAGE_SIZE)
10 #define XMBUF_BLOCKSHIFT (PAGE_SHIFT)
12 #ifdef CONFIG_XFS_MEMORY_BUFS
13 static inline bool xfs_buftarg_is_mem(const struct xfs_buftarg
*btp
)
15 return btp
->bt_bdev
== NULL
;
18 int xmbuf_alloc(struct xfs_mount
*mp
, const char *descr
,
19 struct xfs_buftarg
**btpp
);
20 void xmbuf_free(struct xfs_buftarg
*btp
);
22 int xmbuf_map_page(struct xfs_buf
*bp
);
23 void xmbuf_unmap_page(struct xfs_buf
*bp
);
24 bool xmbuf_verify_daddr(struct xfs_buftarg
*btp
, xfs_daddr_t daddr
);
25 void xmbuf_trans_bdetach(struct xfs_trans
*tp
, struct xfs_buf
*bp
);
26 int xmbuf_finalize(struct xfs_buf
*bp
);
28 # define xfs_buftarg_is_mem(...) (false)
29 # define xmbuf_map_page(...) (-ENOMEM)
30 # define xmbuf_unmap_page(...) ((void)0)
31 # define xmbuf_verify_daddr(...) (false)
32 #endif /* CONFIG_XFS_MEMORY_BUFS */
34 #endif /* __XFS_BUF_MEM_H__ */