From patchwork Thu Jun 3 00:55:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 12295945 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=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 6F7AAC47083 for ; Thu, 3 Jun 2021 00:55:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EB952613E9 for ; Thu, 3 Jun 2021 00:55:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB952613E9 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=fb.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 86EA56B0070; Wed, 2 Jun 2021 20:55:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 821536B0071; Wed, 2 Jun 2021 20:55:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6E9E46B0072; Wed, 2 Jun 2021 20:55:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0004.hostedemail.com [216.40.44.4]) by kanga.kvack.org (Postfix) with ESMTP id 2CE6F6B0070 for ; Wed, 2 Jun 2021 20:55:30 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C79AE181AC9C6 for ; Thu, 3 Jun 2021 00:55:29 +0000 (UTC) X-FDA: 78210594378.16.93ABAB2 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by imf27.hostedemail.com (Postfix) with ESMTP id BCFFA801936B for ; Thu, 3 Jun 2021 00:55:15 +0000 (UTC) Received: from pps.filterd (m0109331.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1530rMLE013640 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 38xjg0gvdp-7 (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::4) 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 X-FB-Internal: Safe X-Proofpoint-GUID: lrh7FeBQjFBkj1WQToHnnfuxryXMFhQ1 X-Proofpoint-ORIG-GUID: lrh7FeBQjFBkj1WQToHnnfuxryXMFhQ1 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 mlxscore=0 clxscore=1015 phishscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 adultscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106030004 X-FB-Internal: deliver Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=fb.com header.s=facebook header.b=mV6W9OHN; dmarc=pass (policy=reject) header.from=fb.com; spf=pass (imf27.hostedemail.com: domain of "prvs=578884e26b=guro@fb.com" designates 67.231.153.30 as permitted sender) smtp.mailfrom="prvs=578884e26b=guro@fb.com" X-Stat-Signature: jpcmxpdhgowc3wog98ixtcf1pa6xdm1k X-Rspamd-Queue-Id: BCFFA801936B X-Rspamd-Server: rspam02 X-HE-Tag: 1622681715-543588 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: 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 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); }