From a85ea5644f94005a18e393bd388ee3d36464b62f Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 9 Feb 2018 00:19:56 +0000 Subject: [PATCH] buffers: BF_SUPERBLOCK is dead, kill it off --- Kernel/devio.c | 4 +--- Kernel/include/kernel.h | 7 ++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Kernel/devio.c b/Kernel/devio.c index 9369b279..ad741da6 100644 --- a/Kernel/devio.c +++ b/Kernel/devio.c @@ -49,7 +49,6 @@ bufptr bread(uint16_t dev, blkno_t blk, bool rewrite) panic(PANIC_WANTBSYB); else if (bp->bf_busy == BF_FREE) bp->bf_busy = BF_BUSY; - /* BF_SUPERBLOCK is fine */ } else { bp = freebuf(); bp->bf_dev = dev; @@ -90,8 +89,7 @@ int bfree(regptr bufptr bp, uint8_t dirty) if (dirty) bp->bf_dirty = true; - if(bp->bf_busy == BF_BUSY) /* do not free BF_SUPERBLOCK */ - bp->bf_busy = BF_FREE; + bp->bf_busy = BF_FREE; if (dirty > 1) { /* immediate writeback */ if (bdwrite(bp) != BLKSIZE) { diff --git a/Kernel/include/kernel.h b/Kernel/include/kernel.h index e6d0b6be..54985c9e 100644 --- a/Kernel/include/kernel.h +++ b/Kernel/include/kernel.h @@ -157,12 +157,9 @@ typedef uint16_t blkno_t; /* Can have 65536 512-byte blocks in filesystem */ /* Help the 8bit compilers out by preventing any 32bit promotions */ #define BLKOFF(x) (((uint16_t)(x)) & BLKMASK) -/* we need a busier-than-busy state for superblocks, so that if those blocks - * are read by userspace through bread() they are not subsequently freed by - * bfree() until the filesystem is unmounted */ +/* State of the block. We have some free bits here if we need them */ #define BF_FREE 0 #define BF_BUSY 1 -#define BF_SUPERBLOCK 2 /* FIXME: if we could split the data and the header we could keep blocks outside of our kernel data (as ELKS does) which would be a win, but need @@ -210,7 +207,7 @@ extern void blkzero(struct blkbuf *buf); disk safely */ typedef struct dinode { uint16_t i_mode; - uint16_t i_nlink; + uint16_t i_nlink; /* Note we have 64K inodes so we never overflow */ uint16_t i_uid; uint16_t i_gid; uoff_t i_size; /* Never negative */ -- 2.34.1