summaryrefslogtreecommitdiff
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorAndries E. Brouwer <andries.brouwer@cwi.nl>2002-04-07 22:21:38 -0700
committerAnton Blanchard <anton@samba.org>2002-04-07 22:21:38 -0700
commit91fff028c0d10a9c9e4523d316cfb8763ddab415 (patch)
treed8c2de9f96775e333247e9fed2170bf7419daba1 /fs/block_dev.c
parent3bdd85a297ed0168d864bd0258e29b70a530017d (diff)
[PATCH] size_in_bytes
It is a step on the road to removal of the arrays. It also solves other things, like the fact that Linux is unable to read the last sector of a disk or partition with an odd number of sectors.
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index af9264109098..85c21bc48c3d 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -27,33 +27,22 @@
static unsigned long max_block(kdev_t dev)
{
unsigned int retval = ~0U;
- int major = major(dev);
-
- if (blk_size[major]) {
- int minor = minor(dev);
- unsigned int blocks = blk_size[major][minor];
- if (blocks) {
- unsigned int size = block_size(dev);
- unsigned int sizebits = blksize_bits(size);
- blocks += (size-1) >> BLOCK_SIZE_BITS;
- retval = blocks << (BLOCK_SIZE_BITS - sizebits);
- if (sizebits > BLOCK_SIZE_BITS)
- retval = blocks >> (sizebits - BLOCK_SIZE_BITS);
- }
+ loff_t sz = blkdev_size_in_bytes(dev);
+
+ if (sz) {
+ unsigned int size = block_size(dev);
+ unsigned int sizebits = blksize_bits(size);
+ retval = (sz >> sizebits);
}
return retval;
}
static loff_t blkdev_size(kdev_t dev)
{
- unsigned int blocks = ~0U;
- int major = major(dev);
-
- if (blk_size[major]) {
- int minor = minor(dev);
- blocks = blk_size[major][minor];
- }
- return (loff_t) blocks << BLOCK_SIZE_BITS;
+ loff_t sz = blkdev_size_in_bytes(dev);
+ if (sz)
+ return sz;
+ return ~0ULL;
}
/* Kill _all_ buffers, dirty or not.. */