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;
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) {
/* 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
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 */