Skip to content

Commit fad907c

Browse files
Ming Leiaxboe
authored andcommitted
block: move .bd_inode into 1st cacheline of block_device
The .bd_inode field of block_device is used in IO fast path of blkdev_write_iter() and blkdev_llseek(), so it is more efficient to keep it into the 1st cacheline. .bd_openers is only touched in open()/close(), and .bd_size_lock is only for updating bdev capacity, which is in slow path too. So swap .bd_inode layout with .bd_openers & .bd_size_lock to move .bd_inode into the 1st cache line. Cc: Yu Kuai <[email protected]> Signed-off-by: Ming Lei <[email protected]> Signed-off-by: Yu Kuai <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent bb6cc25 commit fad907c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/linux/blk_types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ struct block_device {
4949
bool bd_write_holder;
5050
bool bd_has_submit_bio;
5151
dev_t bd_dev;
52+
struct inode *bd_inode; /* will die */
53+
5254
atomic_t bd_openers;
5355
spinlock_t bd_size_lock; /* for bd_inode->i_size updates */
54-
struct inode * bd_inode; /* will die */
5556
void * bd_claiming;
5657
void * bd_holder;
5758
const struct blk_holder_ops *bd_holder_ops;

0 commit comments

Comments
 (0)