Skip to content

Commit

Permalink
Multi ABD Type
Browse files Browse the repository at this point in the history
Adding the mutli abd type, which allows for
linear and scatter abd's to be chained together
into a single abd.

Signed-off-by: Brian <batkinson.lanl.gov>
Authored-by: Mark Maybee <[email protected]>
  • Loading branch information
Brian authored and bwatkinson committed Mar 2, 2020
1 parent abef699 commit 2ac5c16
Show file tree
Hide file tree
Showing 4 changed files with 450 additions and 113 deletions.
24 changes: 16 additions & 8 deletions include/sys/abd.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@ extern "C" {
#endif

typedef enum abd_flags {
ABD_FLAG_LINEAR = 1 << 0, /* is buffer linear (or scattered)? */
ABD_FLAG_OWNER = 1 << 1, /* does it own its data buffers? */
ABD_FLAG_META = 1 << 2, /* does this represent FS metadata? */
ABD_FLAG_MULTI_ZONE = 1 << 3, /* pages split over memory zones */
ABD_FLAG_MULTI_CHUNK = 1 << 4, /* pages split over multiple chunks */
ABD_FLAG_LINEAR_PAGE = 1 << 5, /* linear but allocd from page */
ABD_FLAG_LINEAR = 1 << 0, /* is buffer linear (or scattered)? */
ABD_FLAG_OWNER = 1 << 1, /* does it own its data buffers? */
ABD_FLAG_META = 1 << 2, /* does this represent FS metadata? */
ABD_FLAG_MULTI_ZONE = 1 << 3, /* pages split over memory zones */
ABD_FLAG_MULTI_CHUNK = 1 << 4, /* pages split over multiple chunks */
ABD_FLAG_LINEAR_PAGE = 1 << 5, /* linear but allocd from page */
ABD_FLAG_MULTI_LIST = 1 << 6, /* mult ABDs chained together */
ABD_FLAG_GAP = 1 << 7, /* ABD for read gap */
ABD_FLAG_ZEROS = 1 << 8, /* ABD for zero-filled buffer */
} abd_flags_t;

typedef struct abd {
Expand All @@ -64,6 +67,9 @@ typedef struct abd {
void *abd_buf;
struct scatterlist *abd_sgl; /* for LINEAR_PAGE */
} abd_linear;
struct abd_multi {
list_t abd_chain;
} abd_multi;
} abd_u;
} abd_t;

Expand Down Expand Up @@ -91,11 +97,14 @@ abd_is_linear_page(abd_t *abd)

abd_t *abd_alloc(size_t, boolean_t);
abd_t *abd_alloc_linear(size_t, boolean_t);
abd_t *abd_alloc_multi(void);
abd_t *abd_alloc_for_io(size_t, boolean_t);
abd_t *abd_alloc_sametype(abd_t *, size_t);
void abd_add_child(abd_t *, abd_t *, boolean_t);
void abd_free(abd_t *);
abd_t *abd_get_offset(abd_t *, size_t);
abd_t *abd_get_offset_size(abd_t *, size_t, size_t);
abd_t *abd_get_zeros(size_t);
abd_t *abd_get_from_buf(void *, size_t);
void abd_put(abd_t *);

Expand Down Expand Up @@ -126,8 +135,7 @@ int abd_cmp_buf_off(abd_t *, const void *, size_t, size_t);
void abd_zero_off(abd_t *, size_t, size_t);

#if defined(_KERNEL)
unsigned int abd_scatter_bio_map_off(struct bio *, abd_t *, unsigned int,
size_t);
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

Expand Down
Loading

0 comments on commit 2ac5c16

Please sign in to comment.