-
Notifications
You must be signed in to change notification settings - Fork 13
[VDO-5752] [VDOSTORY-292] Add formatting logic #334
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
base: feature/add-vdoformat-into-kernel
Are you sure you want to change the base?
[VDO-5752] [VDOSTORY-292] Add formatting logic #334
Conversation
57230c6 to
185361e
Compare
185361e to
f42f855
Compare
lorelei-sakai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, ran out of steam by the time I got to the tests, but tey looks familiar and mostly reasonable.
Most comments are on the way the code is structured and ordered, and it's very likely I don't remember some of the nuances involved. Probably we should sit down and talk some of these things out face-to-face. We can do it Thursday if there's no time earlier.
src/c++/vdo/base/vdo.c
Outdated
| return vdo_get_admin_state_code(&vdo->admin.state); | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra blank line added. Reminds me to check my own work-in-progress, I think I've seen cursor do this to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I removed this properly
src/c++/vdo/base/vdo.c
Outdated
| result = read_geometry_block(vdo); | ||
| if (result != VDO_SUCCESS) { | ||
| *reason = "Could not load geometry block"; | ||
| *reason = "Could not read geometry block"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I see what you're trying to clarify here, but I would hesitate to change an error message like this; there could be scripts or users that are relying on the current error string. (They really shouldn't, but this sort of thing can also cause trouble for very little benefit.)
Fine if you still want to do it, just making sure you're aware of the hazards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I turned the message back to load
| struct volume_geometry *geometry); | ||
|
|
||
| int vdo_encode_volume_geometry(u8 *buffer, const struct volume_geometry *geometry); | ||
| int vdo_encode_volume_geometry(u8 *buffer, const struct volume_geometry *geometry, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version parameter being added to vdo_encode_volume() here (commit 3) doesn't really make sense to me. I expected it to get included with the rest of the function when you "added" it in commit 2. Could we move these bits into commit 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After looking at this, I am not sure why encode_volume_geometry ended up in commit 2 at all. Its for writing to disk. I think i should move everything to commit 3 instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reworked the commits. Hopefully they make more sense now.
src/c++/vdo/base/vdo.c
Outdated
| result = vdo_initialize_component_states(&vdo_config, &vdo->geometry, nonce, &vdo->states); | ||
| if (result != VDO_SUCCESS) { | ||
| *error_ptr = "Could not initialize data layout during format"; | ||
| if (result == VDO_NO_SPACE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling this error condition as
if (result == VDO_NO_SPACE) { ... } else if (result != VDO_SUCCESS) { ... }
would save you an indentation level, and the slighty confusing oddity of setting the error_ptr string twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done this
src/c++/vdo/user/userVDO.c
Outdated
| if (result != VDO_SUCCESS) | ||
| return result; | ||
|
|
||
| memcpy(block, VDO_GEOMETRY_MAGIC_NUMBER, VDO_GEOMETRY_MAGIC_NUMBER_SIZE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like it better if the userspace changes got added immediately next to the kernel code they enabled.
And the encode_geometry changes seem completely separable from the blkdev_issue_zeroout and uuid additions. The corresponding kernel code bits are in different commits, the userspace parts could be, too.
As a reviewer, it's easier if the userspace changes are close (in terms of commit count distance) to the matching kernel changes. And also this commit (commit 4) feels a bit overstuffed in general. It's fine-ish, but it feels like it's near the line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reworked the commits to hopefully do what you are asking here
| typedef int pid_t; | ||
| typedef u64 sector_t; | ||
|
|
||
| typedef unsigned int gfp_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you move this typedef? I mean the move seems fine but it's three files that seem like they didn't actually have to change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the new function is in uds. I believe you wanted it there. the original typedef was in vdo/fake, so I moved it to uds as well
| @@ -0,0 +1,93 @@ | |||
| /* | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm too tired to read this carefully, so just one question for now:
This unit test, we talked about it before, right? And it's basically what you had before, there aren't any changes to it?
It looks mostly familiar, and I definitely don't want to waste time re-litigating anything we've already hashed out just because I'm too tired to remember the previous discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't changed the unit test. and yes, we've talked about it before. I used to have 3 separate unit tests and you wanted one, as well as some other cleanup.
|
|
||
| $storageDevice->extend($lessThanNeeded); | ||
|
|
||
| my $extend1Cursor = $machine->getKernelJournalCursor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mostly looks familiar, too, I'll read it carefully later. Just one comment for now, these albMemory => 2 caes should maybe get a comment explaining why we expect them to fail in tests, because in general it's a perfectly reasonable VDO configuration. (If I recall correctly, it's that our pfarms are too small to have the required memory? But we should definitely document a hardware/platform dependency like that.)
bjohnsto
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra blank line added. Reminds me to check my own work-in-progress, I think I've seen cursor do this to me.
Yeah cursor does this too me a lot.
Add additional admin states for in kernel formatting. Signed-off-by: Bruce Johnston <[email protected]>
Add logic to decide when to format and initialize the appropriate structures. Formatting is decided upon by reading the geometry block of the VDO (block 0 on the storage) and determining if that block is all zeroes. If it is we format the device. If not we assume there is already an existing vdo on disk and simply attempt to load that. Signed-off-by: Bruce Johnston <[email protected]>
Add user mode version of uuid_gen function. Signed-off-by: Bruce Johnston <[email protected]>
Write the initialized structures to the underlying disk. We should not be writing to disk during dmsetup create, so do the write during the dm target's pre-resume operation. Signed-off-by: Bruce Johnston <[email protected]>
Add user mode version of blkdev_issue_zeroout function. Since the function is being put in the uds code, we also need to move the definition of gfp_t to uds code. Signed-off-by: Bruce Johnston <[email protected]>
Adds support for in kernel formatting in unit tests and adds a new unit test to test such formatting. One subtest in FormatVDOInKernel_t1,c mimics FormatVDO_t1.c and one mimics FormatVDO_t3.c. There is no version for FormatVDO_t2.c because it makes no sense to have 0 as the logical size passed into the dmsetup code since dmsetup blocks such a thing with an error. Signed-off-by: Bruce Johnston <[email protected]>
Adds additional tests now that formatting actually works. Signed-off-by: Bruce Johnston <[email protected]>
f42f855 to
95ccd11
Compare
This series of commits is the final set of changes for moving vdoformat into the kernel. The changes add the logic for when to format or not and the actual layout initialization and writing of the layout to disk when formatting is needed. Additionally, it adds unit test support and more functional tests to the VDOFormatInKernel.pm perl test.