Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146441711
D55521.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D55521.diff
View Options
diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c
--- a/sys/cam/nvme/nvme_da.c
+++ b/sys/cam/nvme/nvme_da.c
@@ -432,7 +432,7 @@
("nda %d outstanding commands", softc->outstanding_cmds));
cam_periph_unlock(periph);
cam_periph_release(periph);
- return (0);
+ return (0);
}
static void
@@ -760,17 +760,23 @@
}
case AC_GETDEV_CHANGED:
{
- int error;
+ off_t mediasize;
+ u_int sectorsize;
softc = periph->softc;
+ mediasize = softc->disk->d_mediasize;
+ sectorsize = softc->disk->d_sectorsize;
ndasetgeom(softc, periph);
- error = disk_resize(softc->disk, M_NOWAIT);
- if (error != 0) {
- xpt_print(periph->path, "disk_resize(9) failed, error = %d\n", error);
- break;
- }
+ /*
+ * If the sectorsize changed, then it's new media. Otherwise if
+ * the media size changed, resize the existing disk. Otherwise
+ * do nothing.
+ */
+ if (sectorsize != softc->disk->d_sectorsize)
+ disk_media_changed(softc->disk, M_WAITOK);
+ else if (mediasize != softc->disk->d_mediasize)
+ disk_resize(softc->disk, M_WAITOK);
break;
-
}
case AC_ADVINFO_CHANGED:
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 3, 5:36 PM (13 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29007435
Default Alt Text
D55521.diff (1 KB)
Attached To
Mode
D55521: nda: AC_GETDEV_CHANGED calls media chanaged for sectorsize change
Attached
Detach File
Event Timeline
Log In to Comment