On Wed, Jun 07, 2017 at 23:04 -0500, Amit Kulkarni wrote:
> On Wed, 7 Jun 2017 21:27:27 -0500
> Amit Kulkarni <amit.o...@gmail.com> wrote:
> 
> > On Thu, 8 Jun 2017 01:57:25 +0200
> > Mike Belopuhov <m...@belopuhov.com> wrote:
> > 
> > > On Wed, Jun 07, 2017 at 18:35 -0500, Amit Kulkarni wrote:
> > > > Wow, please get this in!!!
> > > > 
> > > > This fixes cvs update on hard disks, to go much much faster. When I am
> > > > updating the entire set of cvs trees: www, src, xenocara, ports, I can
> > > > still use firefox and have it perfectly usable. There's a night and
> > > > day improvement, before and after. Thanks for debugging and fixing
> > > > this.
> > > >
> > > 
> > > What kind of broken hardware do you have that this diff helps you?
> > > Can you show us your dmesg?
> > > 
> 
> Please ignore previous dmesg, it was incomplete.
> 

Are you 100% sure this diff changes anything for you?
Can you please try the one below.  It adds a printf.

diff --git sys/kern/vfs_bio.c sys/kern/vfs_bio.c
index 95bc80bc0e6..9316e6e0eb2 100644
--- sys/kern/vfs_bio.c
+++ sys/kern/vfs_bio.c
@@ -534,10 +534,27 @@ bread_cluster_callback(struct buf *bp)
                 */
                buf_fix_mapping(bp, newsize);
                bp->b_bcount = newsize;
        }
 
+       /* Invalidate read-ahead buffers if read short */
+       if (bp->b_resid > 0) {
+               printf("read %ld resid %ld\n", bp->b_bcount, bp->b_resid);
+               for (i = 0; xbpp[i] != NULL; i++)
+                       continue;
+               for (i = i - 1; i != 0; i--) {
+                       if (xbpp[i]->b_bufsize <= bp->b_resid) {
+                               bp->b_resid -= xbpp[i]->b_bufsize;
+                               SET(xbpp[i]->b_flags, B_INVAL);
+                       } else if (bp->b_resid > 0) {
+                               bp->b_resid = 0;
+                               SET(xbpp[i]->b_flags, B_INVAL);
+                       } else
+                               break;
+               }
+       }
+
        for (i = 1; xbpp[i] != 0; i++) {
                if (ISSET(bp->b_flags, B_ERROR))
                        SET(xbpp[i]->b_flags, B_INVAL | B_ERROR);
                biodone(xbpp[i]);
        }

Reply via email to