ext4: do not unnecessarily allocate buffer in recently_deleted()

In recently_deleted() function we want to check whether inode is still
cached in buffer cache. Use sb_find_get_block() for that instead of
sb_getblk() to avoid unnecessary allocation of bdev page and buffer
heads.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Jan Kara 2017-08-24 11:52:21 -04:00 committed by Theodore Ts'o
parent 32aaf19420
commit 4f9d956d19
1 changed files with 2 additions and 2 deletions

View File

@ -707,9 +707,9 @@ static int recently_deleted(struct super_block *sb, ext4_group_t group, int ino)
if (unlikely(!gdp)) if (unlikely(!gdp))
return 0; return 0;
bh = sb_getblk(sb, ext4_inode_table(sb, gdp) + bh = sb_find_get_block(sb, ext4_inode_table(sb, gdp) +
(ino / inodes_per_block)); (ino / inodes_per_block));
if (unlikely(!bh) || !buffer_uptodate(bh)) if (!bh || !buffer_uptodate(bh))
/* /*
* If the block is not in the buffer cache, then it * If the block is not in the buffer cache, then it
* must have been written out. * must have been written out.