Re: minixfs question

From: Andries Brouwer (aebr@win.tue.nl)
Date: Sat Aug 02 2003 - 07:17:09 EST


On Sat, Aug 02, 2003 at 02:48:54AM -0700, Erik McKee wrote:

> hoping this fs is a good place to start learning about fs in linux

Since it is small, and was the first, it has been a template
for many other filesystems. On the other hand, today it is a fossil,
not used very much, and its code is no longer exemplary.

You ask about minix_find_first_zero_bit and whether there aren't generic fns.
There are, but the details differ a bit. The original version was
little-endian. On other architectures one must choose between
little-endian and native endian. The choice can be read off in asm*/bitops.h.

> 224 bh = NULL;
> 225 *error = -ENOSPC;
> 226 lock_kernel();
> 227 for (i = 0; i < sbi->s_imap_blocks; i++) {
> 228 bh = sbi->s_imap[i];
> 229 if ((j = minix_find_first_zero_bit(bh->b_data, 8192)) < 8192)
> 230 break;
> 231 }
> 232 if (!bh || j >= 8192) {

You ask about the dereference bh->b_data and the test !bh.
The intention is that sbi->s_imap_blocks gives the number of
entries in sbi->s_imap that are nonzero. So, the bh in the
inner loop should be non-NULL. But after the loop bh can be NULL,
namely when sbi->s_imap_blocks == 0.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 07 2003 - 22:00:18 EST