LLAPI\_LAYOUT\_COMP\_ADD\_PARITY\_ONLY(3) Lustre Library Functions LLAPI\_LAYOUT\_COMP\_ADD\_PARITY\_ONLY(3)

# [NAME](#NAME)

llapi\_layout\_comp\_add\_parity\_only - add an EC parity component to a layout

# [SYNOPSIS](#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](#DESCRIPTION)

[**llapi\_layout\_comp\_add\_parity\_only**(3)](/man/enterprise-packages/lustre/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](#RETURN_VALUES)

[**llapi\_layout\_comp\_add\_parity\_only**(3)](/man/enterprise-packages/lustre/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](#ERRORS)

[**EINVAL**](#EINVAL)

An invalid argument was specified: *layout* was NULL, *target\_mirror\_id* was zero, *start* was not below *end*, or the EC stripe counts exceeded the EC limits or did not fit *data\_stripe\_count*.

[**ENOMEM**](#ENOMEM)

Insufficient memory to complete the operation.

# [EXAMPLES](#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](#AVAILABILITY)

**llapi\_layout\_comp\_add\_parity\_only()** is part of the [**lustre**(7)](/man/enterprise-packages/lustre/lustre.7) user application interface library since release 2.18.0.

# [SEE ALSO](#SEE_ALSO)

[**lfs-mirror-extend**(1)](/man/enterprise-packages/lustre/lfs-mirror-extend.1), [**lfs-setstripe**(1)](/man/enterprise-packages/lustre/lfs-setstripe.1), [**llapi\_layout\_alloc**(3)](/man/enterprise-packages/lustre/llapi_layout_alloc.3), [**llapi\_layout\_comp\_add**(3)](/man/enterprise-packages/lustre/llapi_layout_comp_add.3), [**llapi\_layout\_file\_comp\_add**(3)](/man/enterprise-packages/lustre/llapi_layout_file_comp_add.3), [**llapi\_layout\_free**(3)](/man/enterprise-packages/lustre/llapi_layout_free.3), [**llapi\_layout**(7)](/man/enterprise-packages/lustre/llapi_layout.7), [**lustreapi**(7)](/man/enterprise-packages/lustre/lustreapi.7)

2026-08-25 Lustre User API

---

Document: llapi_layout_comp_add_parity_only(3) from lustre 2.17.60-r0 (Chainguard OS)
Source: https://github.com/lustre/lustre-release
