| LLAPI_LAYOUT_COMP_ADD_PARITY_ONLY(3) | Lustre Library Functions | LLAPI_LAYOUT_COMP_ADD_PARITY_ONLY(3) |
NAME
llapi_layout_comp_add_parity_only - add an EC parity component to a layout
SYNOPSIS
#include <lustre/lustreapi.h>
int llapi_layout_comp_add_parity_only(struct llapi_layout *layout,
uint16_t target_mirror_id,
uint64_t start,
uint64_t end,
uint8_t dstripe_count,
uint8_t cstripe_count,
uint64_t stripe_size,
uint64_t data_stripe_count,
const char *pool_name);
DESCRIPTION
llapi_layout_comp_add_parity_only(3) appends an Erasure Coding (EC) parity component to the in-memory layout, bound to the data mirror target_mirror_id of the file that layout will be merged into. The layout is turned into a composite layout if it was plain before the component was added, and its current component pointer is left on the newly added component.
The data mirror is not part of layout, so its attributes are passed in by the caller rather than read out of layout, and the parity component is bound to target_mirror_id directly instead of through the transient link id that is resolved while a layout is created. Use llapi_layout_comp_add_ec() instead when the data component being protected is in the same layout.
target_mirror_id is the mirror id of the data mirror to protect, and must be non-zero.
start and end give the extent of the parity component, which must match the extent of the data component it protects.
dstripe_count and cstripe_count are the number of data stripes (K) and parity stripes (P) of each RAID Set.
stripe_size is the stripe size of the data component being protected. A parity component uses the same stripe size as its data component.
data_stripe_count is the stripe count of the data component being protected. Besides bounding K+P, it is stored as the parity component's own stripe count, from which the MDS derives the number of RAID Sets when the data component is not part of the same layout.
pool_name is the OST pool of the data component being protected, so that parity objects are allocated alongside the data they protect, or NULL to leave the parity component unbound.
One parity component is added per call, so a data mirror made of several components needs one call per component.
RETURN VALUES
llapi_layout_comp_add_parity_only(3) returns 0 on success, or -1 if an error occurred (in which case, errno is set appropriately). On failure layout is left unchanged.
ERRORS
EXAMPLES
Build a layout holding one 4+2 EC parity component for mirror 1 of a file whose data component has 8 stripes of 1MiB, to be merged into that file:
struct llapi_layout *layout;
int rc;
layout = llapi_layout_alloc();
if (layout == NULL)
/* error, out of memory */
/* K=4, P=2 per RAID Set over the 8-stripe data mirror */
rc = llapi_layout_comp_add_parity_only(layout, 1, 0, LUSTRE_EOF,
4, 2, 1048576, 8, NULL);
if (rc != 0)
/* error, errno is set */
llapi_layout_free(layout);
AVAILABILITY
llapi_layout_comp_add_parity_only() is part of the lustre(7) user application interface library since release 2.18.0.
SEE ALSO
lfs-mirror-extend(1), lfs-setstripe(1), llapi_layout_alloc(3), llapi_layout_comp_add(3), llapi_layout_file_comp_add(3), llapi_layout_free(3), llapi_layout(7), lustreapi(7)
| 2026-08-25 | Lustre User API |