[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1420579582-8516-37-git-send-email-tj@kernel.org>
Date: Tue, 6 Jan 2015 16:26:13 -0500
From: Tejun Heo <tj@...nel.org>
To: axboe@...nel.dk
Cc: linux-kernel@...r.kernel.org, jack@...e.cz, hch@...radead.org,
hannes@...xchg.org, linux-fsdevel@...r.kernel.org,
vgoyal@...hat.com, lizefan@...wei.com, cgroups@...r.kernel.org,
linux-mm@...ck.org, mhocko@...e.cz, clm@...com,
fengguang.wu@...el.com, david@...morbit.com,
Tejun Heo <tj@...nel.org>
Subject: [PATCH 36/45] writeback: dirty inodes against their matching cgroup bdi_writeback's
mark_inode_dirty_dctx() 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.
On entry to mark_inode_dirty_dctx(), @dctx now carries the matching wb
and iwbl (inode_wb_link). This patch updates mark_inode_dirty_dctx()
so that it uses the wb and iwbl from @dctx instead of unconditionally
using the root ones.
Currently, none of the filesystems has FS_CGROUP_WRITEBACK and all
pages will keep being dirtied against the root wb.
Signed-off-by: Tejun Heo <tj@...nel.org>
Cc: Jens Axboe <axboe@...nel.dk>
Cc: Jan Kara <jack@...e.cz>
---
fs/fs-writeback.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index df99b5b..dfcf5dd 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1734,8 +1734,9 @@ static noinline void block_dump___mark_inode_dirty(struct inode *inode)
void mark_inode_dirty_dctx(struct dirty_context *dctx, int flags)
{
struct inode *inode = dctx->inode;
+ struct inode_wb_link *iwbl = dctx->iwbl;
+ struct bdi_writeback *wb = dctx->wb;
struct super_block *sb = inode->i_sb;
- struct backing_dev_info *bdi = NULL;
/*
* Don't do this for I_DIRTY_PAGES - that doesn't actually
@@ -1764,7 +1765,6 @@ void mark_inode_dirty_dctx(struct dirty_context *dctx, int flags)
spin_lock(&inode->i_lock);
if ((inode->i_state & flags) != flags) {
- struct inode_wb_link *iwbl = &inode->i_wb_link;
const int was_dirty = inode->i_state & I_DIRTY;
inode->i_state |= flags;
@@ -1794,19 +1794,17 @@ void mark_inode_dirty_dctx(struct dirty_context *dctx, int flags)
*/
if (!was_dirty) {
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);
iwbl->dirtied_when = jiffies;
- wakeup_bdi = iwbl_move_locked(iwbl, &bdi->wb,
- &bdi->wb.b_dirty);
- spin_unlock(&bdi->wb.list_lock);
+ wakeup_bdi = iwbl_move_locked(iwbl, wb, &wb->b_dirty);
+ spin_unlock(&wb->list_lock);
/*
* If this is the first dirty inode for this bdi,
@@ -1814,8 +1812,8 @@ void mark_inode_dirty_dctx(struct dirty_context *dctx, 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;
}
}
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists