FreeBSD Bugzilla – Attachment 8084 Details for
Bug 17098
/boot/loader hangs on switch to second drive
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 3.33 KB, created by
jhood
on 2000-03-01 18:30:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
jhood
Created:
2000-03-01 18:30:01 UTC
Size:
3.33 KB
patch
obsolete
>diff -ur /sys/boot/common/bcache.c ./common/bcache.c >--- /sys/boot/common/bcache.c Sat Feb 6 09:27:29 1999 >+++ ./common/bcache.c Fri Feb 18 17:35:19 2000 >@@ -23,7 +23,7 @@ > * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > * SUCH DAMAGE. > * >- * $Id: bcache.c,v 1.4.2.1 1999/02/06 14:27:29 dcs Exp $ >+ * $Id: bcache.c,v 1.2 2000/02/18 22:35:19 jhood Exp $ > */ > > /* >@@ -62,17 +62,33 @@ > static int bcache_hits, bcache_misses, bcache_ops, bcache_bypasses; > static int bcache_bcount; > >+static void *bcache_dkstrategy; >+static int bcache_dkunit; >+ > static void bcache_insert(caddr_t buf, daddr_t blkno); > static int bcache_lookup(caddr_t buf, daddr_t blkno); > > /* >+ * Invalidate the cache >+ */ >+void >+bcache_flush(void) >+{ >+ int i; >+ >+ if (bcache_data != NULL) { >+ for (i = 0; i < bcache_nblks; i++) { >+ bcache_ctl[i].bc_count = -1; >+ bcache_ctl[i].bc_blkno = -1; >+ } >+ } >+} >+/* > * Initialise the cache for (nblks) of (bsize). > */ > int > bcache_init(int nblks, size_t bsize) > { >- int i; >- > /* discard any old contents */ > if (bcache_data != NULL) { > free(bcache_data); >@@ -97,11 +113,9 @@ > return(ENOMEM); > } > >- /* Invalidate the cache */ >- for (i = 0; i < bcache_nblks; i++) { >- bcache_ctl[i].bc_count = -1; >- bcache_ctl[i].bc_blkno = -1; >- } >+ bcache_dkstrategy = NULL; >+ >+ /* bcache_flush() will happen on first call to bcache_strategy */ > > return(0); > } >@@ -130,6 +144,16 @@ > DEBUG("bypass %d from %d", size / bcache_blksize, blk); > bcache_bypasses++; > return(dd->dv_strategy(dd->dv_devdata, rw, blk, size, buf, rsize)); >+ } >+ >+ /* has a new device/unit been requested? flush cache */ >+ if ((bcache_dkstrategy != dd->dv_strategy) || >+ (bcache_dkunit != dd->dv_dkunit)) { >+ DEBUG("cache flush, lastunit = %d newunit = %d", >+ bcache_dkunit, dd->dv_dkunit); >+ bcache_flush(); >+ bcache_dkstrategy = dd->dv_strategy; >+ bcache_dkunit = dd->dv_dkunit; > } > > nblk = size / bcache_blksize; >diff -ur /sys/boot/common/bootstrap.h ./common/bootstrap.h >--- /sys/boot/common/bootstrap.h Sat Feb 6 09:27:29 1999 >+++ ./common/bootstrap.h Fri Feb 18 17:35:20 2000 >@@ -23,7 +23,7 @@ > * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > * SUCH DAMAGE. > * >- * $Id: bootstrap.h,v 1.18.2.1 1999/02/06 14:27:29 dcs Exp $ >+ * $Id: bootstrap.h,v 1.2 2000/02/18 22:35:20 jhood Exp $ > */ > > #include <sys/types.h> >@@ -84,6 +84,7 @@ > struct bcache_devdata > { > int (*dv_strategy)(void *devdata, int rw, daddr_t blk, size_t size, void *buf, size_t *rsize); >+ int dv_dkunit; > void *dv_devdata; > }; > >diff -ur /sys/boot/i386/libi386/biosdisk.c ./i386/libi386/biosdisk.c >--- /sys/boot/i386/libi386/biosdisk.c Tue Mar 16 09:58:25 1999 >+++ ./i386/libi386/biosdisk.c Fri Feb 18 17:35:47 2000 >@@ -23,7 +23,7 @@ > * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > * SUCH DAMAGE. > * >- * $Id: biosdisk.c,v 1.20.2.4 1999/03/16 14:58:25 dcs Exp $ >+ * $Id: biosdisk.c,v 1.3 2000/02/18 22:35:47 jhood Exp $ > */ > > /* >@@ -573,6 +575,8 @@ > struct bcache_devdata bcd; > > bcd.dv_strategy = bd_realstrategy; >+ bcd.dv_dkunit = ((struct open_disk *)(((struct i386_devdesc *) >+ devdata)->d_kind.biosdisk.data))->od_dkunit; > bcd.dv_devdata = devdata; > return(bcache_strategy(&bcd, rw, dblk, size, buf, rsize)); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 17098
: 8084