Skip to content

Commit

Permalink
Revert "common: avoid badblock error msg when used internally"
Browse files Browse the repository at this point in the history
This reverts commit 8b87e93.
  • Loading branch information
grom72 committed Jan 31, 2024
1 parent 2883cf1 commit a201bbd
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/common/bad_blocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ badblocks_get(const char *file, struct badblocks *bbs)
goto exit_delete_source;

bb_found = 0;
while ((pmem2_badblock_next_internal(bbctx, &bb)) == 0) {
while ((pmem2_badblock_next(bbctx, &bb)) == 0) {
bb_found++;
/*
* Form a new bad block structure with offset and length
Expand Down Expand Up @@ -210,7 +210,7 @@ badblocks_clear_all(const char *file)
goto exit_delete_source;
}

while ((pmem2_badblock_next_internal(bbctx, &bb)) == 0) {
while ((pmem2_badblock_next(bbctx, &bb)) == 0) {
ret = pmem2_badblock_clear(bbctx, &bb);
if (ret) {
CORE_LOG_ERROR("pmem2_badblock_clear -- %s", file);

Check warning on line 216 in src/common/bad_blocks.c

View check run for this annotation

Codecov / codecov/patch

src/common/bad_blocks.c#L216

Added line #L216 was not covered by tests
Expand Down
4 changes: 0 additions & 4 deletions src/common/badblocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <string.h>
#include <stdint.h>
#include <sys/types.h>
#include "libpmem2.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -71,9 +70,6 @@ int badblocks_clear_all(const char *file);

int badblocks_check_file(const char *path);

int pmem2_badblock_next_internal(struct pmem2_badblock_context *bbctx,
struct pmem2_badblock *bb);

#ifdef __cplusplus
}
#endif
Expand Down
1 change: 0 additions & 1 deletion src/common/set_badblocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "os.h"
#include "out.h"
#include "set_badblocks.h"
#include "libpmem2.h"
#include "badblocks.h"

/* helper structure for badblocks_check_file_cb() */
Expand Down
1 change: 0 additions & 1 deletion src/libpmem2/badblocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* badblocks.c -- implementation of common bad blocks API
*/

#include "libpmem2.h"
#include "badblocks.h"
#include "alloc.h"
#include "out.h"
Expand Down
17 changes: 2 additions & 15 deletions src/libpmem2/badblocks_ndctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,10 @@ pmem2_badblock_next_region(struct pmem2_badblock_context *bbctx,
}

/*
* pmem2_badblock_next_internal -- get the next bad block
* pmem2_badblock_next -- get the next bad block
*/
int
pmem2_badblock_next_internal(struct pmem2_badblock_context *bbctx,
pmem2_badblock_next(struct pmem2_badblock_context *bbctx,
struct pmem2_badblock *bb)
{
LOG(3, "bbctx %p bb %p", bbctx, bb);
Expand Down Expand Up @@ -674,19 +674,6 @@ pmem2_badblock_next_internal(struct pmem2_badblock_context *bbctx,
return 0;
}

int
pmem2_badblock_next(struct pmem2_badblock_context *bbctx,
struct pmem2_badblock *bb)
{
int ret = pmem2_badblock_next_internal(bbctx, bb);

if (ret == PMEM2_E_NO_BAD_BLOCK_FOUND) {
ERR_WO_ERRNO(
"Cannot find any matching device, no bad blocks found");
}
return ret;
}

/*
* pmem2_badblock_clear_fsdax -- (internal) clear one bad block
* in a FSDAX device
Expand Down

0 comments on commit a201bbd

Please sign in to comment.