[DRBD-user] Re: [DRBD-cvs] drbd by phil; Fixed drbd_get_capacity(). It was misusi...

Luis Claudio R. Goncalves lclaudio at unix.sh
Fri Mar 5 02:46:11 CET 2004

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


Hi!

On Wed, Mar 03, 2004 at 09:41:49AM +0100, drbd-cvs at linbit.com wrote:
...
| Log Message:
| Fixed drbd_get_capacity(). It was misusing the gendisk, and completely
| wrong....  Now it is possible to use drbd on partitions again :)
| 
| ===================================================================
| RCS file: /var/lib/cvs/drbd/drbd/drbd/Attic/drbd_compat_wrappers.h,v
| retrieving revision 1.1.2.25
| retrieving revision 1.1.2.26
| diff -u -3 -r1.1.2.25 -r1.1.2.26
| --- drbd_compat_wrappers.h	2 Mar 2004 16:21:08 -0000	1.1.2.25
| +++ drbd_compat_wrappers.h	3 Mar 2004 08:41:44 -0000	1.1.2.26
| @@ -296,7 +296,7 @@
|  /* Returns the number of 512 byte sectors of the device */
|  static inline sector_t drbd_get_capacity(struct block_device *bdev)
|  {
| -	return bdev ? get_capacity(bdev->bd_disk) : 0;
| +	return bdev ? bdev->bd_inode->i_size >> 9 : 0;
|  }

Trying the CVS from today (few minutes before), with the path above
applied, in kernel 2.6.2 + few patches, I got the following message:

  drbd: initialised. Version: 0.7-pre5 (api:72/proto:72)
  drbd0: Both nodes diskless!

Reversing this patch or changing line 300 to

  return bdev ? bdev->bd_inode->i_size : 0;

Things seems to work fine:

  Mar  4 22:39:48 lorien kernel: drbd: initialised. Version: 0.7-pre5 (api:72/proto:72)
  Mar  4 22:39:55 lorien kernel: drbd0: size = 979933 KB

Is there a chance of a mistake or a change of meaning for
bdev->bd_inode->i_size in 2.6?

Regards,
Luis
-- 
[ Luis Claudio R. Goncalves                    lclaudio at unix dot sh ]
[ Fingerprint:   4FDD B8C4 3C59 34BD 8BE9  2696 7203 D980 A448 C8F8    ]
[ Linux-HA Developer - LateNite Programmer - Gospel User - Bass Player ]
[ Fault Tolerance - Real-Time - Distributed Systems - IECLB - Is 40:31 ]




More information about the drbd-user mailing list