Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp348255ybi; Thu, 13 Jun 2019 17:34:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNMDTTP/Ow+RAejCZoOR+dzIsmD2z4+eecM+6nBT4TeT7XPAimrO+k64X20MvP+H7DrjYQ X-Received: by 2002:a63:18e:: with SMTP id 136mr32862184pgb.277.1560472493227; Thu, 13 Jun 2019 17:34:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560472493; cv=none; d=google.com; s=arc-20160816; b=igYf2tFJA2V5v/8IXap7HLa8XOUajKjWCkTEAs9ou70YtWHNoOCy0Y9dt7V8J9vv0P QdTUc3TK9wr11sij6odDmrsiXIQw007q5SHGW4lZzpdX/vXif3CuP0CrMZfZmHQdf+Ii BERziav/9Sx4Ysr9QuWnEjfBgVYh2+gb22eewlbGyZct3yQdTQQTUoxbvJVMl7GZQAfE nTHTI7KLgMM7ZkQuuwzvmaUDQEKch7CQQH6izjeVu80FunRdVjLMbzinMauY+3pJTYkt Yd0RkRmeVudwLvHFLSM9UFmP1l1cFjpJLBh4QLHxqrMa1Lu1fq5DxA3xAZ8hsD/ZO7rM nTsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=/0EbDb07rl0+2nTNpL5MUvCUgcM2dhBTtu5L9LJF/5g=; b=YM5jxTzcwlfi4k98y2whyGo9pfxEbr6D1JTPddBH7xDIQR4BoD/vWDjr4EOXTdvcrH J3M4EwlDsoXSlh7dZmUsx2/C8yGEi/fI30SCgqUMtsBm5wW5w3FUv9dDSA0MSt8hcXkS 7tZOGNBBqP35wZoyW9ugCxZZy3wb8G7/lMc2J7vfour0RkM2cdJehN6G/odt7TeWt6F8 adh3JpUKm6wYxiRjpXX7pfhUWA4fB+Pt7ojX+EFObgblRwXco4j8xhOQEReTbGHH3u8t yyaG0neoZQ3JGIfmVrgoGbocaM79V11cfKwioH8bf0e3FS16jaMk8AGAkk+DfQw1nak/ q9Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=fQzf7NTf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d39si789964pla.371.2019.06.13.17.34.38; Thu, 13 Jun 2019 17:34:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=fQzf7NTf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727536AbfFNAeS (ORCPT + 99 others); Thu, 13 Jun 2019 20:34:18 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44980 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727437AbfFNAeO (ORCPT ); Thu, 13 Jun 2019 20:34:14 -0400 Received: by mail-pf1-f196.google.com with SMTP id t16so265030pfe.11; Thu, 13 Jun 2019 17:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=/0EbDb07rl0+2nTNpL5MUvCUgcM2dhBTtu5L9LJF/5g=; b=fQzf7NTf2AamLhEOekVA/tGq5CXzVixbTzPlZT30QW79+jP48lozuQt7de3C/lUMk6 7p1A90E3IRJOZrR+B2m+ZrxoFfCgONFripL6/Z6mK2eXDG56V6Zi347mNIXBIr+OhFla aAg7SCSH04phUpxuD4oZnN5t/VB1pzQAvjDg+Espr09ucLisQJrJW6+c6rOQiDYNDbH5 xhdBaUkdvurnAXEPEiRXw/Kv2kk5D/VZ460Vakf2HZFPW/HJJLZOQ0mIDMFTThsckZhX 0mcILt3PpQqiZ21EFLKp0N0jJor1Tpv04ozuYMNx5aMTFznWeMM5D7UzlFmwCxJl01KW 1mtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=/0EbDb07rl0+2nTNpL5MUvCUgcM2dhBTtu5L9LJF/5g=; b=uDPLnad4C/EA2D2qXmUkEr+QLoS1ghc1SiYmgM1uXTayEO+a+kZM9oY84WdFD7llAF K5HxRmpuJ92qYgEOv0F0HQl5B563OjnlK8GWJt4kjyPq2vNLyUxaOCxjwDjjLYyNw4HB KKdiCnaRyQByEzCZRT7QrL6xkSahocJ1neWMg6dN72PIyFpX35ocCRQM1GGoYQqO8I1y khx7sccA4gIxk1IvFPxWsrf47uyrXJ6HjOPoFZDZ7rGvnM2ma/QbrywsOt3uLfSKmdsP N7zXWtDJlj7uYbdGpkYsN+I73HV3SxqHbrToHqPDcQ/WB3LqxC6a6g5eOg562xGcRNna QjIw== X-Gm-Message-State: APjAAAU4uUcw+6gv1EhpjrFfdgcU18/B2nPotznGLQwWX+mwiUNWUcIH /zNR4U+99+7RmxAt/scZ5R3+jmU1 X-Received: by 2002:a63:e950:: with SMTP id q16mr8093874pgj.270.1560472453741; Thu, 13 Jun 2019 17:34:13 -0700 (PDT) Received: from localhost ([2620:10d:c091:500::2:9d14]) by smtp.gmail.com with ESMTPSA id p3sm898857pgh.90.2019.06.13.17.34.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jun 2019 17:34:13 -0700 (PDT) From: Tejun Heo To: dsterba@suse.com, clm@fb.com, josef@toxicpanda.com, axboe@kernel.dk, jack@suse.cz Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 8/8] Btrfs: extent_write_locked_range() should attach inode->i_wb Date: Thu, 13 Jun 2019 17:33:50 -0700 Message-Id: <20190614003350.1178444-9-tj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190614003350.1178444-1-tj@kernel.org> References: <20190614003350.1178444-1-tj@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Mason extent_write_locked_range() is used when we're falling back to buffered IO from inside of compression. It allocates its own wbc and should associate it with the inode's i_wb to make sure the IO goes down from the correct cgroup. Signed-off-by: Chris Mason --- fs/btrfs/extent_io.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index d7b57341ff1a..afb916a69c30 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -4180,6 +4180,7 @@ int extent_write_locked_range(struct inode *inode, u64 start, u64 end, .no_wbc_acct = 1, }; + wbc_attach_fdatawrite_inode(&wbc_writepages, inode); while (start <= end) { page = find_get_page(mapping, start >> PAGE_SHIFT); if (clear_page_dirty_for_io(page)) @@ -4194,11 +4195,12 @@ int extent_write_locked_range(struct inode *inode, u64 start, u64 end, } ASSERT(ret <= 0); - if (ret < 0) { + if (ret == 0) + ret = flush_write_bio(&epd); + else end_write_bio(&epd, ret); - return ret; - } - ret = flush_write_bio(&epd); + + wbc_detach_inode(&wbc_writepages); return ret; } -- 2.17.1