]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
block: remove bdev_nonrot()
authorDamien Le Moal <dlemoal@kernel.org>
Thu, 26 Feb 2026 07:54:48 +0000 (16:54 +0900)
committerJens Axboe <axboe@kernel.dk>
Mon, 9 Mar 2026 20:30:00 +0000 (14:30 -0600)
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 <dlemoal@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/raid1.c
drivers/md/raid10.c
drivers/md/raid5.c
drivers/target/target_core_file.c
drivers/target/target_core_iblock.c
fs/btrfs/volumes.c
fs/ext4/mballoc-test.c
fs/ext4/mballoc.c
include/linux/blkdev.h
mm/swapfile.c

index 181400e147c0df8e271411e539e193cb80b02c3b..cda6af0712b9296fc92224d0fd1682d74ea6fd19 100644 (file)
@@ -1878,7 +1878,7 @@ static bool raid1_add_conf(struct r1conf *conf, struct md_rdev *rdev, int disk,
        if (info->rdev)
                return false;
 
-       if (bdev_nonrot(rdev->bdev)) {
+       if (!bdev_rot(rdev->bdev)) {
                set_bit(Nonrot, &rdev->flags);
                WRITE_ONCE(conf->nonrot_disks, conf->nonrot_disks + 1);
        }
index 0653b5d8545a6c0dd98075b8df5ee2f47b99b613..cfbd345805ca2dcdf094af8b9efdd254674cbada 100644 (file)
@@ -806,7 +806,7 @@ static struct md_rdev *read_balance(struct r10conf *conf,
                if (!do_balance)
                        break;
 
-               nonrot = bdev_nonrot(rdev->bdev);
+               nonrot = !bdev_rot(rdev->bdev);
                has_nonrot_disk |= nonrot;
                pending = atomic_read(&rdev->nr_pending);
                if (min_pending > pending && nonrot) {
index a8e8d431071bac8c2a875f148e06c468389a309a..ba9d6d05b0895c47fa9e4403a43617a80900773e 100644 (file)
@@ -7541,7 +7541,7 @@ static struct r5conf *setup_conf(struct mddev *mddev)
        rdev_for_each(rdev, mddev) {
                if (test_bit(Journal, &rdev->flags))
                        continue;
-               if (bdev_nonrot(rdev->bdev)) {
+               if (!bdev_rot(rdev->bdev)) {
                        conf->batch_bio_dispatch = false;
                        break;
                }
index 3ae1f7137d9d59fd98a17026585ef0596816eed1..d6e3e52146527283446576507e4f4bbce2cbf560 100644 (file)
@@ -173,7 +173,7 @@ static int fd_configure_device(struct se_device *dev)
                 */
                dev->dev_attrib.max_write_same_len = 0xFFFF;
 
-               if (bdev_nonrot(bdev))
+               if (!bdev_rot(bdev))
                        dev->dev_attrib.is_nonrot = 1;
        } else {
                if (!(fd_dev->fbd_flags & FBDF_HAS_SIZE)) {
index 3c92f94497b47e73db66d32273f20b421a1226bb..1087d1d17c36dd0742ebc0dcccedc933aa1168cd 100644 (file)
@@ -148,7 +148,7 @@ static int iblock_configure_device(struct se_device *dev)
        else
                dev->dev_attrib.max_write_same_len = 0xFFFF;
 
-       if (bdev_nonrot(bd))
+       if (!bdev_rot(bd))
                dev->dev_attrib.is_nonrot = 1;
 
        target_configure_write_atomic_from_bdev(&dev->dev_attrib, bd);
index 648bb09fc41660ee914eee6b2c37e4c307012b87..353c9caa8ab92f8bcf2218b2d22a5dda6d975498 100644 (file)
@@ -694,7 +694,7 @@ static int btrfs_open_one_device(struct btrfs_fs_devices *fs_devices,
                        set_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state);
        }
 
-       if (!bdev_nonrot(file_bdev(bdev_file)))
+       if (bdev_rot(file_bdev(bdev_file)))
                fs_devices->rotating = true;
 
        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
 
        atomic64_add(device->total_bytes, &fs_info->free_chunk_space);
 
-       if (!bdev_nonrot(device->bdev))
+       if (bdev_rot(device->bdev))
                fs_devices->rotating = true;
 
        orig_super_total_bytes = btrfs_super_total_bytes(fs_info->super_copy);
index 9fbdf6a09489c7531b5c38b8c58e05c68495918f..b9f22e3a8d5cb46185febc095a943ad5ace7cfbb 100644 (file)
@@ -72,7 +72,7 @@ static int mbt_mb_init(struct super_block *sb)
        ext4_fsblk_t block;
        int ret;
 
-       /* needed by ext4_mb_init->bdev_nonrot(sb->s_bdev) */
+       /* needed by ext4_mb_init->bdev_rot(sb->s_bdev) */
        sb->s_bdev = kzalloc_obj(*sb->s_bdev);
        if (sb->s_bdev == NULL)
                return -ENOMEM;
index 20e9fdaf4301b61c9d54401ed95067db6b6b8173..8a4dfe19878c19a340f52c651eb98ec361a9ee6a 100644 (file)
@@ -3836,7 +3836,7 @@ int ext4_mb_init(struct super_block *sb)
                spin_lock_init(&lg->lg_prealloc_lock);
        }
 
-       if (bdev_nonrot(sb->s_bdev))
+       if (!bdev_rot(sb->s_bdev))
                sbi->s_mb_max_linear_groups = 0;
        else
                sbi->s_mb_max_linear_groups = MB_DEFAULT_LINEAR_LIMIT;
index ef6457487d234f5f5c7cec9fb0c7360bd03154bc..8d93d8e356d879691ac5ded4dd41bf5d5fb9ad8e 100644 (file)
@@ -1475,11 +1475,6 @@ static inline bool bdev_rot(struct block_device *bdev)
        return blk_queue_rot(bdev_get_queue(bdev));
 }
 
-static inline bool bdev_nonrot(struct block_device *bdev)
-{
-       return !bdev_rot(bdev);
-}
-
 static inline bool bdev_synchronous(struct block_device *bdev)
 {
        return bdev->bd_disk->queue->limits.features & BLK_FEAT_SYNCHRONOUS;
index 94af29d1de8887135f8466c7c7b75121a45d273c..60e21414624baa72ccf0963332874cca3c0c373c 100644 (file)
@@ -3460,7 +3460,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
        if (si->bdev && bdev_synchronous(si->bdev))
                si->flags |= SWP_SYNCHRONOUS_IO;
 
-       if (si->bdev && bdev_nonrot(si->bdev)) {
+       if (si->bdev && !bdev_rot(si->bdev)) {
                si->flags |= SWP_SOLIDSTATE;
        } else {
                atomic_inc(&nr_rotate_swap);