Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Viro <viro@math.psu.edu>2002-05-24 03:32:15 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-05-24 03:32:15 -0700
commit08b0fb25701e2b9ed53cdaf5bd0a2fe4c37c7951 (patch)
tree78266592b398456a5d98bae126a44437006eba3a
parentf70ca4261d1a9fa6b49f2c813798fd6bf16ce2ae (diff)
[PATCH] kdev_t -> bdev cleanups [2/2]
- move the contents of bdev_get_queue() into do_open() and check_partitions() and cache the result in new field of struct block_device - clean it at the same places that reset ->bd_op, etc. - make bdev_get_queue() return cached pointer.
-rw-r--r--drivers/block/ll_rw_blk.c7
-rw-r--r--fs/block_dev.c8
-rw-r--r--fs/partitions/check.c5
-rw-r--r--include/linux/fs.h1
4 files changed, 15 insertions, 6 deletions
diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
index c39545712ba7..e58351141cd0 100644
--- a/drivers/block/ll_rw_blk.c
+++ b/drivers/block/ll_rw_blk.c
@@ -92,12 +92,7 @@ int blk_nohighio = 0;
**/
inline request_queue_t *bdev_get_queue(struct block_device *bdev)
{
- kdev_t dev = to_kdev_t(bdev->bd_dev);
- struct blk_dev_struct *p = blk_dev + major(dev);
- if (p->queue)
- return p->queue(dev);
- else
- return &blk_dev[major(dev)].request_queue;
+ return bdev->bd_queue;
}
/**
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 6d90edef1c51..805352f9e38b 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -322,6 +322,7 @@ struct block_device *bdget(dev_t dev)
atomic_set(&new_bdev->bd_count,1);
new_bdev->bd_dev = dev;
new_bdev->bd_op = NULL;
+ new_bdev->bd_queue = NULL;
new_bdev->bd_contains = NULL;
new_bdev->bd_inode = inode;
inode->i_mode = S_IFBLK;
@@ -607,6 +608,7 @@ static int do_open(struct block_device *bdev, struct inode *inode, struct file *
}
bdev->bd_inode->i_size = blkdev_size(dev);
if (!bdev->bd_openers) {
+ struct blk_dev_struct *p = blk_dev + major(dev);
unsigned bsize = bdev_hardsect_size(bdev);
while (bsize < PAGE_CACHE_SIZE) {
if (bdev->bd_inode->i_size & bsize)
@@ -615,6 +617,10 @@ static int do_open(struct block_device *bdev, struct inode *inode, struct file *
}
bdev->bd_block_size = bsize;
bdev->bd_inode->i_blkbits = blksize_bits(bsize);
+ if (p->queue)
+ bdev->bd_queue = p->queue(dev);
+ else
+ bdev->bd_queue = &p->request_queue;
}
bdev->bd_openers++;
unlock_kernel();
@@ -624,6 +630,7 @@ static int do_open(struct block_device *bdev, struct inode *inode, struct file *
out2:
if (!bdev->bd_openers) {
bdev->bd_op = NULL;
+ bdev->bd_queue = NULL;
bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info;
if (bdev != bdev->bd_contains) {
blkdev_put(bdev->bd_contains, BDEV_RAW);
@@ -698,6 +705,7 @@ int blkdev_put(struct block_device *bdev, int kind)
__MOD_DEC_USE_COUNT(bdev->bd_op->owner);
if (!bdev->bd_openers) {
bdev->bd_op = NULL;
+ bdev->bd_queue = NULL;
bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info;
if (bdev != bdev->bd_contains) {
blkdev_put(bdev->bd_contains, BDEV_RAW);
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 4af7921a903e..b3fd40ddda33 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -255,12 +255,17 @@ static void check_partition(struct gendisk *hd, kdev_t dev, int first_part_minor
bdev->bd_contains = bdev;
bdev->bd_inode->i_size = (loff_t)hd->part[minor(dev)].nr_sects << 9;
if (!bdev->bd_openers) {
+ struct blk_dev_struct *p = blk_dev + major(dev);
unsigned bsize = bdev_hardsect_size(bdev);
while (bsize < PAGE_CACHE_SIZE) {
if (bdev->bd_inode->i_size & bsize)
break;
bsize <<= 1;
}
+ if (p->queue)
+ bdev->bd_queue = p->queue(dev);
+ else
+ bdev->bd_queue = &p->request_queue;
bdev->bd_block_size = bsize;
bdev->bd_inode->i_blkbits = blksize_bits(bsize);
}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index d593252f4825..0c7ec5ff6b9c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -341,6 +341,7 @@ struct block_device {
dev_t bd_dev; /* not a kdev_t - it's a search key */
int bd_openers;
const struct block_device_operations *bd_op;
+ struct request_queue *bd_queue;
struct semaphore bd_sem; /* open/close mutex */
struct list_head bd_inodes;
void * bd_holder;