mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 08:03:01 +09:00
block: cache inode size in bdev
Reading the inode size brings in a new cacheline for IO submit, and it's in the hot path being checked for every single IO. When doing millions of IOs per core per second, this is noticeable overhead. Cache the nr_sectors in the bdev itself. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
@@ -91,6 +91,7 @@ static void bdev_set_nr_sectors(struct block_device *bdev, sector_t sectors)
|
||||
{
|
||||
spin_lock(&bdev->bd_size_lock);
|
||||
i_size_write(bdev->bd_inode, (loff_t)sectors << SECTOR_SHIFT);
|
||||
bdev->bd_nr_sectors = sectors;
|
||||
spin_unlock(&bdev->bd_size_lock);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user