[Devel] [PATCH rh7 6/7] ub: account writeback io
Vladimir Davydov
vdavydov at parallels.com
Tue Jun 9 07:06:47 PDT 2015
This patch ports hunks left from the following RH6 commits:
diff-ubc-inode-wb-set-exec-to-dirtier
diff-ubc-iostat-acct-writeback-io
diff-ubc-iostat-acct-wb-at-req-insert
Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
block/cfq-iosched.c | 10 ++++++++++
fs/fs-writeback.c | 19 ++++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index faf5cdd00e01..5d8d665c79d3 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -2408,6 +2408,11 @@ static void cfq_bio_merged(struct request_queue *q, struct request *req,
struct bio *bio)
{
cfqg_stats_update_io_merged(RQ_CFQG(req), bio->bi_rw);
+#ifdef CONFIG_BC_IO_PRIORITY
+ if (get_exec_ub()->ub_bound_css[UB_BLKIO_CGROUP] !=
+ &(RQ_CFQG(req))->pd.blkg->blkcg->css)
+ ub_writeback_io(0, bio_sectors(bio));
+#endif
}
static void
@@ -3987,6 +3992,11 @@ static void cfq_insert_request(struct request_queue *q, struct request *rq)
cfqg_stats_update_io_add(RQ_CFQG(rq), cfqd->serving_group,
rq->cmd_flags);
+#ifdef CONFIG_BC_IO_PRIORITY
+ if (get_exec_ub()->ub_bound_css[UB_BLKIO_CGROUP] !=
+ &(RQ_CFQG(rq))->pd.blkg->blkcg->css)
+ ub_writeback_io(1, blk_rq_sectors(rq));
+#endif
virtinfo_notifier_call_irq(VITYPE_IO, VIRTINFO_IO_OP_ACCOUNT, q);
cfq_rq_enqueued(cfqd, cfqq, rq);
}
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 8161c40fd900..8362cc933e68 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -440,7 +440,7 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,
* setting I_SYNC flag and calling inode_sync_complete() to clear it.
*/
static int
-__writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
+__do_writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
{
struct address_space *mapping = inode->i_mapping;
long nr_to_write = wbc->nr_to_write;
@@ -488,6 +488,23 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
return ret;
}
+static int
+__writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
+{
+ struct user_beancounter *ub = inode->i_mapping->dirtied_ub;
+ int ret;
+
+ if (likely(get_exec_ub() == ub || !ub))
+ return __do_writeback_single_inode(inode, wbc);
+
+ ub = get_beancounter_rcu(ub) ? set_exec_ub(ub) : NULL;
+ ret = __do_writeback_single_inode(inode, wbc);
+ if (ub)
+ put_beancounter(set_exec_ub(ub));
+
+ return ret;
+}
+
/*
* Write out an inode's dirty pages. Either the caller has an active reference
* on the inode or the inode has I_WILL_FREE set.
--
2.1.4
More information about the Devel
mailing list