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
Unknown Object (File)
Tue, Dec 24, 1:36 PM
Unknown Object (File)
Tue, Dec 24, 1:31 PM
Unknown Object (File)
Sat, Dec 21, 8:18 PM
Unknown Object (File)
Fri, Dec 13, 3:44 AM
Unknown Object (File)
Nov 25 2024, 8:54 PM
Unknown Object (File)
Nov 25 2024, 6:46 AM
Unknown Object (File)
Nov 22 2024, 11:32 PM
Unknown Object (File)
Nov 20 2024, 3:32 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 43106
Build 39994: 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
717

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

939

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

sys/dev/nvme/nvme.c
281 ↗(On Diff #98635)

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
373

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
717

OK, remove this output.

939

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
373

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?