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=-17.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 E62B8C47097 for ; Thu, 3 Jun 2021 08:57:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9A12A6138C for ; Thu, 3 Jun 2021 08:57:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A12A6138C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 32C446B006C; Thu, 3 Jun 2021 04:57:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C9AC6B006E; Thu, 3 Jun 2021 04:57:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1442F6B0070; Thu, 3 Jun 2021 04:57:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0081.hostedemail.com [216.40.44.81]) by kanga.kvack.org (Postfix) with ESMTP id D6A076B006C for ; Thu, 3 Jun 2021 04:57:49 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6C8F2825E119 for ; Thu, 3 Jun 2021 08:57:49 +0000 (UTC) X-FDA: 78211809858.19.ECD55DC Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf09.hostedemail.com (Postfix) with ESMTP id 10A776000156 for ; Thu, 3 Jun 2021 08:57:40 +0000 (UTC) Received: from relay2.suse.de (unknown [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 31AC0219C5; Thu, 3 Jun 2021 08:57:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1622710668; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9sDgb2emqxYptX4dZY9/zDI4UOgLdVYYIQHPfS6+CF8=; b=KmJzr1J1myTp5jdxv36oVqaDps4jrGcdLt7HVHm6Rojl8scqhDwIgAwqGBhQu7GLL63uTs wNIpR08sqqmJC0ZURSzsPZzjgY8788AO3BwYKh2qk8Suzd5UW7DzC4HoH7CDilTQkaeTSf 1qQ6+0Xb4Rpf63S9QkgWd2VD1oM6+/g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1622710668; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9sDgb2emqxYptX4dZY9/zDI4UOgLdVYYIQHPfS6+CF8=; b=R9Tg+TsvkEsLSruud73rOCf4IqRCfMpQzTyhB11G/1qRomiz9EbadycD7gnCmGaI1Sx9xQ nC8g688z9lHro6Bg== Received: from quack2.suse.cz (unknown [10.100.200.198]) by relay2.suse.de (Postfix) with ESMTP id 1BDDFA3B85; Thu, 3 Jun 2021 08:57:48 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id DF8151F2C98; Thu, 3 Jun 2021 10:57:47 +0200 (CEST) Date: Thu, 3 Jun 2021 10:57:47 +0200 From: Jan Kara To: Roman Gushchin Cc: Jan Kara , Tejun Heo , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexander Viro , Dennis Zhou , Dave Chinner , cgroups@vger.kernel.org Subject: Re: [PATCH v6 3/5] writeback, cgroup: split out the functional part of inode_switch_wbs_work_fn() Message-ID: <20210603085747.GF23647@quack2.suse.cz> References: <20210603005517.1403689-1-guro@fb.com> <20210603005517.1403689-4-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210603005517.1403689-4-guro@fb.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: 10A776000156 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=KmJzr1J1; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=R9Tg+Tsv; spf=pass (imf09.hostedemail.com: domain of jack@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none X-Rspamd-Server: rspam04 X-Stat-Signature: ghmd7hj4z7jzdurnsfyphxzy5uay1oyc X-HE-Tag: 1622710660-933503 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: On Wed 02-06-21 17:55:15, Roman Gushchin wrote: > Split out the functional part of the inode_switch_wbs_work_fn() > function as inode_do switch_wbs() to reuse it later for switching ^ underscore here > inodes attached to dying cgwbs. > > This commit doesn't bring any functional changes. > > Signed-off-by: Roman Gushchin The patch looks good. Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/fs-writeback.c | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > > diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c > index 09d2770449ef..212494d89cc2 100644 > --- a/fs/fs-writeback.c > +++ b/fs/fs-writeback.c > @@ -351,15 +351,12 @@ static void bdi_up_write_wb_switch_rwsem(struct backing_dev_info *bdi) > up_write(&bdi->wb_switch_rwsem); > } > > -static void inode_switch_wbs_work_fn(struct work_struct *work) > +static void inode_do_switch_wbs(struct inode *inode, > + struct bdi_writeback *new_wb) > { > - struct inode_switch_wbs_context *isw = > - container_of(to_rcu_work(work), struct inode_switch_wbs_context, work); > - struct inode *inode = isw->inode; > struct backing_dev_info *bdi = inode_to_bdi(inode); > struct address_space *mapping = inode->i_mapping; > struct bdi_writeback *old_wb = inode->i_wb; > - struct bdi_writeback *new_wb = isw->new_wb; > XA_STATE(xas, &mapping->i_pages, 0); > struct page *page; > bool switched = false; > @@ -470,11 +467,17 @@ static void inode_switch_wbs_work_fn(struct work_struct *work) > wb_wakeup(new_wb); > wb_put(old_wb); > } > - wb_put(new_wb); > +} > > - iput(inode); > - kfree(isw); > +static void inode_switch_wbs_work_fn(struct work_struct *work) > +{ > + struct inode_switch_wbs_context *isw = > + container_of(to_rcu_work(work), struct inode_switch_wbs_context, work); > > + inode_do_switch_wbs(isw->inode, isw->new_wb); > + wb_put(isw->new_wb); > + iput(isw->inode); > + kfree(isw); > atomic_dec(&isw_nr_in_flight); > } > > -- > 2.31.1 > -- Jan Kara SUSE Labs, CR