diff --git a/src/common/file.c b/src/common/file.c index 9d4574f470e..b79cab02f44 100644 --- a/src/common/file.c +++ b/src/common/file.c @@ -209,13 +209,13 @@ util_file_map_whole(const char *path) ssize_t size = util_fd_get_size(fd); if (size < 0) { - LOG(2, "cannot determine file length \"%s\"", path); + CORE_LOG_WARNING("cannot determine file length \"%s\"", path); goto out; } addr = util_map(fd, 0, (size_t)size, MAP_SHARED, 0, 0, NULL); if (addr == NULL) { - LOG(2, "failed to map entire file \"%s\"", path); + CORE_LOG_WARNING("failed to map entire file \"%s\"", path); goto out; } @@ -247,27 +247,29 @@ util_file_zero(const char *path, os_off_t off, size_t len) ssize_t size = util_fd_get_size(fd); if (size < 0) { - LOG(2, "cannot determine file length \"%s\"", path); + CORE_LOG_WARNING("cannot determine file length \"%s\"", path); ret = -1; goto out; } if (off > size) { - LOG(2, "offset beyond file length, %ju > %ju", off, size); + CORE_LOG_WARNING("offset beyond file length, %ju > %ju", off, + size); ret = -1; goto out; } if ((size_t)off + len > (size_t)size) { - LOG(2, "requested size of write goes beyond the file length, " - "%zu > %zu", (size_t)off + len, size); + CORE_LOG_WARNING( + "requested size of write goes beyond the file length, %zu > %zu", + (size_t)off + len, size); LOG(4, "adjusting len to %zu", size - off); len = (size_t)(size - off); } void *addr = util_map(fd, 0, (size_t)size, MAP_SHARED, 0, 0, NULL); if (addr == NULL) { - LOG(2, "failed to map entire file \"%s\"", path); + CORE_LOG_WARNING("failed to map entire file \"%s\"", path); ret = -1; goto out; } @@ -302,7 +304,7 @@ util_file_pwrite(const char *path, const void *buffer, size_t size, if (type == TYPE_NORMAL) { int fd = util_file_open(path, NULL, 0, O_RDWR); if (fd < 0) { - LOG(2, "failed to open file \"%s\"", path); + CORE_LOG_WARNING("failed to open file \"%s\"", path); return -1; } @@ -315,21 +317,22 @@ util_file_pwrite(const char *path, const void *buffer, size_t size, ssize_t file_size = util_file_get_size(path); if (file_size < 0) { - LOG(2, "cannot determine file length \"%s\"", path); + CORE_LOG_WARNING("cannot determine file length \"%s\"", path); return -1; } size_t max_size = (size_t)(file_size - offset); if (size > max_size) { - LOG(2, "requested size of write goes beyond the file length, " - "%zu > %zu", size, max_size); + CORE_LOG_WARNING( + "requested size of write goes beyond the file length, %zu > %zu", + size, max_size); LOG(4, "adjusting size to %zu", max_size); size = max_size; } void *addr = util_file_map_whole(path); if (addr == NULL) { - LOG(2, "failed to map entire file \"%s\"", path); + CORE_LOG_WARNING("failed to map entire file \"%s\"", path); return -1; } @@ -355,7 +358,7 @@ util_file_pread(const char *path, void *buffer, size_t size, if (type == TYPE_NORMAL) { int fd = util_file_open(path, NULL, 0, O_RDONLY); if (fd < 0) { - LOG(2, "failed to open file \"%s\"", path); + CORE_LOG_WARNING("failed to open file \"%s\"", path); return -1; } @@ -368,21 +371,22 @@ util_file_pread(const char *path, void *buffer, size_t size, ssize_t file_size = util_file_get_size(path); if (file_size < 0) { - LOG(2, "cannot determine file length \"%s\"", path); + CORE_LOG_WARNING("cannot determine file length \"%s\"", path); return -1; } size_t max_size = (size_t)(file_size - offset); if (size > max_size) { - LOG(2, "requested size of read goes beyond the file length, " - "%zu > %zu", size, max_size); + CORE_LOG_WARNING( + "requested size of read goes beyond the file length, %zu > %zu", + size, max_size); LOG(4, "adjusting size to %zu", max_size); size = max_size; } void *addr = util_file_map_whole(path); if (addr == NULL) { - LOG(2, "failed to map entire file \"%s\"", path); + CORE_LOG_WARNING("failed to map entire file \"%s\"", path); return -1; } @@ -540,7 +544,7 @@ util_unlink_flock(const char *path) int fd = util_file_open(path, NULL, 0, O_RDONLY); if (fd < 0) { - LOG(2, "failed to open file \"%s\"", path); + CORE_LOG_WARNING("failed to open file \"%s\"", path); return -1; } diff --git a/src/common/mmap.c b/src/common/mmap.c index aaf4b3deddb..48bb01d1233 100644 --- a/src/common/mmap.c +++ b/src/common/mmap.c @@ -51,9 +51,9 @@ util_mmap_init(void) unsigned long long val = strtoull(e, &endp, 16); if (errno || endp == e) { - LOG(2, "Invalid PMEM_MMAP_HINT"); + CORE_LOG_WARNING("Invalid PMEM_MMAP_HINT"); } else if (os_access(OS_MAPFILE, R_OK)) { - LOG(2, "No /proc, PMEM_MMAP_HINT ignored"); + CORE_LOG_WARNING("No /proc, PMEM_MMAP_HINT ignored"); } else { Mmap_hint = (void *)val; Mmap_no_random = 1; diff --git a/src/common/os_deep_linux.c b/src/common/os_deep_linux.c index f74cf64a8d0..3036673bf91 100644 --- a/src/common/os_deep_linux.c +++ b/src/common/os_deep_linux.c @@ -38,8 +38,9 @@ os_deep_type(const struct map_tracker *mt, void *addr, size_t len) CORE_LOG_ERROR("!deep_flush not supported"); } else { errno = pmem2_err_to_errno(ret); - LOG(2, "cannot write to deep_flush" - "in region %u", mt->region_id); + CORE_LOG_WARNING( + "cannot write to deep_flush in region %u", + mt->region_id); } return -1; } diff --git a/src/common/set.c b/src/common/set.c index fe33cdb61b9..24a1eaf1209 100644 --- a/src/common/set.c +++ b/src/common/set.c @@ -340,7 +340,7 @@ util_poolset_open(struct pool_set *set) { for (unsigned r = 0; r < set->nreplicas; ++r) { if (util_replica_open(set, r, MAP_SHARED)) { - LOG(2, "replica open failed: replica %u", r); + CORE_LOG_WARNING("replica open failed: replica %u", r); errno = EINVAL; return -1; } @@ -1050,9 +1050,9 @@ util_poolset_directory_load(struct pool_replica **repp, const char *directory) ssize_t size = util_file_get_size(entry->path); if (size < 0) { - LOG(2, - "cannot read size of file (%s) in a poolset directory", - entry->path); + CORE_LOG_WARNING( + "cannot read size of file (%s) in a poolset directory", + entry->path); goto err; } @@ -1481,7 +1481,8 @@ util_part_open(struct pool_set_part *part, size_t minsize, int create_part) part->fd = util_file_create(part->path, part->filesize, minsize); if (part->fd == -1) { - LOG(2, "failed to create file: %s", part->path); + CORE_LOG_WARNING("failed to create file: %s", + part->path); return -1; } part->created = 1; @@ -1490,7 +1491,7 @@ util_part_open(struct pool_set_part *part, size_t minsize, int create_part) int flags = O_RDWR; part->fd = util_file_open(part->path, &size, minsize, flags); if (part->fd == -1) { - LOG(2, "failed to open file: %s", part->path); + CORE_LOG_WARNING("failed to open file: %s", part->path); return -1; } @@ -1968,7 +1969,8 @@ util_replica_map_local(struct pool_set *set, unsigned repidx, int flags) /* map the first part and reserve space for remaining parts */ if (util_map_part(&rep->part[0], addr, rep->resvsize, 0, flags, 0) != 0) { - LOG(2, "pool mapping failed - replica #%u part #0", + CORE_LOG_WARNING( + "pool mapping failed - replica #%u part #0", repidx); return -1; } @@ -1997,8 +1999,9 @@ util_replica_map_local(struct pool_set *set, unsigned repidx, int flags) */ if ((errno == EINVAL) && (remaining_retries > 0)) { - LOG(2, "usable space mapping failed - " - "part #%d - retrying", p); + CORE_LOG_WARNING( + "usable space mapping failed - part #%d - retrying", + p); retry_for_contiguous_addr = 1; remaining_retries--; @@ -2010,7 +2013,8 @@ util_replica_map_local(struct pool_set *set, unsigned repidx, int flags) munmap(addr, rep->resvsize - mapsize); break; } - LOG(2, "usable space mapping failed - part #%d", + CORE_LOG_WARNING( + "usable space mapping failed - part #%d", p); goto err; } @@ -2078,7 +2082,7 @@ util_replica_init_headers_local(struct pool_set *set, unsigned repidx, /* map all headers - don't care about the address */ for (unsigned p = 0; p < rep->nhdrs; p++) { if (util_map_hdr(&rep->part[p], flags, 0) != 0) { - LOG(2, "header mapping failed - part #%d", p); + CORE_LOG_WARNING("header mapping failed - part #%d", p); goto err; } } @@ -2086,7 +2090,8 @@ util_replica_init_headers_local(struct pool_set *set, unsigned repidx, /* create headers, set UUID's */ for (unsigned p = 0; p < rep->nhdrs; p++) { if (util_header_create(set, repidx, p, attr, 0) != 0) { - LOG(2, "header creation failed - part #%d", p); + CORE_LOG_WARNING("header creation failed - part #%d", + p); goto err; } } @@ -2122,7 +2127,7 @@ util_replica_create_local(struct pool_set *set, unsigned repidx, int flags, */ if (PART(REP(set, repidx), 0)->addr == NULL) { if (util_replica_map_local(set, repidx, flags) != 0) { - LOG(2, "replica #%u map failed", repidx); + CORE_LOG_WARNING("replica #%u map failed", repidx); return -1; } } @@ -2131,7 +2136,8 @@ util_replica_create_local(struct pool_set *set, unsigned repidx, int flags, return 0; if (util_replica_init_headers_local(set, repidx, flags, attr) != 0) { - LOG(2, "replica #%u headers initialization failed", repidx); + CORE_LOG_WARNING("replica #%u headers initialization failed", + repidx); return -1; } return 0; @@ -2388,7 +2394,7 @@ util_pool_create_uuids(struct pool_set **setp, const char *path, int ret = util_poolset_create_set(setp, path, poolsize, minsize, IGNORE_SDS(attr)); if (ret < 0) { - LOG(2, "cannot create pool set -- '%s'", path); + CORE_LOG_WARNING("cannot create pool set -- '%s'", path); return -1; } @@ -2475,7 +2481,8 @@ util_pool_create_uuids(struct pool_set **setp, const char *path, /* generate pool set UUID */ ret = util_uuid_generate(set->uuid); if (ret < 0) { - LOG(2, "cannot generate pool set UUID"); + CORE_LOG_WARNING( + "cannot generate pool set UUID"); goto err_poolset; } } @@ -2486,7 +2493,7 @@ util_pool_create_uuids(struct pool_set **setp, const char *path, for (unsigned i = 0; i < rep->nhdrs; i++) { ret = util_uuid_generate(rep->part[i].uuid); if (ret < 0) { - LOG(2, + CORE_LOG_WARNING( "cannot generate pool set part UUID"); goto err_poolset; } @@ -2513,7 +2520,7 @@ util_pool_create_uuids(struct pool_set **setp, const char *path, for (unsigned r = 0; r < set->nreplicas; r++) { if (util_replica_create_local(set, r, flags, attr) != 0) { - LOG(2, "replica #%u creation failed", r); + CORE_LOG_WARNING("replica #%u creation failed", r); goto err_create; } } @@ -2590,7 +2597,8 @@ util_replica_open_local(struct pool_set *set, unsigned repidx, int flags) /* map the first part and reserve space for remaining parts */ if (util_map_part(&rep->part[0], addr, rep->resvsize, 0, flags, 0) != 0) { - LOG(2, "pool mapping failed - replica #%u part #0", + CORE_LOG_WARNING( + "pool mapping failed - replica #%u part #0", repidx); return -1; } @@ -2603,7 +2611,8 @@ util_replica_open_local(struct pool_set *set, unsigned repidx, int flags) /* map all headers - don't care about the address */ for (unsigned p = 0; p < rep->nhdrs; p++) { if (util_map_hdr(&rep->part[p], flags, 0) != 0) { - LOG(2, "header mapping failed - part #%d", p); + CORE_LOG_WARNING( + "header mapping failed - part #%d", p); goto err; } } @@ -2636,8 +2645,9 @@ util_replica_open_local(struct pool_set *set, unsigned repidx, int flags) */ if ((errno == EINVAL) && (remaining_retries > 0)) { - LOG(2, "usable space mapping failed - " - "part #%d - retrying", p); + CORE_LOG_WARNING( + "usable space mapping failed - part #%d - retrying", + p); retry_for_contiguous_addr = 1; remaining_retries--; @@ -2648,7 +2658,8 @@ util_replica_open_local(struct pool_set *set, unsigned repidx, int flags) rep->resvsize); break; } - LOG(2, "usable space mapping failed - part #%d", + CORE_LOG_WARNING( + "usable space mapping failed - part #%d", p); goto err; } @@ -2778,7 +2789,8 @@ util_replica_check(struct pool_set *set, const struct pool_attr *attr) struct pool_replica *rep = set->replica[r]; for (unsigned p = 0; p < rep->nhdrs; p++) { if (util_header_check(set, r, p, attr) != 0) { - LOG(2, "header check failed - part #%d", p); + CORE_LOG_WARNING( + "header check failed - part #%d", p); return -1; } set->rdonly |= rep->part[p].rdonly; @@ -2807,7 +2819,7 @@ util_replica_check(struct pool_set *set, const struct pool_attr *attr) ASSERTne(rep->nparts, 0); if (shutdown_state_check(&sds, &HDR(rep, 0)->sds, rep)) { - LOG(2, "ADR failure detected"); + CORE_LOG_WARNING("ADR failure detected"); errno = EINVAL; return -1; } @@ -2900,7 +2912,7 @@ util_pool_open_nocheck(struct pool_set *set, unsigned flags) for (unsigned r = 0; r < set->nreplicas; r++) { if (util_replica_open(set, r, mmap_flags) != 0) { - LOG(2, "replica #%u open failed", r); + CORE_LOG_WARNING("replica #%u open failed", r); goto err_replica; } } @@ -2991,7 +3003,7 @@ util_pool_open(struct pool_set **setp, const char *path, size_t minpartsize, int ret = util_poolset_create_set(setp, path, 0, 0, flags & POOL_OPEN_IGNORE_SDS); if (ret < 0) { - LOG(2, "cannot open pool set -- '%s'", path); + CORE_LOG_WARNING("cannot open pool set -- '%s'", path); return -1; } @@ -3063,7 +3075,7 @@ util_pool_open(struct pool_set **setp, const char *path, size_t minpartsize, for (unsigned r = 0; r < set->nreplicas; r++) { if (util_replica_open(set, r, mmap_flags) != 0) { - LOG(2, "replica #%u open failed", r); + CORE_LOG_WARNING("replica #%u open failed", r); goto err_replica; } } diff --git a/src/common/shutdown_state.c b/src/common/shutdown_state.c index 919bc29c528..66d20e5dd52 100644 --- a/src/common/shutdown_state.c +++ b/src/common/shutdown_state.c @@ -77,7 +77,8 @@ shutdown_state_add_part(struct shutdown_state *sds, int fd, ERR_WO_ERRNO( "Cannot read unsafe shutdown count. For more information please check https://github.com/pmem/pmdk/issues/4207"); } - LOG(2, "cannot read unsafe shutdown count for %d", fd); + CORE_LOG_WARNING("cannot read unsafe shutdown count for %d", + fd); goto err; } @@ -202,7 +203,8 @@ shutdown_state_check(struct shutdown_state *curr_sds, if (!is_checksum_correct) { /* the program was killed during opening or closing the pool */ - LOG(2, "incorrect checksum - SDS will be reinitialized"); + CORE_LOG_WARNING( + "incorrect checksum - SDS will be reinitialized"); shutdown_state_reinit(curr_sds, pool_sds, rep); return 0; } @@ -214,14 +216,14 @@ shutdown_state_check(struct shutdown_state *curr_sds, * the program was killed when the pool was opened * but there wasn't an ADR failure */ - LOG(2, + CORE_LOG_WARNING( "the pool was not closed - SDS will be reinitialized"); shutdown_state_reinit(curr_sds, pool_sds, rep); return 0; } if (dirty == 0) { /* an ADR failure but the pool was closed */ - LOG(2, + CORE_LOG_WARNING( "an ADR failure was detected but the pool was closed - SDS will be reinitialized"); shutdown_state_reinit(curr_sds, pool_sds, rep); return 0; diff --git a/src/common/uuid.c b/src/common/uuid.c index 0b16d7f7c58..c1c084c82e3 100644 --- a/src/common/uuid.c +++ b/src/common/uuid.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -/* Copyright 2014-2021, Intel Corporation */ +/* Copyright 2014-2024, Intel Corporation */ /* * uuid.c -- uuid utilities @@ -20,12 +20,12 @@ util_uuid_to_string(const uuid_t u, char *buf) int len; /* size that is returned from sprintf call */ if (buf == NULL) { - LOG(2, "invalid buffer for uuid string"); + CORE_LOG_WARNING("invalid buffer for uuid string"); return -1; } if (u == NULL) { - LOG(2, "invalid uuid structure"); + CORE_LOG_WARNING("invalid uuid structure"); return -1; } @@ -38,7 +38,7 @@ util_uuid_to_string(const uuid_t u, char *buf) uuid->node[5]); if (len != POOL_HDR_UUID_STR_LEN - 1) { - LOG(2, "snprintf(uuid): %d", len); + CORE_LOG_WARNING("snprintf(uuid): %d", len); return -1; } @@ -56,13 +56,13 @@ int util_uuid_from_string(const char uuid[POOL_HDR_UUID_STR_LEN], struct uuid *ud) { if (strlen(uuid) != 36) { - LOG(2, "invalid uuid string"); + CORE_LOG_WARNING("invalid uuid string"); return -1; } if (uuid[8] != '-' || uuid[13] != '-' || uuid[18] != '-' || uuid[23] != '-') { - LOG(2, "invalid uuid string"); + CORE_LOG_WARNING("invalid uuid string"); return -1; } @@ -75,7 +75,7 @@ util_uuid_from_string(const char uuid[POOL_HDR_UUID_STR_LEN], struct uuid *ud) &ud->node[5]); if (n != 11) { - LOG(2, "sscanf(uuid)"); + CORE_LOG_WARNING("sscanf(uuid)"); return -1; } diff --git a/src/common/uuid_linux.c b/src/common/uuid_linux.c index 979e0ad52ba..16ee2dae531 100644 --- a/src/common/uuid_linux.c +++ b/src/common/uuid_linux.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -/* Copyright 2015-2017, Intel Corporation */ +/* Copyright 2015-2024, Intel Corporation */ /* * uuid_linux.c -- pool set utilities with OS-specific implementation @@ -28,13 +28,13 @@ util_uuid_generate(uuid_t uuid) int fd = os_open(POOL_HDR_UUID_GEN_FILE, O_RDONLY); if (fd < 0) { /* Fatal error */ - LOG(2, "!open(uuid)"); + CORE_LOG_WARNING("!open(uuid)"); return -1; } ssize_t num = read(fd, uu, POOL_HDR_UUID_STR_LEN); if (num < POOL_HDR_UUID_STR_LEN) { /* Fatal error */ - LOG(2, "!read(uuid)"); + CORE_LOG_WARNING("!read(uuid)"); os_close(fd); return -1; } diff --git a/src/libpmem/pmem.c b/src/libpmem/pmem.c index 5b4241ba2c7..1fea15990d0 100644 --- a/src/libpmem/pmem.c +++ b/src/libpmem/pmem.c @@ -477,7 +477,8 @@ pmem_map_fileU(const char *path, size_t len, int flags, if ((fd = util_tmpfile(path, OS_DIR_SEP_STR"pmem.XXXXXX", open_flags & O_EXCL)) < 0) { - LOG(2, "failed to create temporary file at \"%s\"", + CORE_LOG_WARNING( + "failed to create temporary file at \"%s\"", path); return NULL; } diff --git a/src/libpmemobj/heap.c b/src/libpmemobj/heap.c index 1090e607ad6..bd3684aebd0 100644 --- a/src/libpmemobj/heap.c +++ b/src/libpmemobj/heap.c @@ -1185,7 +1185,7 @@ heap_split_block(struct palloc_heap *heap, struct bucket *b, NULL, NULL, 0, 0, NULL}; memblock_rebuild_state(heap, &r); if (bucket_insert_block(b, &r) != 0) - LOG(2, + CORE_LOG_WARNING( "failed to allocate memory block runtime tracking info"); } else { uint32_t new_chunk_id = m->chunk_id + units; @@ -1197,7 +1197,7 @@ heap_split_block(struct palloc_heap *heap, struct bucket *b, *m = memblock_huge_init(heap, m->chunk_id, m->zone_id, units); if (bucket_insert_block(b, &n) != 0) - LOG(2, + CORE_LOG_WARNING( "failed to allocate memory block runtime tracking info"); } @@ -1320,7 +1320,7 @@ heap_set_narenas_max(struct palloc_heap *heap, unsigned size) util_mutex_lock(&h->arenas.lock); unsigned capacity = (unsigned)VEC_CAPACITY(&h->arenas.vec); if (size < capacity) { - LOG(2, "cannot decrease max number of arenas"); + CORE_LOG_WARNING("cannot decrease max number of arenas"); goto out; } else if (size == capacity) { ret = 0; diff --git a/src/libpmemobj/lane.c b/src/libpmemobj/lane.c index 26350bea714..6560550a2a1 100644 --- a/src/libpmemobj/lane.c +++ b/src/libpmemobj/lane.c @@ -414,7 +414,8 @@ lane_check(PMEMobjpool *pop) layout = lane_get_layout(pop, j); if (ulog_check((struct ulog *)&layout->internal, OBJ_OFF_IS_VALID_FROM_CTX, &pop->p_ops) != 0) { - LOG(2, "lane %" PRIu64 " internal redo failed: %d", + CORE_LOG_WARNING( + "lane %" PRIu64 " internal redo failed: %d", j, err); return err; } diff --git a/src/libpmemobj/list.c b/src/libpmemobj/list.c index bb93f004fb1..dc2ae3a00ad 100644 --- a/src/libpmemobj/list.c +++ b/src/libpmemobj/list.c @@ -559,7 +559,7 @@ list_insert_new_user(PMEMobjpool *pop, int ret; if ((ret = pmemobj_mutex_lock(pop, &user_head->lock))) { errno = ret; - LOG(2, "pmemobj_mutex_lock failed"); + CORE_LOG_WARNING("pmemobj_mutex_lock failed"); return -1; } @@ -598,7 +598,7 @@ list_insert(PMEMobjpool *pop, if ((ret = pmemobj_mutex_lock(pop, &head->lock))) { errno = ret; - LOG(2, "pmemobj_mutex_lock failed"); + CORE_LOG_WARNING("pmemobj_mutex_lock failed"); ret = -1; goto err; } @@ -726,7 +726,7 @@ list_remove_free_user(PMEMobjpool *pop, size_t pe_offset, int ret; if ((ret = pmemobj_mutex_lock(pop, &user_head->lock))) { errno = ret; - LOG(2, "pmemobj_mutex_lock failed"); + CORE_LOG_WARNING("pmemobj_mutex_lock failed"); return -1; } @@ -760,7 +760,7 @@ list_remove(PMEMobjpool *pop, if ((ret = pmemobj_mutex_lock(pop, &head->lock))) { errno = ret; - LOG(2, "pmemobj_mutex_lock failed"); + CORE_LOG_WARNING("pmemobj_mutex_lock failed"); ret = -1; goto err; } @@ -837,7 +837,7 @@ list_move(PMEMobjpool *pop, */ if ((ret = list_mutexes_lock(pop, head_new, head_old))) { errno = ret; - LOG(2, "list_mutexes_lock failed"); + CORE_LOG_WARNING("list_mutexes_lock failed"); ret = -1; goto err; } diff --git a/src/libpmemobj/memops.c b/src/libpmemobj/memops.c index a321e83b611..1c72d9b672d 100644 --- a/src/libpmemobj/memops.c +++ b/src/libpmemobj/memops.c @@ -349,7 +349,7 @@ operation_merge_entry_add(struct operation_context *ctx, if (VECQ_ENQUEUE(&ctx->merge_entries, entry) != 0) { /* this is fine, only runtime perf will get slower */ - LOG(2, "out of memory - unable to track entries"); + CORE_LOG_WARNING("out of memory - unable to track entries"); } } diff --git a/src/libpmemobj/obj.c b/src/libpmemobj/obj.c index 8b9f148be60..d41d079123c 100644 --- a/src/libpmemobj/obj.c +++ b/src/libpmemobj/obj.c @@ -87,7 +87,7 @@ obj_ctl_init_and_load(PMEMobjpool *pop) LOG(3, "pop %p", pop); if (pop != NULL && (pop->ctl = ctl_new()) == NULL) { - LOG(2, "!ctl_new"); + CORE_LOG_WARNING("!ctl_new"); return -1; } @@ -102,8 +102,8 @@ obj_ctl_init_and_load(PMEMobjpool *pop) if (env_config != NULL) { if (ctl_load_config_from_string(pop ? pop->ctl : NULL, pop, env_config) != 0) { - LOG(2, "unable to parse config stored in %s " - "environment variable", + CORE_LOG_WARNING( + "unable to parse config stored in %s environment variable", OBJ_CONFIG_ENV_VARIABLE); goto err; } @@ -113,10 +113,9 @@ obj_ctl_init_and_load(PMEMobjpool *pop) if (env_config_file != NULL && env_config_file[0] != '\0') { if (ctl_load_config_from_file(pop ? pop->ctl : NULL, pop, env_config_file) != 0) { - LOG(2, "unable to parse config stored in %s " - "file (from %s environment variable)", - env_config_file, - OBJ_CONFIG_FILE_ENV_VARIABLE); + CORE_LOG_WARNING( + "unable to parse config stored in %s file (from %s environment variable)", + env_config_file, OBJ_CONFIG_FILE_ENV_VARIABLE); goto err; } } @@ -1085,7 +1084,7 @@ pmemobj_createU(const char *path, const char *layout, if (util_pool_create(&set, path, poolsize, PMEMOBJ_MIN_POOL, PMEMOBJ_MIN_PART, &adj_pool_attr, &runtime_nlanes, REPLICAS_ENABLED) != 0) { - LOG(2, "cannot create pool or pool set"); + CORE_LOG_WARNING("cannot create pool or pool set"); os_mutex_unlock(&pools_mutex); return NULL; } @@ -1122,7 +1121,7 @@ pmemobj_createU(const char *path, const char *layout, /* create pool descriptor */ if (obj_descr_create(pop, layout, set->poolsize) != 0) { - LOG(2, "creation of pool descriptor failed"); + CORE_LOG_WARNING("creation of pool descriptor failed"); goto err; } @@ -1184,7 +1183,7 @@ obj_check_basic_local(PMEMobjpool *pop, size_t mapped_size) } if ((errno = lane_check(pop)) != 0) { - LOG(2, "!lane_check"); + CORE_LOG_WARNING("!lane_check"); consistent = 0; } @@ -1193,7 +1192,7 @@ obj_check_basic_local(PMEMobjpool *pop, size_t mapped_size) errno = palloc_heap_check((char *)pop + pop->heap_offset, heap_size); if (errno != 0) { - LOG(2, "!heap_check"); + CORE_LOG_WARNING("!heap_check"); consistent = 0; } @@ -1233,7 +1232,7 @@ obj_pool_open(struct pool_set **set, const char *path, unsigned flags, { if (util_pool_open(set, path, PMEMOBJ_MIN_PART, &Obj_open_attr, nlanes, NULL, flags) != 0) { - LOG(2, "cannot open pool or pool set"); + CORE_LOG_WARNING("cannot open pool or pool set"); return -1; } @@ -1370,7 +1369,8 @@ obj_open_common(const char *path, const char *layout, unsigned flags, int boot) PMEMobjpool *rep = repset->part[0].addr; /* check descriptor */ if (obj_descr_check(rep, layout, set->poolsize) != 0) { - LOG(2, "descriptor check of replica #%u failed", r); + CORE_LOG_WARNING( + "descriptor check of replica #%u failed", r); goto err_descr_check; } } @@ -2432,7 +2432,7 @@ pmemobj_root_construct(PMEMobjpool *pop, size_t size, if (size > pop->root_size && obj_alloc_root(pop, size, constructor, arg)) { pmemobj_mutex_unlock_nofail(pop, &pop->rootlock); - LOG(2, "obj_realloc_root failed"); + CORE_LOG_WARNING("obj_realloc_root failed"); PMEMOBJ_API_END(); return OID_NULL; } diff --git a/src/libpmemobj/palloc.c b/src/libpmemobj/palloc.c index e4aa51cddb9..023c015fd73 100644 --- a/src/libpmemobj/palloc.c +++ b/src/libpmemobj/palloc.c @@ -304,7 +304,8 @@ palloc_restore_free_chunk_state(struct palloc_heap *heap, FATAL( "duplicate runtime chunk state, possible double free"); } else { - LOG(2, "unable to track runtime chunk state"); + CORE_LOG_WARNING( + "unable to track runtime chunk state"); } } heap_bucket_release(b); diff --git a/src/libpmempool/pool.c b/src/libpmempool/pool.c index f6d6866e487..d4b734d2619 100644 --- a/src/libpmempool/pool.c +++ b/src/libpmempool/pool.c @@ -187,7 +187,7 @@ pool_params_parse(const PMEMpoolcheck *ppc, struct pool_params *params, ret = util_poolset_create_set(&set, ppc->path, 0, 0, true); if (ret < 0) { - LOG(2, "cannot open pool set -- '%s'", + CORE_LOG_WARNING("cannot open pool set -- '%s'", ppc->path); return -1; } @@ -296,7 +296,7 @@ pool_set_file_open(const char *fname, int rdonly) int ret = util_poolset_create_set(&file->poolset, path, 0, 0, true); if (ret < 0) { - LOG(2, "cannot open pool set -- '%s'", path); + CORE_LOG_WARNING("cannot open pool set -- '%s'", path); goto err_free_fname; } unsigned flags = (rdonly ? POOL_OPEN_COW : 0) | diff --git a/src/libpmempool/replica.c b/src/libpmempool/replica.c index b58ae9a253d..a004d69b418 100644 --- a/src/libpmempool/replica.c +++ b/src/libpmempool/replica.c @@ -1695,9 +1695,11 @@ check_uuids_between_replicas(struct pool_set *set, uuid_t *rep_n_uuidp = NULL; unsigned r_n = REPN_HEALTHidx(set_hs, r); if (get_replica_uuid(rep, r, set_hs, &rep_uuidp)) - LOG(2, "cannot get replica uuid, replica %u", r); + CORE_LOG_WARNING("cannot get replica uuid, replica %u", + r); if (get_replica_uuid(rep_n, r_n, set_hs, &rep_n_uuidp)) - LOG(2, "cannot get replica uuid, replica %u", r_n); + CORE_LOG_WARNING("cannot get replica uuid, replica %u", + r_n); /* * check if replica uuids are consistent between two adjacent @@ -1733,7 +1735,7 @@ check_uuids_between_replicas(struct pool_set *set, unsigned p_nn = replica_find_unbroken_part(r_nn, set_hs); if (p_nn == UNDEF_PART) { - LOG(2, + CORE_LOG_WARNING( "cannot compare uuids on borders of replica %u", r); continue; diff --git a/src/libpmempool/rm.c b/src/libpmempool/rm.c index b8faabcba29..cbb540249a0 100644 --- a/src/libpmempool/rm.c +++ b/src/libpmempool/rm.c @@ -20,7 +20,7 @@ #define ERR_F(f, ...) do {\ if (CHECK_FLAG((f), FORCE))\ - LOG(2, "!(ignored) " __VA_ARGS__);\ + CORE_LOG_WARNING("!(ignored) " __VA_ARGS__);\ else\ ERR_WO_ERRNO(__VA_ARGS__);\ } while (0) @@ -122,11 +122,11 @@ pmempool_rmU(const char *path, unsigned flags) } if (!is_poolset) { - LOG(2, "%s: not a poolset file", path); + CORE_LOG_WARNING("%s: not a poolset file", path); return rm_local(path, flags, 0); } - LOG(2, "%s: poolset file", path); + CORE_LOG_WARNING("%s: poolset file", path); /* fill up pool_set structure */ struct pool_set *set = NULL; diff --git a/src/libpmempool/sync.c b/src/libpmempool/sync.c index ef8bc70762d..e6b927d64ee 100644 --- a/src/libpmempool/sync.c +++ b/src/libpmempool/sync.c @@ -41,7 +41,7 @@ validate_args(struct pool_set *set) * (now replication works only for pmemobj pools) */ if (replica_check_part_sizes(set, PMEMOBJ_MIN_POOL)) { - LOG(2, "part sizes check failed"); + CORE_LOG_WARNING("part sizes check failed"); goto err; } @@ -49,7 +49,7 @@ validate_args(struct pool_set *set) * check if all directories for part files exist */ if (replica_check_part_dirs(set)) { - LOG(2, "part directories check failed"); + CORE_LOG_WARNING("part directories check failed"); goto err; } @@ -849,14 +849,14 @@ recreate_broken_parts(struct pool_set *set, /* remove parts from broken replica */ if (replica_remove_part(set, r, p, fix_bad_blocks)) { - LOG(2, "cannot remove part"); + CORE_LOG_WARNING("cannot remove part"); return -1; } /* create removed part and open it */ if (util_part_open(&broken_r->part[p], 0, 1 /* create */)) { - LOG(2, "cannot open/create parts"); + CORE_LOG_WARNING("cannot open/create parts"); return -1; } diff --git a/src/libpmempool/transform.c b/src/libpmempool/transform.c index f130e14764d..5db7150dfae 100644 --- a/src/libpmempool/transform.c +++ b/src/libpmempool/transform.c @@ -374,13 +374,13 @@ identify_transform_operation(struct poolset_compare_status *set_in_s, for (unsigned r = 0; r < set_in_s->nreplicas; ++r) { unsigned c = replica_counterpart(r, set_in_s); if (c != UNDEF_REPLICA) { - LOG(2, "replica %u has a counterpart %u", r, + CORE_LOG_WARNING("replica %u has a counterpart %u", r, set_in_s->replica[r]); has_replica_to_keep = 1; REP_HEALTH(set_out_hs, c)->pool_size = REP_HEALTH(set_in_hs, r)->pool_size; } else { - LOG(2, "replica %u has no counterpart", r); + CORE_LOG_WARNING("replica %u has no counterpart", r); is_removing_replicas = 1; } } @@ -394,7 +394,8 @@ identify_transform_operation(struct poolset_compare_status *set_in_s, /* check if there are replicas to be added */ for (unsigned r = 0; r < set_out_s->nreplicas; ++r) { if (replica_counterpart(r, set_out_s) == UNDEF_REPLICA) { - LOG(2, "Replica %u from output set has no counterpart", + CORE_LOG_WARNING( + "Replica %u from output set has no counterpart", r); if (is_removing_replicas) { ERR_WO_ERRNO( diff --git a/src/test/traces/traces.c b/src/test/traces/traces.c index f465729d640..e61046bcebf 100644 --- a/src/test/traces/traces.c +++ b/src/test/traces/traces.c @@ -26,7 +26,7 @@ main(int argc, char *argv[]) MAJOR_VERSION, MINOR_VERSION); LOG(0, "Log level NONE"); CORE_LOG_ERROR("Log level ERROR"); - LOG(2, "Log level WARNING"); + CORE_LOG_WARNING("Log level WARNING"); LOG(3, "Log level INFO"); LOG(4, "Log level DEBUG"); diff --git a/src/tools/pmempool/common.c b/src/tools/pmempool/common.c index 4fac0ca94a4..88ebc8419ca 100644 --- a/src/tools/pmempool/common.c +++ b/src/tools/pmempool/common.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -/* Copyright 2014-2023, Intel Corporation */ +/* Copyright 2014-2024, Intel Corporation */ /* * common.c -- definitions of common functions @@ -1304,7 +1304,7 @@ util_pool_clear_badblocks(const char *path, int create) int ret = util_poolset_create_set(&setp, path, 0, 0, POOL_OPEN_IGNORE_SDS); if (ret < 0) { - LOG(2, "cannot open pool set -- '%s'", path); + CORE_LOG_WARNING("cannot open pool set -- '%s'", path); return -1; }