1PMEM2_GET_FLUSH_FN(3) PMDK Programmer's Manual PMEM2_GET_FLUSH_FN(3)
2
3
4
6 pmem2_get_flush_fn() - get a flush function
7
9 #include <libpmem2.h>
10
11 typedef void (*pmem2_flush_fn)(const void *ptr, size_t size);
12
13 struct pmem2_map;
14
15 pmem2_flush_fn pmem2_get_flush_fn(struct pmem2_map *map);
16
18 The pmem2_get_flush_fn() function returns a pointer to a function re‐
19 sponsible for efficiently flushing data in the range owned by the map.
20
21 Flushing data using pmem2_flush_fn does not guarantee that the data is
22 stored durably by the time it returns. To get this guarantee, applica‐
23 tion should either use the persist operation (see pmem2_get_per‐
24 sist_fn(3)) or follow pmem2_flush_fn by a drain operation (see
25 pmem2_get_drain_fn(3)).
26
27 There are no alignment restrictions on the range described by ptr and
28 size, but pmem2_flush_fn may expand the range as necessary to meet
29 platform alignment requirements.
30
31 There is nothing atomic or transactional about pmem2_flush_fn. Any un‐
32 written stores in the given range will be written, but some stores may
33 have already been written by virtue of normal cache eviction/replace‐
34 ment policies. Correctly written code must not depend on stores wait‐
35 ing until pmem2_flush_fn is called to be flushed – they can be flushed
36 at any time before pmem2_flush_fn is called.
37
38 If two (or more) mappings share the same pmem2_flush_fn and they are
39 adjacent to each other, it is safe to call this function for a range
40 spanning those mappings.
41
43 The pmem2_get_flush_fn() function never returns NULL.
44
45 The pmem2_get_flush_fn() for the same map always returns the same func‐
46 tion. This means that it's safe to cache its return value. However,
47 this function is very cheap (because it returns a precomputed value),
48 so caching may not be necessary.
49
51 pmem2_get_drain_fn(3), pmem2_get_persist_fn(3), pmem2_map_new(3), libp‐
52 mem2(7) and <https://pmem.io>
53
54
55
56PMDK - pmem2 API version 1.0 2022-08-25 PMEM2_GET_FLUSH_FN(3)