Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 May 1997 18:15:25 +0200
From:      j@ida.interface-business.de (J Wunsch)
To:        freebsd-current@freebsd.org (FreeBSD-current users)
Subject:   Re: Big problem with b_blkno
Message-ID:  <19970513181525.ZO49600@ida.interface-business.de>
In-Reply-To: <Pine.BSF.3.95q.970513153548.464A-100000@herring.nlsystems.com>; from Doug Rabson on May 13, 1997 15:37:32 %2B0100
References:  <19970513135901.QU53254@ida.interface-business.de> <Pine.BSF.3.95q.970513153548.464A-100000@herring.nlsystems.com>

next in thread | previous in thread | raw e-mail | index | archive | help
As Doug Rabson wrote:

> I don't know about any solutions but I think changing btodb would break
> NFS since it plays silly games with the block numbers to support caching
> of NFS files.

A quick scan of all the NFS files for the usage of b_blkno seems to
yield no occuarance where it isn't multiplied with DEV_BSIZE when used
on the right hand side, or divided by DEV_BSIZE (of course, not using
btodb()) when used on the right hand side.  My suggestion was to avoid
the shifting (division, in the top layers), and this mulitiplication
(in the bottom layers).

This however probably means b_blkno needs to become a 64-bit entity.
It's probably time for this step anyway, since most drivers don't
handle the potential overflow after the multiplication.  NFS, for
example:


	if (((bp->b_blkno * DEV_BSIZE) + bp->b_dirtyend) > np->n_size)

The multiplication on the left side is done in terms of 32-bit
entities, and can easily overflow if bp->b_blkno was larger than 2^30.
This is just a randomly picked example.

I don't think this is an easily solvable problem, but we should think
about solving it.  Since it's not actually a block number after this
suggested transition, we should probably rename it into b_boffset, in
order to easily catch possible remaining bogus usage.

-- 
J"org Wunsch					       Unix support engineer
joerg_wunsch@interface-business.de       http://www.interface-business.de/~j



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970513181525.ZO49600>