From: Alan Cox Date: Wed, 18 Apr 2018 22:44:45 +0000 (+0100) Subject: kernel: hopefully fix the busy block panic X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=a0a8573af04efa37e0287e32955a76896c60a892;p=FUZIX.git kernel: hopefully fix the busy block panic Do make backups before you test this! --- diff --git a/Kernel/devio.c b/Kernel/devio.c index 3181d0f4..8052a4d3 100644 --- a/Kernel/devio.c +++ b/Kernel/devio.c @@ -103,7 +103,6 @@ bufptr bread(uint16_t dev, blkno_t blk, bool rewrite) } } } - bp->bf_time = ++bufclock; /* Time stamp it */ return bp; } @@ -142,6 +141,11 @@ int bfree(regptr bufptr bp, uint8_t dirty) } bp->bf_dirty = false; } + /* Time stamp the buffer on free up. It doesn't matter if we stamp it + on read or free as while locked it can't go away. However if we + stamp it on free we can in future make smarter decisions such as + recycling full dirty buffers faster than partial ones */ + bp->bf_time = ++bufclock; bunlock(bp); return ret; } diff --git a/Kernel/filesys.c b/Kernel/filesys.c index 247f6141..3c9e76e7 100644 --- a/Kernel/filesys.c +++ b/Kernel/filesys.c @@ -650,6 +650,11 @@ blkno_t blk_alloc(uint16_t devno) goto corrupt; --dev->s_tfree; + /* + * FIXME: When we implement the rest of the bigger block size fs support + * this routine is responsible for zeroing the entire extent not just the + * 512 byte block + */ /* Zero out the new block */ buf = bread(devno, newno, 2); if (buf == NULL) diff --git a/Kernel/inode.c b/Kernel/inode.c index d4123439..9e3dacf1 100644 --- a/Kernel/inode.c +++ b/Kernel/inode.c @@ -113,22 +113,14 @@ void readi(regptr inoptr ino, uint8_t flag) } else #endif { - /* FIXME: for big file system support we need - to zero the rest of the logical extent here - and then allocate and write the one we want */ /* we transfer through the buffer pool */ if (pblk == NULLBLK) bp = zerobuf(); - else if (bp == NULL) { + else if (bp == NULL) bp = bread(dev, pblk, 0); - if (bp == NULL) - break; - } else { - /* FIXME: this has to get sorted ASAP */ - bp->bf_time = ++bufclock; - } + if (bp == NULL) + break; uputblk(bp, uoff(), amount); - brelse(bp); } /* Bletch */