From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8191C4320E for ; Fri, 27 Aug 2021 11:33:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 84C3860F4C for ; Fri, 27 Aug 2021 11:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245019AbhH0LeW (ORCPT ); Fri, 27 Aug 2021 07:34:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233296AbhH0LeW (ORCPT ); Fri, 27 Aug 2021 07:34:22 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 687F2C061757 for ; Fri, 27 Aug 2021 04:33:33 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id r13so5038538pff.7 for ; Fri, 27 Aug 2021 04:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:message-id :date:mime-version; bh=KJQX+TsI3yH2yjy9y7acIKmC5LELspGOxEOMPk/HHiU=; b=tO7HSSkgieXjl27NG1FCKaD7hIKEHTZqMUVsaVctMu7jFx7idLR4CJVkaN9bE3+BCN +caJlHhpbMdGYJfOwTs4IbSHJKgMSzkeGbPDIvo/buJVpJSMmRGc8rEhyRRWlhB3tSIg XtfNri59cU8dPnE/wU4pqX5PZqbRjwuZlpxdu946dd6M1YLBDTMNmHlyMcFIkeEL5QZF xqzhxvyHMYkPx6dUJ1S81fSIE7L+8cnktgtIGKVBud8o6QTWqgwWJ2WYKGOTE7AYCZIf jRZqBOlt5ixvOZ7v21w9Nmkm1vGjVr7rwfG+/arTc06yHWZ8jMYeya00eYw14eAGX22q ak5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:message-id:date:mime-version; bh=KJQX+TsI3yH2yjy9y7acIKmC5LELspGOxEOMPk/HHiU=; b=CAmODMD50HNeMMpTbgr4CDVHLysB72UTEVIDU+4wag5/OeeQSuA5x0XiIzdGVLvLr3 JJXyVvwaIewtua9L4gvt7exUoMj7FECV2Z9tKXsSeVQlo7wQJEE8dE4BnLqIE+YcrruQ udHg+aZO64uu5U2WHpyZ1S1TKQ2w83fRGjmocCONtaXXLKW6LaGUoXVrtUXjpcG84p4k JdLQkpaAA54yppd6pM2KCPwR/9AiNwLyVxl48EB+7h/282ajl5NKCQeIBel4uloZSqIb X8E8RNFFdkdEabrRwii0be+4GUcx/9Shd5mvK2RzRPZKTTT9uCEZZn8yjT3oJ1ItRD63 GGkA== X-Gm-Message-State: AOAM532s7rjHoz4Hm4yPWOlcuHcHubV+25of21NIi4xeuqHQVFc/xIOH K9IqSTf+Yrj8F4PHA9Op42A/ySj3NQc= X-Google-Smtp-Source: ABdhPJx6J2y/FPKbz9dR7oeT+QbuDxgd3ICIPOwRrBTJCK7F8HV6JrMkw5GEm+2fTFDPGiAP2rZGRg== X-Received: by 2002:aa7:9dce:0:b0:3e1:3c5d:640d with SMTP id g14-20020aa79dce000000b003e13c5d640dmr8465879pfq.25.1630064012556; Fri, 27 Aug 2021 04:33:32 -0700 (PDT) Received: from garuda ([122.167.50.25]) by smtp.gmail.com with ESMTPSA id y64sm6738417pgy.32.2021.08.27.04.33.30 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Aug 2021 04:33:31 -0700 (PDT) References: <20210824224434.968720-1-allison.henderson@oracle.com> <20210824224434.968720-3-allison.henderson@oracle.com> User-agent: mu4e 1.4.15; emacs 27.1 From: Chandan Babu R To: Allison Henderson Cc: linux-xfs@vger.kernel.org Subject: Re: [PATCH v24 02/11] xfs: Capture buffers for delayed ops In-reply-to: <20210824224434.968720-3-allison.henderson@oracle.com> Message-ID: <87k0k79l6f.fsf@debian-BULLSEYE-live-builder-AMD64> Date: Fri, 27 Aug 2021 17:03:28 +0530 MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org On 25 Aug 2021 at 04:14, Allison Henderson wrote: > This patch enables delayed operations to capture held buffers with in > the xfs_defer_capture. Buffers are then rejoined to the new > transaction in xlog_finish_defer_ops > Looks good to me. Reviewed-by: Chandan Babu R > Signed-off-by: Allison Henderson > --- > fs/xfs/libxfs/xfs_defer.c | 7 ++++++- > fs/xfs/libxfs/xfs_defer.h | 4 +++- > fs/xfs/xfs_bmap_item.c | 2 +- > fs/xfs/xfs_buf.c | 1 + > fs/xfs/xfs_buf.h | 1 + > fs/xfs/xfs_extfree_item.c | 2 +- > fs/xfs/xfs_log_recover.c | 7 +++++++ > fs/xfs/xfs_refcount_item.c | 2 +- > fs/xfs/xfs_rmap_item.c | 2 +- > 9 files changed, 22 insertions(+), 6 deletions(-) > > diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c > index eff4a127188e..d1d09b6aca55 100644 > --- a/fs/xfs/libxfs/xfs_defer.c > +++ b/fs/xfs/libxfs/xfs_defer.c > @@ -639,6 +639,7 @@ xfs_defer_ops_capture( > dfc = kmem_zalloc(sizeof(*dfc), KM_NOFS); > INIT_LIST_HEAD(&dfc->dfc_list); > INIT_LIST_HEAD(&dfc->dfc_dfops); > + INIT_LIST_HEAD(&dfc->dfc_buffers); > > xfs_defer_create_intents(tp); > > @@ -690,7 +691,8 @@ int > xfs_defer_ops_capture_and_commit( > struct xfs_trans *tp, > struct xfs_inode *capture_ip, > - struct list_head *capture_list) > + struct list_head *capture_list, > + struct xfs_buf *bp) > { > struct xfs_mount *mp = tp->t_mountp; > struct xfs_defer_capture *dfc; > @@ -703,6 +705,9 @@ xfs_defer_ops_capture_and_commit( > if (!dfc) > return xfs_trans_commit(tp); > > + if (bp && bp->b_transp == tp) > + list_add_tail(&bp->b_delay, &dfc->dfc_buffers); > + > /* Commit the transaction and add the capture structure to the list. */ > error = xfs_trans_commit(tp); > if (error) { > diff --git a/fs/xfs/libxfs/xfs_defer.h b/fs/xfs/libxfs/xfs_defer.h > index 05472f71fffe..739f70d72fd5 100644 > --- a/fs/xfs/libxfs/xfs_defer.h > +++ b/fs/xfs/libxfs/xfs_defer.h > @@ -74,6 +74,7 @@ struct xfs_defer_capture { > > /* Deferred ops state saved from the transaction. */ > struct list_head dfc_dfops; > + struct list_head dfc_buffers; > unsigned int dfc_tpflags; > > /* Block reservations for the data and rt devices. */ > @@ -95,7 +96,8 @@ struct xfs_defer_capture { > * This doesn't normally happen except log recovery. > */ > int xfs_defer_ops_capture_and_commit(struct xfs_trans *tp, > - struct xfs_inode *capture_ip, struct list_head *capture_list); > + struct xfs_inode *capture_ip, struct list_head *capture_list, > + struct xfs_buf *bp); > void xfs_defer_ops_continue(struct xfs_defer_capture *d, struct xfs_trans *tp, > struct xfs_inode **captured_ipp); > void xfs_defer_ops_release(struct xfs_mount *mp, struct xfs_defer_capture *d); > diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c > index 03159970133f..51ba8ee368ca 100644 > --- a/fs/xfs/xfs_bmap_item.c > +++ b/fs/xfs/xfs_bmap_item.c > @@ -532,7 +532,7 @@ xfs_bui_item_recover( > * Commit transaction, which frees the transaction and saves the inode > * for later replay activities. > */ > - error = xfs_defer_ops_capture_and_commit(tp, ip, capture_list); > + error = xfs_defer_ops_capture_and_commit(tp, ip, capture_list, NULL); > if (error) > goto err_unlock; > > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c > index 047bd6e3f389..29b4655a0a65 100644 > --- a/fs/xfs/xfs_buf.c > +++ b/fs/xfs/xfs_buf.c > @@ -233,6 +233,7 @@ _xfs_buf_alloc( > init_completion(&bp->b_iowait); > INIT_LIST_HEAD(&bp->b_lru); > INIT_LIST_HEAD(&bp->b_list); > + INIT_LIST_HEAD(&bp->b_delay); > INIT_LIST_HEAD(&bp->b_li_list); > sema_init(&bp->b_sema, 0); /* held, no waiters */ > spin_lock_init(&bp->b_lock); > diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h > index 6b0200b8007d..c51445705dc6 100644 > --- a/fs/xfs/xfs_buf.h > +++ b/fs/xfs/xfs_buf.h > @@ -151,6 +151,7 @@ struct xfs_buf { > int b_io_error; /* internal IO error state */ > wait_queue_head_t b_waiters; /* unpin waiters */ > struct list_head b_list; > + struct list_head b_delay; /* delayed operations list */ > struct xfs_perag *b_pag; /* contains rbtree root */ > struct xfs_mount *b_mount; > struct xfs_buftarg *b_target; /* buffer target (device) */ > diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c > index 3f8a0713573a..046f21338c48 100644 > --- a/fs/xfs/xfs_extfree_item.c > +++ b/fs/xfs/xfs_extfree_item.c > @@ -637,7 +637,7 @@ xfs_efi_item_recover( > > } > > - return xfs_defer_ops_capture_and_commit(tp, NULL, capture_list); > + return xfs_defer_ops_capture_and_commit(tp, NULL, capture_list, NULL); > > abort_error: > xfs_trans_cancel(tp); > diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c > index 10562ecbd9ea..6a3c0bb16b69 100644 > --- a/fs/xfs/xfs_log_recover.c > +++ b/fs/xfs/xfs_log_recover.c > @@ -2465,6 +2465,7 @@ xlog_finish_defer_ops( > struct list_head *capture_list) > { > struct xfs_defer_capture *dfc, *next; > + struct xfs_buf *bp, *bnext; > struct xfs_trans *tp; > struct xfs_inode *ip; > int error = 0; > @@ -2489,6 +2490,12 @@ xlog_finish_defer_ops( > return error; > } > > + list_for_each_entry_safe(bp, bnext, &dfc->dfc_buffers, b_delay) { > + xfs_trans_bjoin(tp, bp); > + xfs_trans_bhold(tp, bp); > + list_del_init(&bp->b_delay); > + } > + > /* > * Transfer to this new transaction all the dfops we captured > * from recovering a single intent item. > diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c > index 46904b793bd4..a6e7351ca4f9 100644 > --- a/fs/xfs/xfs_refcount_item.c > +++ b/fs/xfs/xfs_refcount_item.c > @@ -557,7 +557,7 @@ xfs_cui_item_recover( > } > > xfs_refcount_finish_one_cleanup(tp, rcur, error); > - return xfs_defer_ops_capture_and_commit(tp, NULL, capture_list); > + return xfs_defer_ops_capture_and_commit(tp, NULL, capture_list, NULL); > > abort_error: > xfs_refcount_finish_one_cleanup(tp, rcur, error); > diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c > index 5f0695980467..8c70a4af80a9 100644 > --- a/fs/xfs/xfs_rmap_item.c > +++ b/fs/xfs/xfs_rmap_item.c > @@ -587,7 +587,7 @@ xfs_rui_item_recover( > } > > xfs_rmap_finish_one_cleanup(tp, rcur, error); > - return xfs_defer_ops_capture_and_commit(tp, NULL, capture_list); > + return xfs_defer_ops_capture_and_commit(tp, NULL, capture_list, NULL); > > abort_error: > xfs_rmap_finish_one_cleanup(tp, rcur, error); -- chandan