mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
abd_os: break out platform-specific header parts
Removing the platform #ifdefs from shared headers in favour of per-platform headers. Makes abd_t much leaner, among other things. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes #16253
This commit is contained in:
committed by
Brian Behlendorf
parent
7a5b4355e2
commit
5b9e695392
+3
-32
@@ -30,6 +30,7 @@
|
||||
#include <sys/debug.h>
|
||||
#include <sys/zfs_refcount.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/abd_os.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -57,21 +58,8 @@ typedef struct abd {
|
||||
#endif
|
||||
kmutex_t abd_mtx;
|
||||
union {
|
||||
struct abd_scatter {
|
||||
uint_t abd_offset;
|
||||
#if defined(__FreeBSD__) && defined(_KERNEL)
|
||||
void *abd_chunks[1]; /* actually variable-length */
|
||||
#else
|
||||
uint_t abd_nents;
|
||||
struct scatterlist *abd_sgl;
|
||||
#endif
|
||||
} abd_scatter;
|
||||
struct abd_linear {
|
||||
void *abd_buf;
|
||||
#if defined(__linux__) && defined(_KERNEL)
|
||||
struct scatterlist *abd_sgl; /* for LINEAR_PAGE */
|
||||
#endif
|
||||
} abd_linear;
|
||||
struct abd_scatter abd_scatter;
|
||||
struct abd_linear abd_linear;
|
||||
struct abd_gang {
|
||||
list_t abd_gang_chain;
|
||||
} abd_gang;
|
||||
@@ -80,9 +68,6 @@ typedef struct abd {
|
||||
|
||||
typedef int abd_iter_func_t(void *buf, size_t len, void *priv);
|
||||
typedef int abd_iter_func2_t(void *bufa, void *bufb, size_t len, void *priv);
|
||||
#if defined(__linux__) && defined(_KERNEL)
|
||||
typedef int abd_iter_page_func_t(struct page *, size_t, size_t, void *);
|
||||
#endif
|
||||
|
||||
extern int zfs_abd_scatter_enabled;
|
||||
|
||||
@@ -129,10 +114,6 @@ void abd_release_ownership_of_buf(abd_t *);
|
||||
int abd_iterate_func(abd_t *, size_t, size_t, abd_iter_func_t *, void *);
|
||||
int abd_iterate_func2(abd_t *, abd_t *, size_t, size_t, size_t,
|
||||
abd_iter_func2_t *, void *);
|
||||
#if defined(__linux__) && defined(_KERNEL)
|
||||
int abd_iterate_page_func(abd_t *, size_t, size_t, abd_iter_page_func_t *,
|
||||
void *);
|
||||
#endif
|
||||
void abd_copy_off(abd_t *, abd_t *, size_t, size_t, size_t);
|
||||
void abd_copy_from_buf_off(abd_t *, const void *, size_t, size_t);
|
||||
void abd_copy_to_buf_off(void *, abd_t *, size_t, size_t);
|
||||
@@ -226,16 +207,6 @@ abd_get_size(abd_t *abd)
|
||||
void abd_init(void);
|
||||
void abd_fini(void);
|
||||
|
||||
/*
|
||||
* Linux ABD bio functions
|
||||
* Note: these are only needed to support vdev_classic. See comment in
|
||||
* vdev_disk.c.
|
||||
*/
|
||||
#if defined(__linux__) && defined(_KERNEL)
|
||||
unsigned int abd_bio_map_off(struct bio *, abd_t *, unsigned int, size_t);
|
||||
unsigned long abd_nr_pages_off(abd_t *, unsigned int, size_t);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-13
@@ -28,6 +28,7 @@
|
||||
#define _ABD_IMPL_H
|
||||
|
||||
#include <sys/abd.h>
|
||||
#include <sys/abd_impl_os.h>
|
||||
#include <sys/wmsum.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -111,19 +112,6 @@ void abd_iter_page(struct abd_iter *);
|
||||
#define ABD_LINEAR_BUF(abd) (abd->abd_u.abd_linear.abd_buf)
|
||||
#define ABD_GANG(abd) (abd->abd_u.abd_gang)
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#if defined(__FreeBSD__)
|
||||
#define abd_enter_critical(flags) critical_enter()
|
||||
#define abd_exit_critical(flags) critical_exit()
|
||||
#else
|
||||
#define abd_enter_critical(flags) local_irq_save(flags)
|
||||
#define abd_exit_critical(flags) local_irq_restore(flags)
|
||||
#endif
|
||||
#else /* !_KERNEL */
|
||||
#define abd_enter_critical(flags) ((void)0)
|
||||
#define abd_exit_critical(flags) ((void)0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user