mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 09:12:07 +00:00
bdev: move ->bd_has_subit_bio to ->__bd_flags
In bdev_alloc() we have all flags initialized to false, so assignment to ->bh_has_submit_bio n there is a no-op unless we have partno != 0 and flag already set on entire device. In device_add_disk() we have just allocated the block_device in question and it had been a full-device one, so the flag is guaranteed to be still clear when we get to assignment. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
4c80105e39
commit
ac2b6f9dee
@ -414,10 +414,8 @@ struct block_device *bdev_alloc(struct gendisk *disk, u8 partno)
|
||||
atomic_set(&bdev->__bd_flags, partno);
|
||||
bdev->bd_inode = inode;
|
||||
bdev->bd_queue = disk->queue;
|
||||
if (partno)
|
||||
bdev->bd_has_submit_bio = disk->part0->bd_has_submit_bio;
|
||||
else
|
||||
bdev->bd_has_submit_bio = false;
|
||||
if (partno && bdev_test_flag(disk->part0, BD_HAS_SUBMIT_BIO))
|
||||
bdev_set_flag(bdev, BD_HAS_SUBMIT_BIO);
|
||||
bdev->bd_stats = alloc_percpu(struct disk_stats);
|
||||
if (!bdev->bd_stats) {
|
||||
iput(inode);
|
||||
|
@ -615,7 +615,7 @@ static void __submit_bio(struct bio *bio)
|
||||
if (unlikely(!blk_crypto_bio_prep(&bio)))
|
||||
return;
|
||||
|
||||
if (!bio->bi_bdev->bd_has_submit_bio) {
|
||||
if (!bdev_test_flag(bio->bi_bdev, BD_HAS_SUBMIT_BIO)) {
|
||||
blk_mq_submit_bio(bio);
|
||||
} else if (likely(bio_queue_enter(bio) == 0)) {
|
||||
struct gendisk *disk = bio->bi_bdev->bd_disk;
|
||||
@ -723,7 +723,7 @@ void submit_bio_noacct_nocheck(struct bio *bio)
|
||||
*/
|
||||
if (current->bio_list)
|
||||
bio_list_add(¤t->bio_list[0], bio);
|
||||
else if (!bio->bi_bdev->bd_has_submit_bio)
|
||||
else if (!bdev_test_flag(bio->bi_bdev, BD_HAS_SUBMIT_BIO))
|
||||
__submit_bio_noacct_mq(bio);
|
||||
else
|
||||
__submit_bio_noacct(bio);
|
||||
|
@ -413,7 +413,8 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
|
||||
elevator_init_mq(disk->queue);
|
||||
|
||||
/* Mark bdev as having a submit_bio, if needed */
|
||||
disk->part0->bd_has_submit_bio = disk->fops->submit_bio != NULL;
|
||||
if (disk->fops->submit_bio)
|
||||
bdev_set_flag(disk->part0, BD_HAS_SUBMIT_BIO);
|
||||
|
||||
/*
|
||||
* If the driver provides an explicit major number it also must provide
|
||||
|
@ -49,7 +49,7 @@ struct block_device {
|
||||
#define BD_PARTNO 255 // lower 8 bits; assign-once
|
||||
#define BD_READ_ONLY (1u<<8) // read-only policy
|
||||
#define BD_WRITE_HOLDER (1u<<9)
|
||||
bool bd_has_submit_bio;
|
||||
#define BD_HAS_SUBMIT_BIO (1u<<10)
|
||||
dev_t bd_dev;
|
||||
struct inode *bd_inode; /* will die */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user