Commit 87192a2a49c475cf322cb143e0fa63b0102d8567

Authored by Andi Kleen
Committed by Linus Torvalds
1 parent ae55e1aaa7

vfs: cache request_queue in struct block_device

This makes it possible to get from the inode to the request_queue with one
less cache miss.  Used in followon optimization.

The livetime of the pointer is the same as the gendisk.

This assumes that the queue will always stay the same in the gendisk while
it's visible to block_devices.  I think that's safe correct?

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 2 changed files with 5 additions and 0 deletions Side-by-side Diff

... ... @@ -1139,6 +1139,7 @@
1139 1139 mutex_lock_nested(&bdev->bd_mutex, for_part);
1140 1140 if (!bdev->bd_openers) {
1141 1141 bdev->bd_disk = disk;
  1142 + bdev->bd_queue = disk->queue;
1142 1143 bdev->bd_contains = bdev;
1143 1144 if (!partno) {
1144 1145 struct backing_dev_info *bdi;
... ... @@ -1159,6 +1160,7 @@
1159 1160 disk_put_part(bdev->bd_part);
1160 1161 bdev->bd_part = NULL;
1161 1162 bdev->bd_disk = NULL;
  1163 + bdev->bd_queue = NULL;
1162 1164 mutex_unlock(&bdev->bd_mutex);
1163 1165 disk_unblock_events(disk);
1164 1166 put_disk(disk);
... ... @@ -1232,6 +1234,7 @@
1232 1234 disk_put_part(bdev->bd_part);
1233 1235 bdev->bd_disk = NULL;
1234 1236 bdev->bd_part = NULL;
  1237 + bdev->bd_queue = NULL;
1235 1238 bdev_inode_switch_bdi(bdev->bd_inode, &default_backing_dev_info);
1236 1239 if (bdev != bdev->bd_contains)
1237 1240 __blkdev_put(bdev->bd_contains, mode, 1);
... ... @@ -660,6 +660,7 @@
660 660 * must be enforced here for CRIS, to let the least significant bit
661 661 * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON.
662 662 */
  663 +struct request_queue;
663 664  
664 665 struct block_device {
665 666 dev_t bd_dev; /* not a kdev_t - it's a search key */
... ... @@ -682,6 +683,7 @@
682 683 unsigned bd_part_count;
683 684 int bd_invalidated;
684 685 struct gendisk * bd_disk;
  686 + struct request_queue * bd_queue;
685 687 struct list_head bd_list;
686 688 /*
687 689 * Private data. You must have bd_claim'ed the block_device