Skip to content

Commit fb27226

Browse files
Davidlohr Buesobrauner
authored andcommitted
fs/buffer: use sleeping lookup in __getblk_slowpath()
Just as with the fast path, call the lookup variant depending on the gfp flags. 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 a5806cd commit fb27226

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

fs/buffer.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,8 @@ static struct buffer_head *
11221122
__getblk_slow(struct block_device *bdev, sector_t block,
11231123
unsigned size, gfp_t gfp)
11241124
{
1125+
bool blocking = gfpflags_allow_blocking(gfp);
1126+
11251127
/* Size must be multiple of hard sectorsize */
11261128
if (unlikely(size & (bdev_logical_block_size(bdev)-1) ||
11271129
(size < 512 || size > PAGE_SIZE))) {
@@ -1137,7 +1139,10 @@ __getblk_slow(struct block_device *bdev, sector_t block,
11371139
for (;;) {
11381140
struct buffer_head *bh;
11391141

1140-
bh = __find_get_block(bdev, block, size);
1142+
if (blocking)
1143+
bh = __find_get_block_nonatomic(bdev, block, size);
1144+
else
1145+
bh = __find_get_block(bdev, block, size);
11411146
if (bh)
11421147
return bh;
11431148

0 commit comments

Comments
 (0)