Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2837413pxb; Mon, 18 Apr 2022 09:15:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzLGRFQzBj8UgtkDAJfmVXpOWoLrSiIOzxC9fKkyWRGlUCwg/xhdPBm/1FZolRzkSTGl58 X-Received: by 2002:a17:907:6289:b0:6e0:eb0c:8ee7 with SMTP id nd9-20020a170907628900b006e0eb0c8ee7mr9340618ejc.245.1650298517299; Mon, 18 Apr 2022 09:15:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650298517; cv=none; d=google.com; s=arc-20160816; b=Wce/D8DieFjpnVpSc1Sllh//+XDdVUdxVp/bDpgDoFIiSdsaEuBmTlnILap+wf8Vpx edGu/rHgK8E99FHWEH5qH7470ppEhagjT0xKBf3sVdH7am/hu7wy139lDw33kzZ70nHK pxV+3D+meo39sqGMlVk3jFolmneytP2yzGNLudWBzJb/E+uvTT8cF4a44JkwrrPwHqmM tFy8axBu8apnGubDMgmdK5TUWy1r0eTqXk5QEgSj9yDJ/QQXgfYch0VRBR/gTrFxA6MW P65+ZN902uAFLv5tx790GSyiijnbWWhvqNE1/quhSmERnVYHZLzHtZt/TYQBcZnqCcyH D3sw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/K/0VwRTRyRQUPKM22UkA6K0kD02f1E6awye/qTkFGs=; b=J5y7GwkIMs1uAVnKbDsrVw0aJuTzrCG49l5/RbkiTLkiP0HfTmCi4kroUhROmL81bT 0ee0iwnw4TJYVlOc8BRcKHaaoHDKItRPDRDSCrV14y2NsjTFuqyxR3WXb7s+YLPAt9f7 8SloitRGB7g73YvC9jznZgSX+zT/1U0UzUHPkBstOheaZkx2azmJ/aqqK9+qaPkNSTTO ESjbYC8gp6pa43LXSrSb1cXY7AO/o/ciGMi++vybyHIcgU5nDx+5gok1OVtEr6bJ98jZ 7ZsVJ9GSg+daJdBf0JQM8ERl0vIcpxU4lMn/cGN1Zr2qVPF6QMqM2LM5R2KQi4FCtp1H Tnig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zgTfIbG+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cb4-20020a170906a44400b006df76385c38si5626076ejb.216.2022.04.18.09.14.51; Mon, 18 Apr 2022 09:15:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zgTfIbG+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238326AbiDRMV2 (ORCPT + 99 others); Mon, 18 Apr 2022 08:21:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238144AbiDRMVC (ORCPT ); Mon, 18 Apr 2022 08:21:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1C1A1AF24; Mon, 18 Apr 2022 05:17:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 33A8860EF4; Mon, 18 Apr 2022 12:17:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30D2CC385A7; Mon, 18 Apr 2022 12:17:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284229; bh=2eW/C51TwqfkdoErXQym1CHihSsTcqaYUfBGjlwTP8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zgTfIbG+1ycxcdgQZWvskGHmqpjl0XsJeHqieyKXxRgNHioMQfhlJz0q8c7exc5tt AO4xozM/Ar6ml7Gf5h1ExW1kXtU8op9B4LaLF2qkRC/VAZJ9gWUjggKhAXLDB5iNMY Fm5Vc2bBYNfp2q22rjV9/WTkiZQhANS/PynbCJJY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dennis Zhou , David Sterba Subject: [PATCH 5.17 015/219] btrfs: fix btrfs_submit_compressed_write cgroup attribution Date: Mon, 18 Apr 2022 14:09:44 +0200 Message-Id: <20220418121203.955676572@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121203.462784814@linuxfoundation.org> References: <20220418121203.462784814@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dennis Zhou commit acee08aaf6d158d03668dc82b0a0eef41100531b upstream. This restores the logic from commit 46bcff2bfc5e ("btrfs: fix compressed write bio blkcg attribution") which added cgroup attribution to btrfs writeback. It also adds back the REQ_CGROUP_PUNT flag for these ios. Fixes: 91507240482e ("btrfs: determine stripe boundary at bio allocation time in btrfs_submit_compressed_write") CC: stable@vger.kernel.org # 5.16+ Signed-off-by: Dennis Zhou Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/compression.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -534,6 +534,9 @@ blk_status_t btrfs_submit_compressed_wri cb->orig_bio = NULL; cb->nr_pages = nr_pages; + if (blkcg_css) + kthread_associate_blkcg(blkcg_css); + while (cur_disk_bytenr < disk_start + compressed_len) { u64 offset = cur_disk_bytenr - disk_start; unsigned int index = offset >> PAGE_SHIFT; @@ -552,6 +555,8 @@ blk_status_t btrfs_submit_compressed_wri bio = NULL; goto finish_cb; } + if (blkcg_css) + bio->bi_opf |= REQ_CGROUP_PUNT; } /* * We should never reach next_stripe_start start as we will @@ -609,6 +614,9 @@ blk_status_t btrfs_submit_compressed_wri return 0; finish_cb: + if (blkcg_css) + kthread_associate_blkcg(NULL); + if (bio) { bio->bi_status = ret; bio_endio(bio);