From patchwork Fri Aug 25 13:54:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Xu X-Patchwork-Id: 13365923 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54B99C3DA6F for ; Fri, 25 Aug 2023 14:03:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE7692800D4; Fri, 25 Aug 2023 10:03:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D96162800D0; Fri, 25 Aug 2023 10:03:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C5E402800D4; Fri, 25 Aug 2023 10:03:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B66432800D0 for ; Fri, 25 Aug 2023 10:03:22 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 956391406A6 for ; Fri, 25 Aug 2023 14:03:22 +0000 (UTC) X-FDA: 81162794244.02.B97C6E8 Received: from out-244.mta1.migadu.com (out-244.mta1.migadu.com [95.215.58.244]) by imf11.hostedemail.com (Postfix) with ESMTP id 95DE740011 for ; Fri, 25 Aug 2023 14:03:20 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=j1kjownA; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf11.hostedemail.com: domain of hao.xu@linux.dev designates 95.215.58.244 as permitted sender) smtp.mailfrom=hao.xu@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692972200; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=oO47LbY0b5fVyG7D8YYQFkwRO57XM5uT3mfj/DxMSkA=; b=EDKU+ZxA9Up2VAuuyrSnG3efMPgoagKAZCY7k9HfybYRJA5GQv3Obq2dfL4KwHF19x0kqq AfUAgZHvVeoaMMxTpscH+7L7E1NgBQe+ZFNca1DBHJ+CZjHmbuvwpDpY7If/Og5XAJfoIz EtrhhqSJtwnzjSAslZreZP0RH/bKcgs= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=j1kjownA; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf11.hostedemail.com: domain of hao.xu@linux.dev designates 95.215.58.244 as permitted sender) smtp.mailfrom=hao.xu@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692972200; a=rsa-sha256; cv=none; b=sujbrjst98GcK7wLIgQyoYvabqnDAHtVX1cJgaXUkgpqmWLERVmpemfKOKgXOwph84RoAy rDRXie87A66VmyHNY5nq9qs4NwjVJr7B6cw8brpSUefJ5ChxZormuABHdQu7HlGnsZ8noE MUxOsRCVwEf+ow4paG4pfyBsOr2+0+Q= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1692972199; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oO47LbY0b5fVyG7D8YYQFkwRO57XM5uT3mfj/DxMSkA=; b=j1kjownAAX9hJfB2BxApQkooYMrevfaPLxvPystRVIJaNfbMrYunmfkjCazr0ChWhlvVjY lRX7+a9ciN0hwgjNK4X5Fb69aObVTB6DVFK6AZND7C0g5qPAW+vA7D+a0HhCiOEWDX9QRj DdPtV8aYlp/xMHVmKP0gIoyMuJWp9/M= From: Hao Xu To: io-uring@vger.kernel.org, Jens Axboe Cc: Dominique Martinet , Pavel Begunkov , Christian Brauner , Alexander Viro , Stefan Roesch , Clay Harris , Dave Chinner , "Darrick J . Wong" , linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-cachefs@redhat.com, ecryptfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, bpf@vger.kernel.org, netdev@vger.kernel.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org, codalist@coda.cs.cmu.edu, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-mm@kvack.org, linux-nilfs@vger.kernel.org, devel@lists.orangefs.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-mtd@lists.infradead.org, Wanpeng Li Subject: [PATCH 19/29] xfs: support nowait memory allocation in _xfs_buf_alloc() Date: Fri, 25 Aug 2023 21:54:21 +0800 Message-Id: <20230825135431.1317785-20-hao.xu@linux.dev> In-Reply-To: <20230825135431.1317785-1-hao.xu@linux.dev> References: <20230825135431.1317785-1-hao.xu@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Stat-Signature: k5iiuzh18a6d93bp41ceahbotag3m4i6 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 95DE740011 X-HE-Tag: 1692972200-490621 X-HE-Meta: U2FsdGVkX19JNVSRAAaV1lpLEVBwBM+u+hC5yGjEtdgFPEqJ6TL3uiG0qCU7Vd7z5MpYfyVti7bDyRT9G5+9IZGwDekvIjxm+zYyzY43rLmYguchlnep9/9AUiRbmxSuarXFZGsUuRslUYqZjcyt+/0d908AAxvlFeI6zKL6JCJoSfDH46zt2h4G9GzHDcoOMVGc2X6L4iMn+6Kxrp7/X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2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Hao Xu Choose different gfp flags to support nowait memory allocation in _xfs_buf_alloc(). Signed-off-by: Hao Xu --- fs/xfs/xfs_buf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 9f84bc3b802c..8b800ce28996 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -220,9 +220,14 @@ _xfs_buf_alloc( struct xfs_buf *bp; int error; int i; + bool nowait = flags & XBF_NOWAIT; + gfp_t gfp_flags = GFP_NOFS | + (nowait ? 0 : __GFP_NOFAIL); *bpp = NULL; - bp = kmem_cache_zalloc(xfs_buf_cache, GFP_NOFS | __GFP_NOFAIL); + bp = kmem_cache_zalloc(xfs_buf_cache, gfp_flags); + if (!bp) + return -EAGAIN; /* * We don't want certain flags to appear in b_flags unless they are