Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F106138448
D31623.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
D31623.diff
View Options
diff --git a/stand/common/bcache.c b/stand/common/bcache.c
--- a/stand/common/bcache.c
+++ b/stand/common/bcache.c
@@ -66,6 +66,7 @@
caddr_t bcache_data;
size_t bcache_nblks;
size_t ra;
+ daddr_t bcache_nextblkno;
};
static u_int bcache_total_nblks; /* set by bcache_init */
@@ -163,6 +164,7 @@
}
bcache_units++;
bc->ra = BCACHE_READAHEAD; /* optimistic read ahead */
+ bc->bcache_nextblkno = -1;
return (bc);
}
@@ -291,6 +293,14 @@
else
ra = bc->bcache_nblks - BHASH(bc, p_blk + p_size);
+ /*
+ * Only trigger read-ahead if we detect two blocks being read
+ * sequentially.
+ */
+ if ((bc->bcache_nextblkno != blk) && ra != 0) {
+ ra = 0;
+ }
+
if (ra != 0 && ra != bc->bcache_nblks) { /* do we have RA space? */
ra = MIN(bc->ra, ra - 1);
ra = rounddown(ra, 16); /* multiple of 16 blocks */
@@ -342,8 +352,11 @@
}
done:
- if ((result == 0) && (rsize != NULL))
- *rsize = size;
+ if (result == 0) {
+ if (rsize != NULL)
+ *rsize = size;
+ bc->bcache_nextblkno = blk + (size / DEV_BSIZE);
+ }
return(result);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 27, 1:01 AM (11 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15609681
Default Alt Text
D31623.diff (1 KB)
Attached To
Mode
D31623: Make boot block read-ahead caching algorithm smarter
Attached
Detach File
Event Timeline
Log In to Comment