Page MenuHomeFreeBSD

nvme: nvd/nda call disk_resize() when namespace changed async event happened
Changes PlannedPublic

Authored by wanpengqian_gmail.com on Nov 17 2021, 9:03 AM.
Tags
None
Referenced Files
F102914058: D33032.diff
Mon, Nov 18, 4:45 PM
F102844847: D33032.id99354.diff
Sun, Nov 17, 10:10 PM
Unknown Object (File)
Wed, Nov 13, 2:24 PM
Unknown Object (File)
Tue, Nov 5, 11:09 AM
Unknown Object (File)
Sun, Oct 27, 7:26 PM
Unknown Object (File)
Sat, Oct 26, 10:12 PM
Unknown Object (File)
Oct 15 2024, 8:11 PM
Unknown Object (File)
Oct 13 2024, 9:37 PM
Subscribers

Details

Reviewers
imp
chuck
jhb
Group Reviewers
cam
Summary

Take D32963 and make nvd/nda resize after namespace changed async event trigger.

create a new thread and this thread will update namespace data when needed.

nvd can now call resize_disk() and update the disk size properly.

for nda, after NVME_PROBE_IDENTIFY_NS is finish, fire a AC_GETDEV_CHANGED event,
and it will call resize_disk() to adjust disk size.

Test Plan

When bhyve vm resize disk, verify diskinfo output inside guest, both nvd and nda.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 42837
Build 39725: arc lint + arc unit

Event Timeline

imp requested changes to this revision.Nov 17 2021, 4:04 PM

Like I said before, we shouldn't be basing this off the async callback, but instead the namespace change stuff.
Namespaces can arrive and depart, and this doesn't cope with that aspect of things, just the size change.

sys/cam/nvme/nvme_da.c
719

You can't do this in the kernel. the stack is too small.

955

I think this should be after we set the other parameters.

sys/dev/nvme/nvme.c
281

No. Like I said before, we do not want to parse the NVME log pages in the clients. This change is wrong.

sys/dev/nvme/nvme_ctrlr.c
760

I think this is wrong on many levels.

sys/dev/nvme/nvme_sim.c
361

this is also wrong. It doesn't handle the multiple name spaces arriving or departing. It only handles the size change.

This revision now requires changes to proceed.Nov 17 2021, 4:04 PM
wanpengqian_gmail.com retitled this revision from nvme: nda call disk_resize() when namespace changed async event happened to nvme: nvd/nda call disk_resize() when namespace changed async event happened.Dec 1 2021, 8:38 AM
wanpengqian_gmail.com edited the summary of this revision. (Show Details)
wanpengqian_gmail.com added inline comments.
sys/cam/nvme/nvme_da.c
719

OK, remove this output.

955

Yes, I did not match the original sequence.

sys/dev/nvme/nvme_ctrlr.c
760

since notify_ns will query the namespace, that will cause kernel panic. here we post a query request to queue. other thread will query and construct_ns and call notify_ns after that.

sys/dev/nvme/nvme_sim.c
361

I will not use async callback this time.

wanpengqian_gmail.com marked an inline comment as done.

after NVME_PROBE_IDENTIFY_NS is done, fire a AC_GETDEV_CHANGED async event.

wanpengqian_gmail.com edited the test plan for this revision. (Show Details)

I tested with 14.0-CURRENT Oct 10 2022, and it works. Is it the right direction for dynamically changing the disk size after hosts resize the disk?