Commit 314e5f17 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] more blkdev_size_in_bytes() removals

More places where we want the size of block device and have relevant
struct block_device * available,
parent 13c9d416
...@@ -271,11 +271,11 @@ int blk_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long arg) ...@@ -271,11 +271,11 @@ int blk_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long arg)
case BLKGETSIZE: case BLKGETSIZE:
/* size in sectors, works up to 2 TB */ /* size in sectors, works up to 2 TB */
ullval = blkdev_size_in_bytes(dev); ullval = bdev->bd_inode->i_size;
return put_user((unsigned long)(ullval >> 9), (unsigned long *) arg); return put_user((unsigned long)(ullval >> 9), (unsigned long *) arg);
case BLKGETSIZE64: case BLKGETSIZE64:
/* size in bytes */ /* size in bytes */
ullval = blkdev_size_in_bytes(dev); ullval = bdev->bd_inode->i_size;
return put_user(ullval, (u64 *) arg); return put_user(ullval, (u64 *) arg);
#if 0 #if 0
case BLKRRPART: /* Re-read partition tables */ case BLKRRPART: /* Re-read partition tables */
......
...@@ -160,13 +160,7 @@ compute_loop_size(struct loop_device *lo, ...@@ -160,13 +160,7 @@ compute_loop_size(struct loop_device *lo,
{ {
loff_t size = 0; loff_t size = 0;
if (S_ISREG(lo_dentry->d_inode->i_mode)) { size = lo_dentry->d_inode->i_mapping->host->i_size;
size = lo_dentry->d_inode->i_size;
} else {
size = blkdev_size_in_bytes(lodev);
if (size == 0)
return MAX_DISK_SIZE;
}
return (size - lo->lo_offset) >> BLOCK_SIZE_BITS; return (size - lo->lo_offset) >> BLOCK_SIZE_BITS;
} }
......
...@@ -266,6 +266,7 @@ ssize_t rw_raw_dev(int rw, struct file *filp, char *buf, ...@@ -266,6 +266,7 @@ ssize_t rw_raw_dev(int rw, struct file *filp, char *buf,
unsigned long limit; unsigned long limit;
int sector_size, sector_bits, sector_mask; int sector_size, sector_bits, sector_mask;
sector_t blocknr; sector_t blocknr;
struct block_device *bdev;
/* /*
* First, a few checks on device size limits * First, a few checks on device size limits
...@@ -286,12 +287,13 @@ ssize_t rw_raw_dev(int rw, struct file *filp, char *buf, ...@@ -286,12 +287,13 @@ ssize_t rw_raw_dev(int rw, struct file *filp, char *buf,
new_iobuf = 1; new_iobuf = 1;
} }
dev = to_kdev_t(raw_devices[minor].binding->bd_dev); bdev = raw_devices[minor].binding;
dev = to_kdev_t(bdev->bd_dev);
sector_size = raw_devices[minor].sector_size; sector_size = raw_devices[minor].sector_size;
sector_bits = raw_devices[minor].sector_bits; sector_bits = raw_devices[minor].sector_bits;
sector_mask = sector_size - 1; sector_mask = sector_size - 1;
limit = blkdev_size_in_bytes(dev) >> sector_bits; limit = bdev->bd_inode->i_size >> sector_bits;
if (!limit) if (!limit)
limit = INT_MAX; limit = INT_MAX;
dprintk ("rw_raw_dev: dev %d:%d (+%d)\n", dprintk ("rw_raw_dev: dev %d:%d (+%d)\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment