---
name: "pmem2_deep_flush"
section: "3"
platform: "linux"
package: "libpmem2-dev"
version: "1.13.1-1.1+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/pmem2_deep_flush"
---

# pmem2\_deep\_flush(3)

highly reliable persistent memory synchronization

## NAME

**pmem2\_deep\_flush**() - highly reliable persistent memory synchronization

## SYNOPSIS

-

  ```
  #include <libpmem2.h>
  int pmem2_deep_flush(struct pmem2_map *map, void *ptr, size_t size)
  ```

## DESCRIPTION

The **pmem2\_deep\_flush**() function forces any changes in the range \[*ptr*, *ptr*+*len*) from the *map* to be stored durably in the most reliable persistence domain available to software. In particular, on supported platforms, this enables the code not to rely on automatic cache or WPQ (write pending queue) flush on power failure (ADR/eADR).

Since this operation is usually much more expensive than regular persist, it should be used sparingly. Typically, the application should only ever use this function as a precaution against hardware failures, e.g., in code that detects silent data corruption caused by unsafe shutdown (see more in [**libpmem2\_unsafe\_shutdown**(7)](/libpmem2_unsafe_shutdown/7.md)).

## RETURN VALUE

The **pmem2\_deep\_flush**() function returns 0 on success or an error code on failure.

## ERRORS

The **pmem2\_deep\_flush**() can fail with the following errors:

- •

  **PMEM2\_E\_DEEP\_FLUSH\_RANGE** - the provided flush range is not a subset of the map’s address space.

- •

  **PMEM2\_E\_DAX\_REGION\_NOT\_FOUND** - the underlying device region id cannot be detected.

- •

  \-**errno** set by failing [**msync**(2)](/msync/2.md), while trying to perform a deep flush on a regular DAX volume.

## SEE ALSO

[**msync**(2)](/msync/2.md), [**pmem2\_get\_drain\_fn**(3)](/pmem2_get_drain_fn/3.md), [**pmem2\_get\_persist\_fn**(3)](/pmem2_get_persist_fn/3.md) **pmem2\_map**(3), [**libpmem2**(7)](/libpmem2/7.md) and **\<http://pmem.io\>**
