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=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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_GIT autolearn=unavailable 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 3DB75C4708F for ; Thu, 3 Jun 2021 00:55:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29E13613E6 for ; Thu, 3 Jun 2021 00:55:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229786AbhFCA5U (ORCPT ); Wed, 2 Jun 2021 20:57:20 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:4204 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229738AbhFCA5M (ORCPT ); Wed, 2 Jun 2021 20:57:12 -0400 Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1530tHoK031837 for ; Wed, 2 Jun 2021 17:55:28 -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=/DBsTJC33bFhaEU3PBMQzj0ujRVVcUYAVrv4stXzc5Y=; b=mV6W9OHNSFdLKkOytySRMra32H+5DcojjlazYqhuwG0wAoXwFpXCWOHGVtWQP9VZsNak 1OJLBio2gXM20+fMWG2i4eH+7otfjKW3MYdUqb6K7iYTxSALySh+OiNMB/z4sd34YR/Y l3xBcdhgh0KAlu9RLOGJbd9PN/xgd7jGhyo= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 38wn32u9ce-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 02 Jun 2021 17:55:28 -0700 Received: from intmgw002.46.prn1.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 17:55:27 -0700 Received: by devvm3388.prn0.facebook.com (Postfix, from userid 111017) id A09227F192A8; Wed, 2 Jun 2021 17:55:22 -0700 (PDT) From: Roman Gushchin To: Jan Kara , Tejun Heo CC: , , , Alexander Viro , Dennis Zhou , Dave Chinner , , Roman Gushchin Subject: [PATCH v6 3/5] writeback, cgroup: split out the functional part of inode_switch_wbs_work_fn() Date: Wed, 2 Jun 2021 17:55:15 -0700 Message-ID: <20210603005517.1403689-4-guro@fb.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210603005517.1403689-1-guro@fb.com> References: <20210603005517.1403689-1-guro@fb.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-GUID: LdsuHXYKiFQBO-vl66Sp7pJ_k5BEj76q X-Proofpoint-ORIG-GUID: LdsuHXYKiFQBO-vl66Sp7pJ_k5BEj76q X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-06-02_11:2021-06-02,2021-06-02 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 bulkscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106030004 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 --- 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 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