[lkml]   [2003]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: minixfs question
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
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:47    [W:0.036 / U:10.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site