Re: [RFC] set_blocksize() oddity.

Alexander Viro (viro@math.psu.edu)
Fri, 9 Apr 1999 16:14:06 -0400 (EDT)


On Fri, 9 Apr 1999, Andrea Arcangeli wrote:

> On Fri, 9 Apr 1999, Alexander Viro wrote:
>
> >Repeat until the complete satisfaction (nr_hashed_buffers going negative ;-/)
>
> The bug of nr_hashed_buffers inconsistency is due where
> nr_hashed_buffers++ nr_hashed_buffers-- are been placed by me. They has to
> be placed in the path where pprev is != 0. It's really a minor issue
> though.
I'm not sure...
a) if (bh->b_dev) in insert_into_queues looks odd - either it should be
if (bh->b_dev!=B_FREE) or it is dead code. B_FREE is *not* 0.

b) AFAICS code assumes that each buffer_head is either unused (everything
except b_next_free zeroed), or sits on a cyclic list (through b_next_free
and b_prev_free). If the buffer_head is free (b_dev==B_FREE) list in
question is determined by b_size (free_list[] one). Otherwise the
buffer_head is hashed (through b_next and b_pprev) and list is determined
by b_list (lru_list[] one). If that is right we shouldn't leave unhashed
buffer_head on active list - it should go to the corresponding free one.

It looks like we actually need to replace
remove_from_hash_queue(bh);
with
remove_from_queues(bh);
bh->b_dev = B_FREE;
insert_into_queues(bh);

IOW, transfer such buffers to the free list.

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