Skip to content

Commit ecd92cf

Browse files
damien-lemoalaxboe
authored andcommitted
block: remove bdev_nonrot()
bdev_nonrot() is simply the negative return value of bdev_rot(). So replace all call sites of bdev_nonrot() with calls to bdev_rot() and remove bdev_nonrot(). Signed-off-by: Damien Le Moal <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Reviewed-by: Paul Menzel <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent d0e5fc7 commit ecd92cf

10 files changed

Lines changed: 10 additions & 15 deletions

File tree

drivers/md/raid1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1878,7 +1878,7 @@ static bool raid1_add_conf(struct r1conf *conf, struct md_rdev *rdev, int disk,
18781878
if (info->rdev)
18791879
return false;
18801880

1881-
if (bdev_nonrot(rdev->bdev)) {
1881+
if (!bdev_rot(rdev->bdev)) {
18821882
set_bit(Nonrot, &rdev->flags);
18831883
WRITE_ONCE(conf->nonrot_disks, conf->nonrot_disks + 1);
18841884
}

drivers/md/raid10.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ static struct md_rdev *read_balance(struct r10conf *conf,
806806
if (!do_balance)
807807
break;
808808

809-
nonrot = bdev_nonrot(rdev->bdev);
809+
nonrot = !bdev_rot(rdev->bdev);
810810
has_nonrot_disk |= nonrot;
811811
pending = atomic_read(&rdev->nr_pending);
812812
if (min_pending > pending && nonrot) {

drivers/md/raid5.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7541,7 +7541,7 @@ static struct r5conf *setup_conf(struct mddev *mddev)
75417541
rdev_for_each(rdev, mddev) {
75427542
if (test_bit(Journal, &rdev->flags))
75437543
continue;
7544-
if (bdev_nonrot(rdev->bdev)) {
7544+
if (!bdev_rot(rdev->bdev)) {
75457545
conf->batch_bio_dispatch = false;
75467546
break;
75477547
}

drivers/target/target_core_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static int fd_configure_device(struct se_device *dev)
173173
*/
174174
dev->dev_attrib.max_write_same_len = 0xFFFF;
175175

176-
if (bdev_nonrot(bdev))
176+
if (!bdev_rot(bdev))
177177
dev->dev_attrib.is_nonrot = 1;
178178
} else {
179179
if (!(fd_dev->fbd_flags & FBDF_HAS_SIZE)) {

drivers/target/target_core_iblock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static int iblock_configure_device(struct se_device *dev)
148148
else
149149
dev->dev_attrib.max_write_same_len = 0xFFFF;
150150

151-
if (bdev_nonrot(bd))
151+
if (!bdev_rot(bd))
152152
dev->dev_attrib.is_nonrot = 1;
153153

154154
target_configure_write_atomic_from_bdev(&dev->dev_attrib, bd);

fs/btrfs/volumes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ static int btrfs_open_one_device(struct btrfs_fs_devices *fs_devices,
694694
set_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state);
695695
}
696696

697-
if (!bdev_nonrot(file_bdev(bdev_file)))
697+
if (bdev_rot(file_bdev(bdev_file)))
698698
fs_devices->rotating = true;
699699

700700
if (bdev_max_discard_sectors(file_bdev(bdev_file)))
@@ -2919,7 +2919,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
29192919

29202920
atomic64_add(device->total_bytes, &fs_info->free_chunk_space);
29212921

2922-
if (!bdev_nonrot(device->bdev))
2922+
if (bdev_rot(device->bdev))
29232923
fs_devices->rotating = true;
29242924

29252925
orig_super_total_bytes = btrfs_super_total_bytes(fs_info->super_copy);

fs/ext4/mballoc-test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static int mbt_mb_init(struct super_block *sb)
7272
ext4_fsblk_t block;
7373
int ret;
7474

75-
/* needed by ext4_mb_init->bdev_nonrot(sb->s_bdev) */
75+
/* needed by ext4_mb_init->bdev_rot(sb->s_bdev) */
7676
sb->s_bdev = kzalloc_obj(*sb->s_bdev);
7777
if (sb->s_bdev == NULL)
7878
return -ENOMEM;

fs/ext4/mballoc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3836,7 +3836,7 @@ int ext4_mb_init(struct super_block *sb)
38363836
spin_lock_init(&lg->lg_prealloc_lock);
38373837
}
38383838

3839-
if (bdev_nonrot(sb->s_bdev))
3839+
if (!bdev_rot(sb->s_bdev))
38403840
sbi->s_mb_max_linear_groups = 0;
38413841
else
38423842
sbi->s_mb_max_linear_groups = MB_DEFAULT_LINEAR_LIMIT;

include/linux/blkdev.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,11 +1475,6 @@ static inline bool bdev_rot(struct block_device *bdev)
14751475
return blk_queue_rot(bdev_get_queue(bdev));
14761476
}
14771477

1478-
static inline bool bdev_nonrot(struct block_device *bdev)
1479-
{
1480-
return !bdev_rot(bdev);
1481-
}
1482-
14831478
static inline bool bdev_synchronous(struct block_device *bdev)
14841479
{
14851480
return bdev->bd_disk->queue->limits.features & BLK_FEAT_SYNCHRONOUS;

mm/swapfile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3460,7 +3460,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
34603460
if (si->bdev && bdev_synchronous(si->bdev))
34613461
si->flags |= SWP_SYNCHRONOUS_IO;
34623462

3463-
if (si->bdev && bdev_nonrot(si->bdev)) {
3463+
if (si->bdev && !bdev_rot(si->bdev)) {
34643464
si->flags |= SWP_SOLIDSTATE;
34653465
} else {
34663466
atomic_inc(&nr_rotate_swap);

0 commit comments

Comments
 (0)