Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a9508b0 authored by Chris Mason's avatar Chris Mason
Browse files

btrfs: fix compile when block cgroups are not enabled



bio->bi_css and bio->bi_ioc don't exist when block cgroups are not on.
This adds an ifdef around them.  It's not perfect, but our
use of bi_ioc is being removed in the 4.3 merge window.

The bi_css usage really should go into bio_clone, but I want to make
sure that doesn't introduce problems for other bio_clone use cases.

Signed-off-by: default avatarChris Mason <clm@fb.com>
parent b84b8390
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -2730,9 +2730,12 @@ struct bio *btrfs_bio_clone(struct bio *bio, gfp_t gfp_mask)
		btrfs_bio->csum = NULL;
		btrfs_bio->csum = NULL;
		btrfs_bio->csum_allocated = NULL;
		btrfs_bio->csum_allocated = NULL;
		btrfs_bio->end_io = NULL;
		btrfs_bio->end_io = NULL;

#ifdef CONFIG_BLK_CGROUP
		/* FIXME, put this into bio_clone_bioset */
		/* FIXME, put this into bio_clone_bioset */
		if (bio->bi_css)
		if (bio->bi_css)
			bio_associate_blkcg(new, bio->bi_css);
			bio_associate_blkcg(new, bio->bi_css);
#endif
	}
	}
	return new;
	return new;
}
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -5955,6 +5955,7 @@ static int breakup_stripe_bio(struct btrfs_root *root, struct btrfs_bio *bbio,
	if (!bio)
	if (!bio)
		return -ENOMEM;
		return -ENOMEM;


#ifdef CONFIG_BLK_CGROUP
	if (first_bio->bi_ioc) {
	if (first_bio->bi_ioc) {
		get_io_context_active(first_bio->bi_ioc);
		get_io_context_active(first_bio->bi_ioc);
		bio->bi_ioc = first_bio->bi_ioc;
		bio->bi_ioc = first_bio->bi_ioc;
@@ -5963,6 +5964,7 @@ static int breakup_stripe_bio(struct btrfs_root *root, struct btrfs_bio *bbio,
		css_get(first_bio->bi_css);
		css_get(first_bio->bi_css);
		bio->bi_css = first_bio->bi_css;
		bio->bi_css = first_bio->bi_css;
	}
	}
#endif
	while (bvec <= (first_bio->bi_io_vec + first_bio->bi_vcnt - 1)) {
	while (bvec <= (first_bio->bi_io_vec + first_bio->bi_vcnt - 1)) {
		if (bio_add_page(bio, bvec->bv_page, bvec->bv_len,
		if (bio_add_page(bio, bvec->bv_page, bvec->bv_len,
				 bvec->bv_offset) < bvec->bv_len) {
				 bvec->bv_offset) < bvec->bv_len) {