Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: skip warning: "Cannot find any matching device, no bad blocks found" #6127

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

grom72
Copy link
Contributor

@grom72 grom72 commented Oct 25, 2024

Skip warning: "Cannot find any matching device, no bad blocks found" when pmem2_badblock_next() is used internally.

Fixes: #6126


This change is Reviewable

@grom72 grom72 added Priority: 1 urgent DAOS DAOS-related sprint goal This pull request is part of the ongoing sprint no changelog Add to skip the changelog check on your pull request labels Oct 25, 2024
@grom72 grom72 requested review from janekmi and osalyk October 25, 2024 23:17
@grom72 grom72 force-pushed the 6126-no-warning-on-pool-open branch 5 times, most recently from 3f49fab to a41b5ac Compare October 27, 2024 14:47
@grom72 grom72 changed the title common: skip warning: 'No bad blocks found' common: skip warning: "Cannot find any matching device, no bad blocks found" Oct 28, 2024
Copy link
Contributor

@janekmi janekmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 4 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 9 unresolved discussions (waiting on @grom72 and @osalyk)


-- commits line 12 at r2:
Please rebase.

Code quote:

New commits in r2 on 10/27/2024 at 2:21 PM:
- a41b5ac: common: fix scan only for PR

  Signed-off-by: Tomasz Gromadzki <tomasz.gromadzki@intel.com>

src/common/bad_blocks.c line 17 at r1 (raw file):

#include "vec.h"
#include "os.h"
#include "../libpmem2/badblock.h"

Ugly but true.

Suggestion:

#include "bad_blocks.h"
#include "out.h"
#include "core_assert.h"
#include "vec.h"
#include "os.h"
#include "badblocks.h"

src/libpmem2/badblocks_ndctl.c line 30 at r1 (raw file):

#include "set_badblocks.h"
#include "extent.h"
#include "badblock.h"

It ought to be probably plural badblocks.h.


src/libpmem2/badblocks_ndctl.c line 531 at r1 (raw file):

/*
 * pmem2_badblock_next -- get the next bad block

Outdated doc.


src/libpmem2/badblocks_ndctl.c line 534 at r1 (raw file):

 */
int
pmem2_badblock_next_int(struct pmem2_badblock_context *bbctx,

int is too integer-like to me. Can we make it unabbreviate _internal?


src/libpmem2/badblocks_ndctl.c line 538 at r1 (raw file):

{
	LOG(3, "bbctx %p bb %p", bbctx, bb);
	PMEM2_ERR_CLR();

Is this bit still necessary assuming there is an intermedia function when it is called by the user?

Code quote:

	LOG(3, "bbctx %p bb %p", bbctx, bb);
	PMEM2_ERR_CLR();

src/libpmem2/badblocks_ndctl.c line 676 at r1 (raw file):

	return 0;
}

Missing newline.


src/libpmem2/badblocks_ndctl.c line 683 at r1 (raw file):

	LOG(3, "bbctx %p bb %p", bbctx, bb);
	PMEM2_ERR_CLR();
	return pmem2_badblock_next_int(bbctx, bb, 1);

It goes without words that this solution is just plainly ugly. 👻

Can we make it anything like the proposed below?

So, the pmem2_badblock_next_internal() would just return error codes (no additional argument). Where some of them would also generate an error message if called from via pmem2_badblock_next()?

Suggestion:

	LOG(3, "bbctx %p bb %p", bbctx, bb);
	PMEM2_ERR_CLR();

	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;

src/libpmem2/badblocks_none.c line 47 at r1 (raw file):

}int

pmem2_badblock_next(struct pmem2_badblock_context *bbctx,

Suggestion:

}

int
pmem2_badblock_next(struct pmem2_badblock_context *bbctx,

@grom72 grom72 force-pushed the 6126-no-warning-on-pool-open branch from a41b5ac to b397640 Compare October 29, 2024 07:23
Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r3, 13 of 15 files at r4.
Reviewable status: 14 of 16 files reviewed, 9 unresolved discussions (waiting on @janekmi and @osalyk)


-- commits line 12 at r2:

Previously, janekmi (Jan Michalski) wrote…

Please rebase.

Done.


src/common/bad_blocks.c line 17 at r1 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Ugly but true.

common/badblocks.h -> common/bad_blocks.h
but #include "../libpmem2/badblock.h" must stay as common does not access libpmem2 by default


src/libpmem2/badblocks_ndctl.c line 30 at r1 (raw file):

Previously, janekmi (Jan Michalski) wrote…

It ought to be probably plural badblocks.h.

Done.


src/libpmem2/badblocks_ndctl.c line 531 at r1 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Outdated doc.

Done.


src/libpmem2/badblocks_ndctl.c line 534 at r1 (raw file):

Previously, janekmi (Jan Michalski) wrote…

int is too integer-like to me. Can we make it unabbreviate _internal?

Done.


src/libpmem2/badblocks_ndctl.c line 538 at r1 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Is this bit still necessary assuming there is an intermedia function when it is called by the user?

Done.


src/libpmem2/badblocks_ndctl.c line 676 at r1 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Missing newline.

Done.


src/libpmem2/badblocks_ndctl.c line 683 at r1 (raw file):

Previously, janekmi (Jan Michalski) wrote…

It goes without words that this solution is just plainly ugly. 👻

Can we make it anything like the proposed below?

So, the pmem2_badblock_next_internal() would just return error codes (no additional argument). Where some of them would also generate an error message if called from via pmem2_badblock_next()?

Done.


src/libpmem2/badblocks_none.c line 47 at r1 (raw file):

}int

pmem2_badblock_next(struct pmem2_badblock_context *bbctx,

Done.

Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 4 files at r1.
Reviewable status: 14 of 16 files reviewed, 9 unresolved discussions (waiting on @janekmi and @osalyk)

Copy link
Contributor

@janekmi janekmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r3, 15 of 15 files at r4, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @grom72 and @osalyk)


src/common/bad_blocks.c line 17 at r4 (raw file):

#include "vec.h"
#include "os.h"
#include "../libpmem2/badblocks.h"

IMHO it would be better to add INCS += -I../libpmem2 at the end of the Makefile file to make this dependency explicit on the build system level.

Please consider.

Suggestion:

#include "badblocks.h"

src/libpmem2/badblocks_ndctl.c line 531 at r4 (raw file):

/*
 * pmem2_badblock_next_internal -- get the next bad block impelmentation

IMHO words referring to writing code should be banned from the source code. Obviously, it is an implementation. There are no other things you write in the source code except for implementations of various things.

Suggestion:

get the next bad block

src/libpmem2/badblocks_ndctl.c line 537 at r4 (raw file):

			struct pmem2_badblock *bb)
{
	LOG(4, "bbctx %p bb %p", bbctx, bb);

As far as I can tell level 3 is in use for this purpose.

Suggestion:

LOG(3, "bbctx %p bb %p", bbctx, bb);

src/libpmem2/badblocks_none.c line 36 at r4 (raw file):

/*
 * pmem2_badblock_next_internal -- get the next bad block implementation

.

Suggestion:

get the next bad block

src/common/bad_blocks.h line 77 at r4 (raw file):

#endif

#endif /* PMDK_BADBLOCKS_H */

Suggestion:

#endif /* PMDK_BAD_BLOCKS_H */

src/libpmem2/badblocks.h line 22 at r4 (raw file):

#endif

#endif

Suggestion:

#endif /* PMEM2_BADBLOCKS_H */

Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @janekmi and @osalyk)


src/common/bad_blocks.c line 17 at r4 (raw file):

Previously, janekmi (Jan Michalski) wrote…

IMHO it would be better to add INCS += -I../libpmem2 at the end of the Makefile file to make this dependency explicit on the build system level.

Please consider.

but such solution is already used in other common files ...


src/libpmem2/badblocks_ndctl.c line 537 at r4 (raw file):

Previously, janekmi (Jan Michalski) wrote…

As far as I can tell level 3 is in use for this purpose.

but it is not a part of public API I do not want to put such mesage on the screen

@grom72 grom72 force-pushed the 6126-no-warning-on-pool-open branch from b397640 to feb3b30 Compare October 29, 2024 17:42
Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @janekmi and @osalyk)


src/libpmem2/badblocks_ndctl.c line 531 at r4 (raw file):

Previously, janekmi (Jan Michalski) wrote…

IMHO words referring to writing code should be banned from the source code. Obviously, it is an implementation. There are no other things you write in the source code except for implementations of various things.

Done.


src/libpmem2/badblocks_none.c line 36 at r4 (raw file):

Previously, janekmi (Jan Michalski) wrote…

.

Done


src/libpmem2/badblocks.h line 22 at r4 (raw file):

#endif

#endif

It is not obvious ;) but let's do it.

Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 16 files reviewed, 6 unresolved discussions (waiting on @janekmi and @osalyk)


src/common/bad_blocks.h line 77 at r4 (raw file):

#endif

#endif /* PMDK_BADBLOCKS_H */

Done.

Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 15 files at r6.
Reviewable status: 2 of 16 files reviewed, 6 unresolved discussions (waiting on @janekmi and @osalyk)

Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 4 files at r1.
Reviewable status: 2 of 16 files reviewed, 6 unresolved discussions (waiting on @janekmi and @osalyk)

Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 4 files at r1, 1 of 15 files at r6.
Reviewable status: 3 of 16 files reviewed, 6 unresolved discussions (waiting on @janekmi and @osalyk)

@grom72 grom72 force-pushed the 6126-no-warning-on-pool-open branch from feb3b30 to be24d40 Compare October 31, 2024 13:39
Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 13 of 15 files at r6, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @janekmi and @osalyk)


src/common/bad_blocks.c line 17 at r4 (raw file):

Previously, grom72 (Tomasz Gromadzki) wrote…

but such solution is already used in other common files ...

and I do not want to play with pmdk's Makefiles

Skip warning: "Cannot find any matching device, no bad blocks found"
when pmem2_badblock_next() is used internally.

Signed-off-by: Tomasz Gromadzki <tomasz.gromadzki@intel.com>
Copy link
Contributor

@janekmi janekmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 14 of 15 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @osalyk)

@grom72 grom72 force-pushed the 6126-no-warning-on-pool-open branch from be24d40 to 6b1f50c Compare November 5, 2024 09:58
Copy link
Contributor

@osalyk osalyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 4 of 4 files at r1, 1 of 1 files at r2, 1 of 1 files at r3, 15 of 15 files at r6, 1 of 1 files at r8, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @grom72)

Copy link
Contributor

@janekmi janekmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 15 files at r6, 1 of 1 files at r8, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @grom72)

@janekmi janekmi merged commit 518b742 into pmem:master Nov 5, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DAOS DAOS-related no changelog Add to skip the changelog check on your pull request Priority: 1 urgent sprint goal This pull request is part of the ongoing sprint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unnecessary warning: "Cannot find any matching device, no bad blocks found" for non-pmem HW
3 participants