buffers: BF_SUPERBLOCK is dead, kill it off
authorAlan Cox <alan@linux.intel.com>
Fri, 9 Feb 2018 00:19:56 +0000 (00:19 +0000)
committerAlan Cox <alan@linux.intel.com>
Fri, 9 Feb 2018 00:19:56 +0000 (00:19 +0000)
Kernel/devio.c
Kernel/include/kernel.h

index 9369b27..ad741da 100644 (file)
@@ -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) {
index e6d0b6b..54985c9 100644 (file)
@@ -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 */