Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp723639pxj; Thu, 3 Jun 2021 18:34:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbqXloM69OWESmeDuvSZaCRbU6ym6EEzRe78f+AkFL5hwOe6ULgF2wKs7DFrI3PQpld6aB X-Received: by 2002:a17:906:dff2:: with SMTP id lc18mr1830581ejc.371.1622770476626; Thu, 03 Jun 2021 18:34:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622770476; cv=none; d=google.com; s=arc-20160816; b=aKGbSMDbGSo/GOnVj95Wh18apjwVBEocG3poY85RcQXPqcdyy/0txhpUclHCWQwMCn lpj894QZN0A35nA/+M1cHCOzl+6TjfbA+XXOyxcAxxYumxs0Q2nRnVtH3LcOL2d3hs57 QOPWN/+YY9IjCmBuGpW0kpwThCHv+DASps+9ul7fpVV0kRXt2dQFIYoozCgQxFlJYe2S +7WpXMNpm7CuA0Q9+7KGyMp1rVRLOBl18XG2CNMCbeI/N/3UX0x1YK6xCDKXmZnVBZp+ EUpr2eLHuQlQFlrmHquOZxyyHZYpM7zc7mdMDMmLu1HinbNJosp8UT+8l+GeOeM3iZPu pXkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3PD7flUng0j3vsCl8JvECN+6WNTm0WOf3BpqS3MXrJs=; b=ut7XmJt3x4B04XGe6A6HaRaSt1Zirc7N8IFaWdZ/QvvmTLr494YfjgTtLK/nSXkCw9 JnNFtOcghspDhgAGXQGcMVW/+k/tCbNOHCLubxgK1pQ6sIcqMNCy84ePp1t2jldzs5Fn uqGPNdbJfwQD+ASLWAQ4iC4s2nx+8Snw/qD0U3bDlWKxLNvZYYfF9vBTO7hmH1UfADs7 kpQefXeGCbbVZs9Fp0JWRQvtYjHlepP75px8T2wEQDG1UESyWb5Lz/4X8q8atW0H+VlC nEnUWn5QIe9G8ElS168BZVNCgexnbwmfy2BMVGz3Kb+TPewFQgoTtNdtWMrqpZsE39Bc V6gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=TRSPLYI7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z7si3315262edb.69.2021.06.03.18.34.14; Thu, 03 Jun 2021 18:34:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=TRSPLYI7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230239AbhFDBeB (ORCPT + 99 others); Thu, 3 Jun 2021 21:34:01 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:54876 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230198AbhFDBd4 (ORCPT ); Thu, 3 Jun 2021 21:33:56 -0400 Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1541VMcq004033 for ; Thu, 3 Jun 2021 18:32:10 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=facebook; bh=3PD7flUng0j3vsCl8JvECN+6WNTm0WOf3BpqS3MXrJs=; b=TRSPLYI7RUPJskKdG3cuoTmTIaSOQkSHk0TXgikQi8aS6EAH7KIa6nRW2NMIppGqv2WG 93rG8/003x3Pyk76g0rsG1DwT6fhQj4xwxkfWgmJ4AT57efI9mtqr6QsWfu+vIfvGQWE nvs9s24iSPL1xVPe8iOerU9he/kQusgW4yU= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 38xjp4ywct-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 03 Jun 2021 18:32:10 -0700 Received: from intmgw001.27.prn2.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 3 Jun 2021 18:32:06 -0700 Received: by devvm3388.prn0.facebook.com (Postfix, from userid 111017) id 852527FA36D8; Thu, 3 Jun 2021 18:32:00 -0700 (PDT) From: Roman Gushchin To: Jan Kara , Tejun Heo CC: , , , Alexander Viro , Dennis Zhou , Dave Chinner , , Roman Gushchin Subject: [PATCH v7 4/6] writeback, cgroup: split out the functional part of inode_switch_wbs_work_fn() Date: Thu, 3 Jun 2021 18:31:57 -0700 Message-ID: <20210604013159.3126180-5-guro@fb.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210604013159.3126180-1-guro@fb.com> References: <20210604013159.3126180-1-guro@fb.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-GUID: GGFNlrWBOb7DcIDcJLKtbpFgQ39KxaeF X-Proofpoint-ORIG-GUID: GGFNlrWBOb7DcIDcJLKtbpFgQ39KxaeF X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-06-04_01:2021-06-04,2021-06-03 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 mlxlogscore=999 impostorscore=0 adultscore=0 priorityscore=1501 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106040009 X-FB-Internal: deliver Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Split out the functional part of the inode_switch_wbs_work_fn() function as inode_do switch_wbs() to reuse it later for switching inodes attached to dying cgwbs. This commit doesn't bring any functional changes. Signed-off-by: Roman Gushchin Reviewed-by: Jan Kara --- 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 f0dfcd08073e..d46cdeeb6797 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -351,15 +351,12 @@ static void bdi_up_write_wb_switch_rwsem(struct bac= king_dev_info *bdi) up_write(&bdi->wb_switch_rwsem); } =20 -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 =3D - container_of(to_rcu_work(work), struct inode_switch_wbs_context, work)= ; - struct inode *inode =3D isw->inode; struct backing_dev_info *bdi =3D inode_to_bdi(inode); struct address_space *mapping =3D inode->i_mapping; struct bdi_writeback *old_wb =3D inode->i_wb; - struct bdi_writeback *new_wb =3D isw->new_wb; XA_STATE(xas, &mapping->i_pages, 0); struct page *page; bool switched =3D false; @@ -470,11 +467,17 @@ static void inode_switch_wbs_work_fn(struct work_st= ruct *work) wb_wakeup(new_wb); wb_put(old_wb); } - wb_put(new_wb); +} =20 - iput(inode); - kfree(isw); +static void inode_switch_wbs_work_fn(struct work_struct *work) +{ + struct inode_switch_wbs_context *isw =3D + container_of(to_rcu_work(work), struct inode_switch_wbs_context, work)= ; =20 + 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); } =20 --=20 2.31.1