summaryrefslogtreecommitdiffstats
path: root/sys/boot/alpha
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>1998-11-02 23:28:11 +0000
committermsmith <msmith@FreeBSD.org>1998-11-02 23:28:11 +0000
commit7ff854a690d0b1907eb91aa8563be0d65545984d (patch)
tree4b5368009c1e11ed85475d58f2f379071897c96a /sys/boot/alpha
parent459dfe3332e2fac684dc0f5ce1af023d9101c0b0 (diff)
downloadFreeBSD-src-7ff854a690d0b1907eb91aa8563be0d65545984d.zip
FreeBSD-src-7ff854a690d0b1907eb91aa8563be0d65545984d.tar.gz
Implement a simple LRU block cache. By default this is initialised to 16k,
and will bypass transfers for more than 8k. Blocks are invalidated after 2 seconds, so removable media should not confuse the cache. The 8k threshold is a compromise; all UFS transfers performed by libstand are 8k or less, so large file reads thrash the cache. However many filesystem metadata operations are also performed using 8k blocks, so using a lower threshold gives poor performance. Those of you with an eye for cache algorithms are welcome to tell me how badly this one sucks; you can start with the 'bcachestats' command which will print the contents of the cache and access statistics.
Diffstat (limited to 'sys/boot/alpha')
-rw-r--r--sys/boot/alpha/common/main.c7
-rw-r--r--sys/boot/alpha/libalpha/srmdisk.c19
2 files changed, 19 insertions, 7 deletions
diff --git a/sys/boot/alpha/common/main.c b/sys/boot/alpha/common/main.c
index 2776b08..4140024 100644
--- a/sys/boot/alpha/common/main.c
+++ b/sys/boot/alpha/common/main.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: main.c,v 1.7 1998/10/24 00:31:21 msmith Exp $
+ * $Id: main.c,v 1.8 1998/10/31 17:12:32 dfr Exp $
*/
@@ -142,6 +142,11 @@ main(void)
OSFpal();
/*
+ * Initialise the block cache
+ */
+ bcache_init(32, 512); /* 16k XXX tune this */
+
+ /*
* March through the device switch probing for things.
*/
for (i = 0; devsw[i] != NULL; i++)
diff --git a/sys/boot/alpha/libalpha/srmdisk.c b/sys/boot/alpha/libalpha/srmdisk.c
index bd74ba7..f071e15 100644
--- a/sys/boot/alpha/libalpha/srmdisk.c
+++ b/sys/boot/alpha/libalpha/srmdisk.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: srmdisk.c,v 1.1.1.1 1998/08/21 03:17:42 msmith Exp $
+ * $Id: srmdisk.c,v 1.2 1998/10/31 17:12:32 dfr Exp $
*/
/*
@@ -61,6 +61,7 @@
static int bd_init(void);
static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t size, void *buf, size_t *rsize);
+static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, size_t size, void *buf, size_t *rsize);
static int bd_open(struct open_file *f, void *vdev);
static int bd_close(struct open_file *f);
static void bd_print(int verbose);
@@ -70,10 +71,6 @@ struct open_disk {
int od_unit; /* our unit number */
int od_boff; /* block offset from beginning of SRM disk */
int od_flags;
-#define BD_MODEMASK 0x3
-#define BD_MODEINT13 0x0
-#define BD_MODEEDD1 0x1
-#define BD_MODEEDD3 0x2
#define BD_FLOPPY (1<<2)
u_char od_buf[BUFSIZE]; /* transfer buffer (do we want/need this?) */
};
@@ -326,7 +323,17 @@ bd_close(struct open_file *f)
}
static int
-bd_strategy(void *devdata, int flag, daddr_t dblk, size_t size, void *buf, size_t *rsize)
+bd_strategy(void *devdata, int rw, daddr_t dblk, size_t size, void *buf, size_t *rsize)
+{
+ struct bcache_devdata bcd;
+
+ bcd.dv_strategy = bd_realstrategy;
+ bcd.dv_devdata = devdata;
+ return(bcache_strategy(&bcd, rw, dblk, size, buf, rsize));
+}
+
+static int
+bd_realstrategy(void *devdata, int flag, daddr_t dblk, size_t size, void *buf, size_t *rsize)
{
prom_return_t ret;
struct open_disk *od = (struct open_disk *)devdata;
OpenPOWER on IntegriCloud