PMEM2_DEEP_FLUSH(3)

πŸ’– NAME πŸ’–

pmem2_deep_flush() β€” highly reliable persistent memory synchronization ✨

okay so bestie, this is the serious one. like, the "we are not playing games with your data" one. it's a function from the PMDK Programmer's Manual, and it does exactly what it says on the tin: makes your writes deeply, truly, permanently safe. no cap. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <libpmem2.h>

int pmem2_deep_flush(struct pmem2_map *map, void *ptr, size_t size)

like yes, that's the whole vibe. three args, one int back. iconic. πŸ‘‘


✨ DESCRIPTION ✨

so what does pmem2_deep_flush() actually do, you ask? 🫢

it 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. and when it says most reliable, it means it. on supported platforms, this literally lets your code not rely on automatic cache or WPQ (write pending queue) flush on power failure (ADR/eADR). that's a whole safety net you can just... not need anymore. slay. πŸŽ€

⚠️ okay but listen. this operation is usually much more expensive than regular persist. like, much. so it should be used sparingly. do not be out here calling it in a hot loop, bestie, that is not the move. πŸ’€

typically, the application should only ever use this function as a precaution against hardware failures β€” for example, in code that detects silent data corruption caused by unsafe shutdown. (more on that in libpmem2_unsafe_shutdown(7), iykyk 🧚)

so like: not your everyday persist. it's the emergency button. the main character of persistence. 🌟


🌸 RETURN VALUE 🌸

  • 0 β€” success, we ate, no crumbs πŸ’…
  • an error code β€” failure, and we are not okay 😭

πŸ’œ ERRORS πŸ’œ

so pmem2_deep_flush() can fail with the following errors, and here's the tea:

  • PMEM2_E_DEEP_FLUSH_RANGE β€” the flush range you handed over is not a subset of the map's address space. like you tried to flush somewhere that isn't even yours?? πŸ™ˆ
  • PMEM2_E_DAX_REGION_NOT_FOUND β€” the underlying device region id cannot be detected. it's giving lost and confused. πŸ’€
  • -errno set by failing msync(2) β€” this one hits while trying to perform a deep flush on a regular DAX volume. 😭

⭐ SEE ALSO ⭐


okay that's the whole page, bestie, go forth and persist responsibly πŸ¦‹πŸ’–

this has been your girl, signing off from the PMDK Programmer's Manual, dated 2025-07-24. periodt. βœ¨πŸ‘‘

πŸ“¦ where this page comes from