From patchwork Fri Aug 11 16:15:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13351084 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABB63C001DE for ; Fri, 11 Aug 2023 16:15:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234961AbjHKQPn (ORCPT ); Fri, 11 Aug 2023 12:15:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232046AbjHKQPl (ORCPT ); Fri, 11 Aug 2023 12:15:41 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 554542694; Fri, 11 Aug 2023 09:15:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=TtnsL4i1WDoruwjihR7ho5E4T0YVgEIZCD8hWU4Po38=; b=Hk9/6EzKfW6Tas2SkqzCYnGlqY iIwVxlAicMgGum0LcucsvrJ2hXGVeC9GSLJLx//IoSjl3dd9G6O7DBlNCtMxUMj6x/TrYlCy7IApx FApal6jU0O0dDTmmHkH4Wb8E+lFP25+jLGpCJxAJ6Ow8Yd/A3rTxDVOxkUCeGQVgwOf1Y0rE3958G 2p8lgRV2Ivbq/xKQWVvp0zEj1RfF2kLrGz+2UZ/iTda59lqiAUidk+cpPLDgU2H43VLJWtN7oIy/X KdTvxVjwfJDUz58OWvcffBaXV+LzLGfns3lTAPPMIN1ZxVBmFhKV5aczuafCdnlYq7bQ/7wOEIQJS MjmNlqPg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qUUnT-0027ka-6Y; Fri, 11 Aug 2023 16:15:31 +0000 From: "Matthew Wilcox (Oracle)" To: akpm@linux-foundation.org Cc: "Matthew Wilcox (Oracle)" , Hui Zhu , linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org Subject: [PATCH 3/3] ext4: Use bdev_getblk() to avoid memory reclaim in readahead path Date: Fri, 11 Aug 2023 17:15:28 +0100 Message-Id: <20230811161528.506437-4-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230811161528.506437-1-willy@infradead.org> References: <20230811161528.506437-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org sb_getblk_gfp adds __GFP_NOFAIL, which is unnecessary for readahead; we're quite comfortable with the possibility that we may not get a bh back. Switch to bdev_getblk() which does not include __GFP_NOFAIL. Signed-off-by: Matthew Wilcox (Oracle) Reported-by: Hui Zhu Link: https://lore.kernel.org/linux-fsdevel/20230811035705.3296-1-teawaterz@linux.alibaba.com/ --- fs/ext4/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index c94ebf704616..48524314be97 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -254,7 +254,8 @@ struct buffer_head *ext4_sb_bread_unmovable(struct super_block *sb, void ext4_sb_breadahead_unmovable(struct super_block *sb, sector_t block) { - struct buffer_head *bh = sb_getblk_gfp(sb, block, 0); + struct buffer_head *bh = bdev_getblk(sb->s_bdev, block, + sb->s_blocksize, GFP_NOWAIT); if (likely(bh)) { if (trylock_buffer(bh))