]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
VFS: Cache request_queue in struct block_device
authorAndi Kleen <ak@linux.intel.com>
Thu, 1 Dec 2011 21:36:56 +0000 (15:36 -0600)
committerDave Kleikamp <dave.kleikamp@oracle.com>
Thu, 1 Dec 2011 21:36:56 +0000 (15:36 -0600)
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?

Cc: axboe@kernel.dk
Signed-off-by: Andi Kleen <ak@linux.intel.com>
fs/block_dev.c
include/linux/fs.h

index 194cf66bc8f56a834cf31d4b2537f2503a984d4f..bbb71d9d5e9bf3570f7c43fb85768317a6b797fa 100644 (file)
@@ -1105,6 +1105,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
        mutex_lock_nested(&bdev->bd_mutex, for_part);
        if (!bdev->bd_openers) {
                bdev->bd_disk = disk;
+               bdev->bd_queue = disk->queue;
                bdev->bd_contains = bdev;
                if (!partno) {
                        struct backing_dev_info *bdi;
@@ -1125,6 +1126,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
                                        disk_put_part(bdev->bd_part);
                                        bdev->bd_part = NULL;
                                        bdev->bd_disk = NULL;
+                                       bdev->bd_queue = NULL;
                                        mutex_unlock(&bdev->bd_mutex);
                                        disk_unblock_events(disk);
                                        module_put(disk->fops->owner);
@@ -1198,6 +1200,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
        disk_put_part(bdev->bd_part);
        bdev->bd_disk = NULL;
        bdev->bd_part = NULL;
+       bdev->bd_queue = NULL;
        bdev_inode_switch_bdi(bdev->bd_inode, &default_backing_dev_info);
        if (bdev != bdev->bd_contains)
                __blkdev_put(bdev->bd_contains, mode, 1);
index 73a8d1f46b3b4c30d100978b03dbff85badb2014..c99d2fa8e1c95f0de1a17adac0630c28b12685c6 100644 (file)
@@ -654,6 +654,7 @@ struct address_space {
         * must be enforced here for CRIS, to let the least significant bit
         * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON.
         */
+struct request_queue;
 
 struct block_device {
        dev_t                   bd_dev;  /* not a kdev_t - it's a search key */
@@ -676,6 +677,7 @@ struct block_device {
        unsigned                bd_part_count;
        int                     bd_invalidated;
        struct gendisk *        bd_disk;
+       struct request_queue *  bd_queue;
        struct list_head        bd_list;
        /*
         * Private data.  You must have bd_claim'ed the block_device