[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 10 Oct 2017 08:54:40 -0700
From: Tejun Heo <tj@...nel.org>
To: jack@...e.cz, axboe@...nel.dk, clm@...com, jbacik@...com
Cc: kernel-team@...com, linux-kernel@...r.kernel.org,
linux-btrfs@...r.kernel.org, Tejun Heo <tj@...nel.org>
Subject: [PATCH 4/5] cgroup, buffer_head: implement submit_bh_blkcg_css()
Implement submit_bh_blkcg_css() which will be used to override cgroup
membership on specific buffer_heads.
v2: Reimplemented using create_bh_bio() as suggested by Jan.
Signed-off-by: Tejun Heo <tj@...nel.org>
Cc: Jan Kara <jack@...e.cz>
Cc: Jens Axboe <axboe@...nel.dk>
---
fs/buffer.c | 12 ++++++++++++
include/linux/buffer_head.h | 3 +++
2 files changed, 15 insertions(+)
diff --git a/fs/buffer.c b/fs/buffer.c
index b4b2169..ed0e473 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3147,6 +3147,18 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
return 0;
}
+int submit_bh_blkcg_css(int op, int op_flags, struct buffer_head *bh,
+ struct cgroup_subsys_state *blkcg_css)
+{
+ struct bio *bio;
+
+ bio = create_bh_bio(op, op_flags, bh, 0);
+ bio_associate_blkcg(bio, blkcg_css);
+ submit_bio(bio);
+ return 0;
+}
+EXPORT_SYMBOL(submit_bh_blkcg_css);
+
int submit_bh(int op, int op_flags, struct buffer_head *bh)
{
struct bio *bio;
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index c8dae55..dca5b3b 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -13,6 +13,7 @@
#include <linux/pagemap.h>
#include <linux/wait.h>
#include <linux/atomic.h>
+#include <linux/cgroup.h>
#ifdef CONFIG_BLOCK
@@ -197,6 +198,8 @@ void ll_rw_block(int, int, int, struct buffer_head * bh[]);
int sync_dirty_buffer(struct buffer_head *bh);
int __sync_dirty_buffer(struct buffer_head *bh, int op_flags);
void write_dirty_buffer(struct buffer_head *bh, int op_flags);
+int submit_bh_blkcg_css(int op, int op_flags, struct buffer_head *bh,
+ struct cgroup_subsys_state *blkcg_css);
int submit_bh(int, int, struct buffer_head *);
void write_boundary_block(struct block_device *bdev,
sector_t bblock, unsigned blocksize);
--
2.9.5
Powered by blists - more mailing lists