The branch main has been updated by cperciva:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=248682a589159619aa5f2019e415a423e849e327

commit 248682a589159619aa5f2019e415a423e849e327
Author:     Colin Percival <[email protected]>
AuthorDate: 2021-10-03 21:55:10 +0000
Commit:     Colin Percival <[email protected]>
CommitDate: 2021-10-03 21:55:10 +0000

    loader bcache: Allow readahead up to 256 kB I/Os
    
    Prior to this commit, the loader would perform readaheads of up to
    128 kB; when booting on a UFS filesystem this resulted in a series
    of 160 kB reads (32 kB request + 128 kB readahead).
    
    This commit allows readaheads to be longer, subject to a total I/O
    size limit of 256 kB; i.e. 32 kB read requests will have added
    readaheads of up to 224 kB.
    
    In my testing on an EC2 c5.xlarge instance, this change reduces the
    boot time by roughly 80 ms.
    
    Reviewed by:    tsoome
    MFC after:      1 week
    Sponsored by:   https://www.patreon.com/cperciva
    Differential Revision:  https://reviews.freebsd.org/D32251
---
 stand/common/bcache.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/stand/common/bcache.c b/stand/common/bcache.c
index b79d609b198b..99c78b0346b7 100644
--- a/stand/common/bcache.c
+++ b/stand/common/bcache.c
@@ -86,8 +86,9 @@ static u_int bcache_rablks;
 #define        BHASH(bc, blkno)        ((blkno) & ((bc)->bcache_nblks - 1))
 #define        BCACHE_LOOKUP(bc, blkno)        \
        ((bc)->bcache_ctl[BHASH((bc), (blkno))].bc_blkno != (blkno))
-#define        BCACHE_READAHEAD        256
+#define        BCACHE_READAHEAD        512
 #define        BCACHE_MINREADAHEAD     32
+#define        BCACHE_MAXIOWRA         512
 
 static void    bcache_invalidate(struct bcache *bc, daddr_t blkno);
 static void    bcache_insert(struct bcache *bc, daddr_t blkno);
@@ -324,6 +325,8 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t 
size,
     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 */
+       if (ra + p_size > BCACHE_MAXIOWRA)
+           ra = BCACHE_MAXIOWRA - p_size;
        bc->ralen = ra;
        p_size += ra;
     } else {
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to