From patchwork Mon Jan 15 22:59:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 13520257 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 03702C3DA79 for ; Mon, 15 Jan 2024 23:01:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AAC7F6B0078; Mon, 15 Jan 2024 18:01:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A5BFC6B007B; Mon, 15 Jan 2024 18:01:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8862C6B007D; Mon, 15 Jan 2024 18:01:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 779966B0078 for ; Mon, 15 Jan 2024 18:01:24 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 5A0581A057D for ; Mon, 15 Jan 2024 23:01:24 +0000 (UTC) X-FDA: 81683068488.01.563814F Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf14.hostedemail.com (Postfix) with ESMTP id 52204100014 for ; Mon, 15 Jan 2024 23:01:22 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=2IFZG6+1; dmarc=pass (policy=quarantine) header.from=fromorbit.com; spf=pass (imf14.hostedemail.com: domain of david@fromorbit.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=david@fromorbit.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1705359682; 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=tgxEN+dxuPsIPQ/X2jxskuPK8v7LK84zp/ZH+sCdiJw=; b=u3VuyuY4fA3Ct4xsaf2hb/pGRGiVZddrrzlvTTf8Qh9ySBQ8vZqEzjpqxfQUyesCdRY1eq Jr6LSCiDkr5QASPcfp6feBTMZOwfQs6eooHI1WalHuUxI+5EDTQHQcst4E78tUXNskbgCi yDysDJo56QvU84IGTlrZgMq7qfWB66o= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=2IFZG6+1; dmarc=pass (policy=quarantine) header.from=fromorbit.com; spf=pass (imf14.hostedemail.com: domain of david@fromorbit.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=david@fromorbit.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705359682; a=rsa-sha256; cv=none; b=B5jNGuQGp0cId3pQtw2UPHw62p37bT4T6LayrKaNgfRQLbRHjXuSVVFIk5dvObx9/1/0SN 9caCJREjZg8eZ8cW8NyxTJ8bpiUti5l181olkXWMiqaqSrY05tLg3Ev151kdj0OpBTEBaV VEqMPlP5F3hPUUMYFPEGGQQmOmRY2iw= Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-28e724d9c47so84599a91.2 for ; Mon, 15 Jan 2024 15:01:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20230601.gappssmtp.com; s=20230601; t=1705359681; x=1705964481; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tgxEN+dxuPsIPQ/X2jxskuPK8v7LK84zp/ZH+sCdiJw=; b=2IFZG6+1sFzruNjwBiC+5OZNuE4YHVYH0s0Jv2OULDuKdfZHLey2lYTpAa9MqMlb/M Xx9JS1qj3OEyNIsaqrGUBIRViiou4bC/pmQEKdz2s8fTCgBfWDlqOWz+I9CBOQLNwHgf wGjD0hOYOAUhCjS1RL4fKQehSjVfmxVcWLY2nV8UHzQ+Mnznx/PAaCY7WyBoM33ggWXZ +1I6xij7sRm8nUxrZlpdAMRWJ3LPyghAunqncG7B3O7hI1X9HlVax232TFTCzmRfmdLB +uPMYTr16gJ0HC54A/htEg6cYtcd5f3hIW3lLXIac9jHdVEc5d2RM06czNOLyA0If4PE NQcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705359681; x=1705964481; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tgxEN+dxuPsIPQ/X2jxskuPK8v7LK84zp/ZH+sCdiJw=; b=wTwdE4zNM3slKffWnxLGVC8moklDh4puTtaf5AgHnF/SzRXalv6Ibo4/fl5v7mdaHu pzTe08aMrDT+Pz8OzykI+W0I4/bNn6REu4+cfDrZjwQX7O/eVm9ZP5v1SeeKfT8E9W/Q 1RgcEB07hhela3poTG3roGOO5UVT41SprZbroGo7fA/HMh01k5nJxWgfGswQ4QbEoIfW 85zexH/rAU0xSVo15mNbFQ7ejAL8KUHBN5dTN/T/zF9o+bL+JDNbIiZdXk1Ab02TZkfR gspLuw1SdYomvrYdXj7K5IZqDESkEy/v9zCRnJCC3Z7fyw+e0reoUKqsDK28JfQPe/6V z9ww== X-Gm-Message-State: AOJu0YzdudWFAuj2K745XkH0e+5BnxmO8Fit8NPzkBxVDn19W1ivmkzM yuMZtdWCdUkf/ncsV52omaaVospXDPKHOVXMReeWc0tC6YE= X-Google-Smtp-Source: AGHT+IGzpNwsKNu7NVgPnlnsyEIybtI/t9LRuDCZhvbpZAVN6r4/IhKNwivF+6D2KG20ozQ0wahSCw== X-Received: by 2002:a17:90a:e01:b0:28d:2cee:119e with SMTP id v1-20020a17090a0e0100b0028d2cee119emr3549236pje.39.1705359681331; Mon, 15 Jan 2024 15:01:21 -0800 (PST) Received: from dread.disaster.area (pa49-180-249-6.pa.nsw.optusnet.com.au. [49.180.249.6]) by smtp.gmail.com with ESMTPSA id sh2-20020a17090b524200b0028dfdfc9a8esm8737391pjb.37.2024.01.15.15.01.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 15:01:18 -0800 (PST) Received: from [192.168.253.23] (helo=devoid.disaster.area) by dread.disaster.area with esmtp (Exim 4.96) (envelope-from ) id 1rPVxE-00AtKZ-1D; Tue, 16 Jan 2024 10:01:15 +1100 Received: from dave by devoid.disaster.area with local (Exim 4.97) (envelope-from ) id 1rPVxD-0000000H8gH-3WIC; Tue, 16 Jan 2024 10:01:15 +1100 From: Dave Chinner To: linux-xfs@vger.kernel.org Cc: willy@infradead.org, linux-mm@kvack.org Subject: [PATCH 12/12] xfs: use xfs_defer_alloc a bit more Date: Tue, 16 Jan 2024 09:59:50 +1100 Message-ID: <20240115230113.4080105-13-david@fromorbit.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240115230113.4080105-1-david@fromorbit.com> References: <20240115230113.4080105-1-david@fromorbit.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 52204100014 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: mp9tbpxrokbcehgihsc4oiqaop73fzh5 X-HE-Tag: 1705359682-213934 X-HE-Meta: U2FsdGVkX19ernfrQl7t0YOanLphRxSgimPjNnFQh44Um7ASqgA+jhBbKC8G1cRdu/WpCjOFnp668hKmw08JTkpLZjDOZobf10dW3d1tF41e77z4qYjEzO856ILtmk6JFFf2m4o9XTxJi+CcQWNXU3euI2ZOEmgYzBwbuoPF5MOFIcLpv/zl80XukbLCjVip6bFRTkHNA40UwuPDD1ztidorq2locLD2SJcrk/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GBImmjWohRLdlSDX0r+AnV9moqf03s4HY6IRVfiY/9LpArqBDCkLfAtYulLlW+EOT9L9gppBSOPPBklg3xiN4zAr+ek7FRKueJJTQ/2qMpL+Ll7Exu27Y6W0rCXcAXXjDWawdgG7n4FckCpDWCei3olqgixntQGsaHevoeH1BSKx/JPAsyMYI/11jq/MSwc4P9Lib633/0hflTCsA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Dave Chinner Noticed by inspection, simple factoring allows the same allocation routine to be used for both transaction and recovery contexts. Signed-off-by: Dave Chinner Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_defer.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c index 8ae4401f6810..6ed3a5fda081 100644 --- a/fs/xfs/libxfs/xfs_defer.c +++ b/fs/xfs/libxfs/xfs_defer.c @@ -819,7 +819,7 @@ xfs_defer_can_append( /* Create a new pending item at the end of the transaction list. */ static inline struct xfs_defer_pending * xfs_defer_alloc( - struct xfs_trans *tp, + struct list_head *dfops, const struct xfs_defer_op_type *ops) { struct xfs_defer_pending *dfp; @@ -828,7 +828,7 @@ xfs_defer_alloc( GFP_KERNEL | __GFP_NOFAIL); dfp->dfp_ops = ops; INIT_LIST_HEAD(&dfp->dfp_work); - list_add_tail(&dfp->dfp_list, &tp->t_dfops); + list_add_tail(&dfp->dfp_list, dfops); return dfp; } @@ -846,7 +846,7 @@ xfs_defer_add( dfp = xfs_defer_find_last(tp, ops); if (!dfp || !xfs_defer_can_append(dfp, ops)) - dfp = xfs_defer_alloc(tp, ops); + dfp = xfs_defer_alloc(&tp->t_dfops, ops); xfs_defer_add_item(dfp, li); trace_xfs_defer_add_item(tp->t_mountp, dfp, li); @@ -870,7 +870,7 @@ xfs_defer_add_barrier( if (dfp) return; - xfs_defer_alloc(tp, &xfs_barrier_defer_type); + xfs_defer_alloc(&tp->t_dfops, &xfs_barrier_defer_type); trace_xfs_defer_add_item(tp->t_mountp, dfp, NULL); } @@ -885,14 +885,9 @@ xfs_defer_start_recovery( struct list_head *r_dfops, const struct xfs_defer_op_type *ops) { - struct xfs_defer_pending *dfp; + struct xfs_defer_pending *dfp = xfs_defer_alloc(r_dfops, ops); - dfp = kmem_cache_zalloc(xfs_defer_pending_cache, - GFP_KERNEL | __GFP_NOFAIL); - dfp->dfp_ops = ops; dfp->dfp_intent = lip; - INIT_LIST_HEAD(&dfp->dfp_work); - list_add_tail(&dfp->dfp_list, r_dfops); } /*