Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144336930
D30848.id91198.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D30848.id91198.diff
View Options
Index: stand/efi/libefi/efipart.c
===================================================================
--- stand/efi/libefi/efipart.c
+++ stand/efi/libefi/efipart.c
@@ -935,8 +935,9 @@
static int
efipart_close(struct open_file *f)
{
- struct disk_devdesc *dev;
+ struct disk_devdesc *dev, *currdev;
pdinfo_t *pd;
+ int rc;
dev = (struct disk_devdesc *)(f->f_devdata);
if (dev == NULL)
@@ -946,14 +947,33 @@
if (pd == NULL)
return (EINVAL);
+ if (dev->dd.d_dev->dv_type == DEVT_DISK) {
+ rc = disk_close(dev);
+ if (rc != 0)
+ return (rc);
+ }
pd->pd_open--;
+
+ /*
+ * Check if this disk is our current filesystem device.
+ * if it is, preserve pd_bcache to avoid cache flushes.
+ */
+ rc = archsw.arch_getdev((void **)&currdev, NULL, NULL);
+ if (rc == 0) {
+ if (strcmp(dev->dd.d_dev->dv_name,
+ currdev->dd.d_dev->dv_name) == 0 &&
+ dev->dd.d_dev->dv_type == currdev->dd.d_dev->dv_type &&
+ dev->dd.d_unit == currdev->dd.d_unit) {
+ return (0);
+ }
+ } else {
+ rc = 0;
+ }
+
if (pd->pd_open == 0) {
- pd->pd_blkio = NULL;
bcache_free(pd->pd_bcache);
pd->pd_bcache = NULL;
}
- if (dev->dd.d_dev->dv_type == DEVT_DISK)
- return (disk_close(dev));
return (0);
}
Index: stand/i386/libi386/biosdisk.c
===================================================================
--- stand/i386/libi386/biosdisk.c
+++ stand/i386/libi386/biosdisk.c
@@ -879,22 +879,42 @@
static int
bd_close(struct open_file *f)
{
- struct disk_devdesc *dev;
+ struct disk_devdesc *dev, *currdev;
bdinfo_t *bd;
- int rc = 0;
+ int rc;
dev = (struct disk_devdesc *)f->f_devdata;
bd = bd_get_bdinfo(&dev->dd);
if (bd == NULL)
return (EIO);
+ if (dev->dd.d_dev->dv_type == DEVT_DISK) {
+ rc = disk_close(dev);
+ if (rc != 0)
+ return (rc);
+ }
bd->bd_open--;
+
+ /*
+ * Check if this disk is our current filesystem device.
+ * if it is, preserve bd_bcache to avoid cache flushes.
+ */
+ rc = archsw.arch_getdev((void **)&currdev, NULL, NULL);
+ if (rc == 0) {
+ if (strcmp(dev->dd.d_dev->dv_name,
+ currdev->dd.d_dev->dv_name) == 0 &&
+ dev->dd.d_dev->dv_type == currdev->dd.d_dev->dv_type &&
+ dev->dd.d_unit == currdev->dd.d_unit) {
+ return (0);
+ }
+ } else {
+ rc = 0;
+ }
+
if (bd->bd_open == 0) {
bcache_free(bd->bd_bcache);
bd->bd_bcache = NULL;
}
- if (dev->dd.d_dev->dv_type == DEVT_DISK)
- rc = disk_close(dev);
return (rc);
}
Index: stand/userboot/userboot/userboot_disk.c
===================================================================
--- stand/userboot/userboot/userboot_disk.c
+++ stand/userboot/userboot/userboot_disk.c
@@ -176,15 +176,38 @@
static int
userdisk_close(struct open_file *f)
{
- struct disk_devdesc *dev;
+ struct disk_devdesc *dev, *currdev;
+ int rc;
dev = (struct disk_devdesc *)f->f_devdata;
+ if (dev->dd.d_dev->dv_type == DEVT_DISK) {
+ rc = disk_close(dev);
+ if (rc != 0)
+ return (rc);
+ }
ud_info[dev->dd.d_unit].ud_open--;
+
+ /*
+ * Check if this disk is our current filesystem device.
+ * if it is, preserve ud_bcache to avoid cache flushes.
+ */
+ rc = archsw.arch_getdev((void **)&currdev, NULL, NULL);
+ if (rc == 0) {
+ if (strcmp(dev->dd.d_dev->dv_name,
+ currdev->dd.d_dev->dv_name) == 0 &&
+ dev->dd.d_dev->dv_type == currdev->dd.d_dev->dv_type &&
+ dev->dd.d_unit == currdev->dd.d_unit) {
+ return (0);
+ }
+ } else {
+ rc = 0;
+ }
+
if (ud_info[dev->dd.d_unit].ud_open == 0) {
bcache_free(ud_info[dev->dd.d_unit].ud_bcache);
ud_info[dev->dd.d_unit].ud_bcache = NULL;
}
- return (disk_close(dev));
+ return (rc);
}
static int
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 8, 10:18 PM (5 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28504071
Default Alt Text
D30848.id91198.diff (3 KB)
Attached To
Mode
D30848: loader: implement mount/unmount rootfs
Attached
Detach File
Event Timeline
Log In to Comment