Skip to content

Commit 98a6ca1

Browse files
Davidlohr Buesobrauner
authored andcommitted
fs/buffer: avoid redundant lookup in getblk slowpath
__getblk_slow() already implies failing a first lookup as the fastpath, so try to create the buffers immediately and avoid the redundant lookup. This saves 5-10% of the total cost/latency of the slowpath. Signed-off-by: Davidlohr Bueso <[email protected]> Link: https://lore.kernel.org/[email protected] Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent fb27226 commit 98a6ca1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/buffer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,15 +1139,15 @@ __getblk_slow(struct block_device *bdev, sector_t block,
11391139
for (;;) {
11401140
struct buffer_head *bh;
11411141

1142+
if (!grow_buffers(bdev, block, size, gfp))
1143+
return NULL;
1144+
11421145
if (blocking)
11431146
bh = __find_get_block_nonatomic(bdev, block, size);
11441147
else
11451148
bh = __find_get_block(bdev, block, size);
11461149
if (bh)
11471150
return bh;
1148-
1149-
if (!grow_buffers(bdev, block, size, gfp))
1150-
return NULL;
11511151
}
11521152
}
11531153

0 commit comments

Comments
 (0)