[dm-devel] [PATCH] Fix __set_size for 32 bit sector_t

Kevin Corry kevcorry at us.ibm.com
Mon Jan 12 09:59:02 UTC 2004


On Saturday 10 January 2004 14:05, Christophe Saout wrote:
> With 32 bit sector_t the block device size _in bytes_ is also cut to
> 32 bit in __set_size when the block device is mount (a filesystem
> mounted). The argument should be cast to loff_t before expanding the
> sector count to a byte count and calling i_size_write.

Good catch. :)  I usually look at sector_t's and assume they're 64-bit. I 
forget that the size is configurable.

> --- linux.orig/drivers/md/dm.c	2004-01-10 15:21:10.000000000 +0100
> +++ linux/drivers/md/dm.c	2004-01-10 20:42:04.677696216 +0100
> @@ -716,7 +716,7 @@
>  	bdev = bdget_disk(disk, 0);
>  	if (bdev) {
>  		down(&bdev->bd_inode->i_sem);
> -		i_size_write(bdev->bd_inode, size << SECTOR_SHIFT);
> +		i_size_write(bdev->bd_inode, (loff_t)size << SECTOR_SHIFT);
>  		up(&bdev->bd_inode->i_sem);
>  		bdput(bdev);
>  	}

-- 
Kevin Corry
kevcorry at us.ibm.com
http://evms.sourceforge.net/





More information about the dm-devel mailing list