1PMEM2_BADBLOCK_CLEAR(3) PMDK Programmer's Manual PMEM2_BADBLOCK_CLEAR(3)
2
3
4
6 pmem2_badblock_clear() - clear the given bad block
7
9 #include <libpmem2.h>
10
11 struct pmem2_badblock;
12 struct pmem2_badblock_context;
13
14 int pmem2_badblock_clear(
15 struct pmem2_badblock_context *bbctx,
16 struct pmem2_badblock *bb);
17
19 The pmem2_badblock_clear() function clears the given *bb bad block.
20
21 It means that the pmem2_badblock_clear() function unmaps bad blocks and
22 maps new, healthy, blocks in place of the bad ones. The new blocks are
23 zeroed. The content of the bad blocks is lost.
24
25 It is not supported on Windows.
26
28 The pmem2_badblock_clear() function clears the given *bb bad block and
29 returns 0 on success or a negative error code on failure.
30
32 pmem2_badblock_clear() can fail with the following errors:
33
34 • PMEM2_E_OFFSET_OUT_OF_RANGE - bad block's offset is greater than
35 INT64_MAX
36
37 • PMEM2_E_LENGTH_OUT_OF_RANGE - bad block's length is greater than
38 INT64_MAX
39
40 • PMEM2_E_NOSUPP - on Windows or when the OS does not support this
41 functionality
42
43 • -errno - set by failing fallocate(2), while deallocating bad blocks
44 or allocating new blocks
45
46 • -errno - set by failing ndctl functions: ndctl_bus_cmd_new_ars_cap,
47 ndctl_cmd_submit, ndctl_cmd_ars_cap_get_range or nd‐
48 ctl_bus_cmd_new_clear_error while trying to clear a bad block in a
49 DAX device
50
51 • -ENXIO - ndctl_bus_cmd_new_clear_error did not manage to clear all
52 bad blocks
53
55 pmem2_badblock_context_new(3), pmem2_badblock_next(3), libpmem2(7) and
56 <https://pmem.io>
57
58
59
60PMDK - pmem2 API version 1.0 2022-08-25 PMEM2_BADBLOCK_CLEAR(3)