From patchwork Fri May 22 21:14:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 6468211 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ED32EC0020 for ; Fri, 22 May 2015 21:17:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F3A9120511 for ; Fri, 22 May 2015 21:17:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 04B5F204EA for ; Fri, 22 May 2015 21:17:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946073AbbEVVPz (ORCPT ); Fri, 22 May 2015 17:15:55 -0400 Received: from mail-qg0-f41.google.com ([209.85.192.41]:34212 "EHLO mail-qg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1946036AbbEVVPv (ORCPT ); Fri, 22 May 2015 17:15:51 -0400 Received: by qgez61 with SMTP id z61so16266035qge.1; Fri, 22 May 2015 14:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=15MEOM9pTxYUmXECC/OWmNKtRso9Cus40rPNw2F/6Wc=; b=eQYo62sS5scNvs57wWIQ5z7IBuUfyPcczyEMUDbctQURaLjEZjowshWEkwBy/PQuMg Y8Yt5Qal22m8Rl5C7mlJqekYmxF5w5CQvZQNz5xwbcg+zB+te2UIKU9gilUuOeCnnMm1 MvoD6dEAqKEQe9eiCjDSGOsk+jdr7N/uDc177CqT84N54M/pj3upXF9GNxeljNyquVVY C43RAcU/NH+EqI7wjRihY2R9rha8jHeFRx5xll+LwrRwjfaPADemfe9Dq6pHu/bm97kg 1037INgHZh9PrXIDBMvDnjhPZOy/pO5Wq4FAKuU4WFMv7mV9/9FIc9ZwaU6IIeGyQfwm 85zg== X-Received: by 10.140.36.137 with SMTP id p9mr13489716qgp.16.1432329350563; Fri, 22 May 2015 14:15:50 -0700 (PDT) Received: from htj.duckdns.org.lan (207-38-238-8.c3-0.wsd-ubr1.qens-wsd.ny.cable.rcn.com. [207.38.238.8]) by mx.google.com with ESMTPSA id v1sm2059653qge.47.2015.05.22.14.15.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 May 2015 14:15:49 -0700 (PDT) From: Tejun Heo To: axboe@kernel.dk Cc: linux-kernel@vger.kernel.org, jack@suse.cz, hch@infradead.org, hannes@cmpxchg.org, linux-fsdevel@vger.kernel.org, vgoyal@redhat.com, lizefan@huawei.com, cgroups@vger.kernel.org, linux-mm@kvack.org, mhocko@suse.cz, clm@fb.com, fengguang.wu@intel.com, david@fromorbit.com, gthelen@google.com, khlebnikov@yandex-team.ru, Tejun Heo Subject: [PATCH 48/51] writeback: dirty inodes against their matching cgroup bdi_writeback's Date: Fri, 22 May 2015 17:14:02 -0400 Message-Id: <1432329245-5844-49-git-send-email-tj@kernel.org> X-Mailer: git-send-email 2.4.0 In-Reply-To: <1432329245-5844-1-git-send-email-tj@kernel.org> References: <1432329245-5844-1-git-send-email-tj@kernel.org> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP __mark_inode_dirty() always dirtied the inode against the root wb (bdi_writeback). The previous patches added all the infrastructure necessary to attribute an inode against the wb of the dirtying cgroup. This patch updates __mark_inode_dirty() so that it uses the wb associated with the inode instead of unconditionally using the root one. Currently, none of the filesystems has FS_CGROUP_WRITEBACK and all pages will keep being dirtied against the root wb. v2: Updated for per-inode wb association. Signed-off-by: Tejun Heo Cc: Jens Axboe Cc: Jan Kara Reviewed-by: Jan Kara --- fs/fs-writeback.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 59d76f6..881ea5d 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1504,7 +1504,6 @@ static noinline void block_dump___mark_inode_dirty(struct inode *inode) void __mark_inode_dirty(struct inode *inode, int flags) { struct super_block *sb = inode->i_sb; - struct backing_dev_info *bdi = NULL; int dirtytime; trace_writeback_mark_inode_dirty(inode, flags); @@ -1574,30 +1573,30 @@ void __mark_inode_dirty(struct inode *inode, int flags) * reposition it (that would break b_dirty time-ordering). */ if (!was_dirty) { + struct bdi_writeback *wb = inode_to_wb(inode); struct list_head *dirty_list; bool wakeup_bdi = false; - bdi = inode_to_bdi(inode); spin_unlock(&inode->i_lock); - spin_lock(&bdi->wb.list_lock); + spin_lock(&wb->list_lock); - WARN(bdi_cap_writeback_dirty(bdi) && - !test_bit(WB_registered, &bdi->wb.state), - "bdi-%s not registered\n", bdi->name); + WARN(bdi_cap_writeback_dirty(wb->bdi) && + !test_bit(WB_registered, &wb->state), + "bdi-%s not registered\n", wb->bdi->name); inode->dirtied_when = jiffies; if (dirtytime) inode->dirtied_time_when = jiffies; if (inode->i_state & (I_DIRTY_INODE | I_DIRTY_PAGES)) - dirty_list = &bdi->wb.b_dirty; + dirty_list = &wb->b_dirty; else - dirty_list = &bdi->wb.b_dirty_time; + dirty_list = &wb->b_dirty_time; - wakeup_bdi = inode_wb_list_move_locked(inode, &bdi->wb, + wakeup_bdi = inode_wb_list_move_locked(inode, wb, dirty_list); - spin_unlock(&bdi->wb.list_lock); + spin_unlock(&wb->list_lock); trace_writeback_dirty_inode_enqueue(inode); /* @@ -1606,8 +1605,8 @@ void __mark_inode_dirty(struct inode *inode, int flags) * to make sure background write-back happens * later. */ - if (bdi_cap_writeback_dirty(bdi) && wakeup_bdi) - wb_wakeup_delayed(&bdi->wb); + if (bdi_cap_writeback_dirty(wb->bdi) && wakeup_bdi) + wb_wakeup_delayed(wb); return; } }