Skip to content

Commit

Permalink
block: turn macro helpers into inline functions
Browse files Browse the repository at this point in the history
Replace bio_set_dev() with an identical inline helper and move it
further to fix a dependency problem with bio_associate_blkg(). Do the
same for bio_copy_dev().

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Pavel Begunkov authored and Jens Axboe committed Oct 20, 2021
1 parent e70feb8 commit cf6d623
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions include/linux/bio.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,22 +430,6 @@ void zero_fill_bio(struct bio *bio);

extern const char *bio_devname(struct bio *bio, char *buffer);

#define bio_set_dev(bio, bdev) \
do { \
bio_clear_flag(bio, BIO_REMAPPED); \
if ((bio)->bi_bdev != (bdev)) \
bio_clear_flag(bio, BIO_THROTTLED); \
(bio)->bi_bdev = (bdev); \
bio_associate_blkg(bio); \
} while (0)

#define bio_copy_dev(dst, src) \
do { \
bio_clear_flag(dst, BIO_REMAPPED); \
(dst)->bi_bdev = (src)->bi_bdev; \
bio_clone_blkg_association(dst, src); \
} while (0)

#define bio_dev(bio) \
disk_devt((bio)->bi_bdev->bd_disk)

Expand All @@ -463,6 +447,22 @@ static inline void bio_clone_blkg_association(struct bio *dst,
struct bio *src) { }
#endif /* CONFIG_BLK_CGROUP */

static inline void bio_set_dev(struct bio *bio, struct block_device *bdev)
{
bio_clear_flag(bio, BIO_REMAPPED);
if (bio->bi_bdev != bdev)
bio_clear_flag(bio, BIO_THROTTLED);
bio->bi_bdev = bdev;
bio_associate_blkg(bio);
}

static inline void bio_copy_dev(struct bio *dst, struct bio *src)
{
bio_clear_flag(dst, BIO_REMAPPED);
dst->bi_bdev = src->bi_bdev;
bio_clone_blkg_association(dst, src);
}

/*
* BIO list management for use by remapping drivers (e.g. DM or MD) and loop.
*
Expand Down

0 comments on commit cf6d623

Please sign in to comment.