From: Tejun Heo <tj@kernel.org>
To: jack@suse.cz, axboe@kernel.dk, clm@fb.com, jbacik@fb.com
Cc: kernel-team@fb.com, linux-kernel@vger.kernel.org,
linux-btrfs@vger.kernel.org, Tejun Heo <tj@kernel.org>
Subject: [PATCH 4/5] cgroup, buffer_head: implement submit_bh_blkcg_css()
Date: Tue, 10 Oct 2017 08:54:40 -0700 [thread overview]
Message-ID: <20171010155441.753966-5-tj@kernel.org> (raw)
In-Reply-To: <20171010155441.753966-1-tj@kernel.org>
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@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Jens Axboe <axboe@kernel.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
next prev parent reply other threads:[~2017-10-10 15:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-10 15:54 [PATCHSET v2] cgroup, writeback, btrfs: make sure btrfs issues metadata IOs from the root cgroup Tejun Heo
2017-10-10 15:54 ` [PATCH 1/5] blkcg: export blkcg_root_css Tejun Heo
2017-10-11 7:50 ` Jan Kara
2017-10-10 15:54 ` [PATCH 2/5] cgroup, writeback: replace SB_I_CGROUPWB with per-inode S_CGROUPWB Tejun Heo
2017-10-10 15:54 ` [PATCH 3/5] buffer_head: separate out create_bh_bio() from submit_bh_wbc() Tejun Heo
2017-10-11 7:54 ` Jan Kara
2017-10-10 15:54 ` Tejun Heo [this message]
2017-10-11 7:55 ` [PATCH 4/5] cgroup, buffer_head: implement submit_bh_blkcg_css() Jan Kara
2017-10-10 15:54 ` [PATCH 5/5] btrfs: ensure that metadata and flush are issued from the root cgroup Tejun Heo
2017-10-10 16:43 ` [PATCH v2 " Tejun Heo
2017-10-10 17:45 ` Liu Bo
2017-10-11 17:07 ` David Sterba
2017-10-12 15:38 ` Tejun Heo
2017-10-12 17:06 ` [PATCH v3 " Tejun Heo
2017-10-12 18:56 ` David Sterba
2017-11-29 16:56 ` [PATCHSET v2] cgroup, writeback, btrfs: make sure btrfs issues metadata IOs " Jan Kara
2017-11-29 17:03 ` Tejun Heo
2017-11-29 17:05 ` Tejun Heo
2017-11-29 18:38 ` Chris Mason
2017-11-30 17:23 ` David Sterba
2017-11-30 17:34 ` Chris Mason
2017-12-01 10:52 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171010155441.753966-5-tj@kernel.org \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--cc=clm@fb.com \
--cc=jack@suse.cz \
--cc=jbacik@fb.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).