提交 c2acf7b9 编写于 作者: D Denis ChengRq 提交者: Al Viro

fs/block_dev.c: __read_mostly improvement and sb_is_blkdev_sb utilization

- iget5_locked in bdget really needs blockdev_superblock, instead of
  bd_mnt, so bd_mnt could be just a local variable;

- blockdev_superblock really needs __read_mostly, while local var bd_mnt
  not;

- make use of sb_is_blkdev_sb in bd_forget, instead of direct reference
  to blockdev_superblock.
Signed-off-by: NDenis ChengRq <crquan@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 6badd79b
...@@ -326,12 +326,13 @@ static struct file_system_type bd_type = { ...@@ -326,12 +326,13 @@ static struct file_system_type bd_type = {
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
}; };
static struct vfsmount *bd_mnt __read_mostly; struct super_block *blockdev_superblock __read_mostly;
struct super_block *blockdev_superblock;
void __init bdev_cache_init(void) void __init bdev_cache_init(void)
{ {
int err; int err;
struct vfsmount *bd_mnt;
bdev_cachep = kmem_cache_create("bdev_cache", sizeof(struct bdev_inode), bdev_cachep = kmem_cache_create("bdev_cache", sizeof(struct bdev_inode),
0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT| 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD|SLAB_PANIC), SLAB_MEM_SPREAD|SLAB_PANIC),
...@@ -373,7 +374,7 @@ struct block_device *bdget(dev_t dev) ...@@ -373,7 +374,7 @@ struct block_device *bdget(dev_t dev)
struct block_device *bdev; struct block_device *bdev;
struct inode *inode; struct inode *inode;
inode = iget5_locked(bd_mnt->mnt_sb, hash(dev), inode = iget5_locked(blockdev_superblock, hash(dev),
bdev_test, bdev_set, &dev); bdev_test, bdev_set, &dev);
if (!inode) if (!inode)
...@@ -463,7 +464,7 @@ void bd_forget(struct inode *inode) ...@@ -463,7 +464,7 @@ void bd_forget(struct inode *inode)
spin_lock(&bdev_lock); spin_lock(&bdev_lock);
if (inode->i_bdev) { if (inode->i_bdev) {
if (inode->i_sb != blockdev_superblock) if (!sb_is_blkdev_sb(inode->i_sb))
bdev = inode->i_bdev; bdev = inode->i_bdev;
__bd_forget(inode); __bd_forget(inode);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册