Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3706016pxj; Mon, 7 Jun 2021 18:35:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEG5K3p8s7aCxCZhYAU1xOsLP1elobDK9MRn4+f94ge8mJZhuhd8hEesoGOvURo/KMl7Sc X-Received: by 2002:a17:906:7188:: with SMTP id h8mr20783068ejk.529.1623116122229; Mon, 07 Jun 2021 18:35:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623116122; cv=none; d=google.com; s=arc-20160816; b=D7ly21pTAfDo8z7ucCD8A1muBXEFPJvIYKUQSFqwzKDAcmPmBlzQH+HbOAlQdUiWPO Sdne9TSpEe/rDx3KOsA+YrHQfYJSE4ZjHP2LCGLDT/IFAN4FYv6UYz83k9ikAi3v/MCF e2VYr5ycmEf/Q8i+O7cOaAowytH2dJfjWo78NZv4RSab9oUv4H8ROREnC1ysVKFEgpc5 k97LyzoXTnWh/H+1Thz+g6ePwfCQvCQRPj+CQ0MF3IaIHrZEsc1Z8XFoH3u5IoPIhLjk aebBa3EMuG94bOPeHUtioAR3ZN9LzMtBJ0tErAa9QCU5GQwf+DtZmkqijgooQEUA+koG 4nwA== 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=xtHxEoYXK/J8eXIxuzMNhgc84Vi7Uigt9QtACI4mgPU=; b=taiN3j9Chqn3f54ontusmSgUrmEntsSVkz5yIou8sZL1hNDuIFxaWfYdcxHC2lNd7e TMAo0nnfWNyZsJAZfq57iSXnI9qyJRoRzxzlEQa47pcgn7p9GQuy2ToMFEI0u7bLDM7D IqBaVJ65oF4Sac61IPSsVeB525CeW09yNTG4ZufZn5TbYgIgy0Kaw4VJ+J0cNfIAGiVU h7a51LA/xOesRP9824THYRZUiziWJj7k2ksMBRC1PW61YzwoVRSunbAbqIUmLBaAgSq8 pJnxkXwXUZytmb/gHctwM51bSIIq6ry6+v73vKRWmZf/DIcwSTmJ6hx/LBu1xIR/mQlm RbgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=mOQi1Iyi; 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 b13si10229393ede.603.2021.06.07.18.34.59; Mon, 07 Jun 2021 18:35:22 -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=mOQi1Iyi; 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 S231441AbhFHBdr (ORCPT + 99 others); Mon, 7 Jun 2021 21:33:47 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:17404 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231181AbhFHBdo (ORCPT ); Mon, 7 Jun 2021 21:33:44 -0400 Received: from pps.filterd (m0148461.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1581T5gm028419 for ; Mon, 7 Jun 2021 18:31:52 -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=xtHxEoYXK/J8eXIxuzMNhgc84Vi7Uigt9QtACI4mgPU=; b=mOQi1IyiiCJ6qaAPzckLxPm/29XpbM+BrEydA3uLv1F/2rfL4Ma81T7sYmSncA5xB691 nkVtnGnnWRvlBycTPD2XvOSozhYvTUi4vadkSyWbJwK5oiwbv8Duj/EBKsvvuRtwy5Qi cru+dxkG/HVzRTCTQtbnnqEY93WKUpQuvoc= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 390ryrsfqy-9 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 07 Jun 2021 18:31:52 -0700 Received: from intmgw001.46.prn1.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; Mon, 7 Jun 2021 18:31:37 -0700 Received: by devvm3388.prn0.facebook.com (Postfix, from userid 111017) id A70FF81D6D4D; Mon, 7 Jun 2021 18:31:29 -0700 (PDT) From: Roman Gushchin To: Jan Kara , Tejun Heo CC: , , , Alexander Viro , Dennis Zhou , Dave Chinner , , Roman Gushchin Subject: [PATCH v8 6/8] writeback, cgroup: split out the functional part of inode_switch_wbs_work_fn() Date: Mon, 7 Jun 2021 18:31:21 -0700 Message-ID: <20210608013123.1088882-7-guro@fb.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608013123.1088882-1-guro@fb.com> References: <20210608013123.1088882-1-guro@fb.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-ORIG-GUID: TOX8isrw5cA4f9VYKbvcoeGpwU_ITy55 X-Proofpoint-GUID: TOX8isrw5cA4f9VYKbvcoeGpwU_ITy55 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-06-08_01:2021-06-04,2021-06-08 signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe 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 Acked-by: Tejun Heo Acked-by: Dennis Zhou --- 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 87b305ee5348..5520a6b5cc4d 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