btrfs: switch RCU helper versions to btrfs_err()
authorDavid Sterba <dsterba@suse.com>
Mon, 9 Jun 2025 17:09:25 +0000 (19:09 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 21:56:38 +0000 (23:56 +0200)
The RCU protection is now done in the plain helpers, we can remove the
"_in_rcu" and "_rl_in_rcu".

Reviewed-by: Daniel Vacek <neelx@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/dev-replace.c
fs/btrfs/messages.h
fs/btrfs/scrub.c
fs/btrfs/volumes.c
fs/btrfs/zoned.c

index 2decb9fff44519dc977fc94ace7479ab98ef3874..0e9acedd7bb4673f9a7512b806d37eb6f460bb48 100644 (file)
@@ -943,7 +943,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
                                                                tgt_device);
        } else {
                if (scrub_ret != -ECANCELED)
-                       btrfs_err_in_rcu(fs_info,
+                       btrfs_err(fs_info,
                                 "btrfs_scrub_dev(%s, %llu, %s) failed %d",
                                 btrfs_dev_name(src_device),
                                 src_device->devid,
index fe9a92da6b1439b0a6df766c4a8a05c2fe60cad0..f9f68a2a7697920c3644cededa8e624720a72d18 100644 (file)
@@ -54,8 +54,6 @@ void _btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...);
  */
 #define btrfs_crit_in_rcu(fs_info, fmt, args...) \
        btrfs_printk_in_rcu(fs_info, KERN_CRIT fmt, ##args)
-#define btrfs_err_in_rcu(fs_info, fmt, args...) \
-       btrfs_printk_in_rcu(fs_info, KERN_ERR fmt, ##args)
 #define btrfs_warn_in_rcu(fs_info, fmt, args...) \
        btrfs_printk_in_rcu(fs_info, KERN_WARNING fmt, ##args)
 #define btrfs_info_in_rcu(fs_info, fmt, args...) \
@@ -66,8 +64,6 @@ void _btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...);
  */
 #define btrfs_crit_rl_in_rcu(fs_info, fmt, args...) \
        btrfs_printk_rl_in_rcu(fs_info, KERN_CRIT fmt, ##args)
-#define btrfs_err_rl_in_rcu(fs_info, fmt, args...) \
-       btrfs_printk_rl_in_rcu(fs_info, KERN_ERR fmt, ##args)
 #define btrfs_warn_rl_in_rcu(fs_info, fmt, args...) \
        btrfs_printk_rl_in_rcu(fs_info, KERN_WARNING fmt, ##args)
 #define btrfs_info_rl_in_rcu(fs_info, fmt, args...) \
index e8fa277545637640942895d85d6ca931d1aa9311..04c43f05afc9faad13e1b9e711765feb86ef701e 100644 (file)
@@ -1045,12 +1045,12 @@ skip:
                 */
                if (repaired) {
                        if (dev) {
-                               btrfs_err_rl_in_rcu(fs_info,
+                               btrfs_err_rl(fs_info,
                "scrub: fixed up error at logical %llu on dev %s physical %llu",
                                            stripe->logical, btrfs_dev_name(dev),
                                            physical);
                        } else {
-                               btrfs_err_rl_in_rcu(fs_info,
+                               btrfs_err_rl(fs_info,
                           "scrub: fixed up error at logical %llu on mirror %u",
                                            stripe->logical, stripe->mirror_num);
                        }
@@ -1059,12 +1059,12 @@ skip:
 
                /* The remaining are all for unrepaired. */
                if (dev) {
-                       btrfs_err_rl_in_rcu(fs_info,
+                       btrfs_err_rl(fs_info,
 "scrub: unable to fixup (regular) error at logical %llu on dev %s physical %llu",
                                            stripe->logical, btrfs_dev_name(dev),
                                            physical);
                } else {
-                       btrfs_err_rl_in_rcu(fs_info,
+                       btrfs_err_rl(fs_info,
          "scrub: unable to fixup (regular) error at logical %llu on mirror %u",
                                            stripe->logical, stripe->mirror_num);
                }
@@ -3057,7 +3057,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
        if (!is_dev_replace && !readonly &&
            !test_bit(BTRFS_DEV_STATE_WRITEABLE, &dev->dev_state)) {
                mutex_unlock(&fs_info->fs_devices->device_list_mutex);
-               btrfs_err_in_rcu(fs_info,
+               btrfs_err(fs_info,
                        "scrub: devid %llu: filesystem on %s is not writable",
                                 devid, btrfs_dev_name(dev));
                ret = -EROFS;
index afbd10bb627582ed99bd0b17a49a4b53fffe2a9a..a0aec28f869a0991838a88b6632b3df2fb672fb4 100644 (file)
@@ -7795,7 +7795,7 @@ void btrfs_dev_stat_inc_and_print(struct btrfs_device *dev, int index)
 
        if (!dev->dev_stats_valid)
                return;
-       btrfs_err_rl_in_rcu(dev->fs_info,
+       btrfs_err_rl(dev->fs_info,
                "bdev %s errs: wr %u, rd %u, flush %u, corrupt %u, gen %u",
                           btrfs_dev_name(dev),
                           btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_WRITE_ERRS),
index 4ab7808bca6219d59d0c9f8ce585301dfde917eb..157ee6828f35f3ae507ffe828c55e5dad9b2fad6 100644 (file)
@@ -264,7 +264,7 @@ static int btrfs_get_dev_zones(struct btrfs_device *device, u64 pos,
        ret = blkdev_report_zones(device->bdev, pos >> SECTOR_SHIFT, *nr_zones,
                                  copy_zone_info_cb, zones);
        if (ret < 0) {
-               btrfs_err_in_rcu(device->fs_info,
+               btrfs_err(device->fs_info,
                                 "zoned: failed to read zone %llu on %s (devid %llu)",
                                 pos, rcu_str_deref(device->name),
                                 device->devid);
@@ -396,14 +396,14 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache)
 
        /* We reject devices with a zone size larger than 8GB */
        if (zone_info->zone_size > BTRFS_MAX_ZONE_SIZE) {
-               btrfs_err_in_rcu(fs_info,
+               btrfs_err(fs_info,
                "zoned: %s: zone size %llu larger than supported maximum %llu",
                                 rcu_str_deref(device->name),
                                 zone_info->zone_size, BTRFS_MAX_ZONE_SIZE);
                ret = -EINVAL;
                goto out;
        } else if (zone_info->zone_size < BTRFS_MIN_ZONE_SIZE) {
-               btrfs_err_in_rcu(fs_info,
+               btrfs_err(fs_info,
                "zoned: %s: zone size %llu smaller than supported minimum %u",
                                 rcu_str_deref(device->name),
                                 zone_info->zone_size, BTRFS_MIN_ZONE_SIZE);
@@ -419,7 +419,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache)
 
        max_active_zones = bdev_max_active_zones(bdev);
        if (max_active_zones && max_active_zones < BTRFS_MIN_ACTIVE_ZONES) {
-               btrfs_err_in_rcu(fs_info,
+               btrfs_err(fs_info,
 "zoned: %s: max active zones %u is too small, need at least %u active zones",
                                 rcu_str_deref(device->name), max_active_zones,
                                 BTRFS_MIN_ACTIVE_ZONES);
@@ -461,7 +461,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache)
                zone_info->zone_cache = vcalloc(zone_info->nr_zones,
                                                sizeof(struct blk_zone));
                if (!zone_info->zone_cache) {
-                       btrfs_err_in_rcu(device->fs_info,
+                       btrfs_err(device->fs_info,
                                "zoned: failed to allocate zone cache for %s",
                                rcu_str_deref(device->name));
                        ret = -ENOMEM;
@@ -498,7 +498,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache)
        }
 
        if (nreported != zone_info->nr_zones) {
-               btrfs_err_in_rcu(device->fs_info,
+               btrfs_err(device->fs_info,
                                 "inconsistent number of zones on %s (%u/%u)",
                                 rcu_str_deref(device->name), nreported,
                                 zone_info->nr_zones);
@@ -508,7 +508,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache)
 
        if (max_active_zones) {
                if (nactive > max_active_zones) {
-                       btrfs_err_in_rcu(device->fs_info,
+                       btrfs_err(device->fs_info,
                        "zoned: %u active zones on %s exceeds max_active_zones %u",
                                         nactive, rcu_str_deref(device->name),
                                         max_active_zones);
@@ -539,7 +539,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache)
                        goto out;
 
                if (nr_zones != BTRFS_NR_SB_LOG_ZONES) {
-                       btrfs_err_in_rcu(device->fs_info,
+                       btrfs_err(device->fs_info,
        "zoned: failed to read super block log zone info at devid %llu zone %u",
                                         device->devid, sb_zone);
                        ret = -EUCLEAN;
@@ -557,7 +557,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache)
                ret = sb_write_pointer(device->bdev,
                                       &zone_info->sb_zones[sb_pos], &sb_wp);
                if (ret != -ENOENT && ret) {
-                       btrfs_err_in_rcu(device->fs_info,
+                       btrfs_err(device->fs_info,
                        "zoned: super block log zone corrupted devid %llu zone %u",
                                         device->devid, sb_zone);
                        ret = -EUCLEAN;
@@ -1346,7 +1346,7 @@ static int btrfs_load_zone_info(struct btrfs_fs_info *fs_info, int zone_idx,
        }
 
        if (zone.type == BLK_ZONE_TYPE_CONVENTIONAL) {
-               btrfs_err_in_rcu(fs_info,
+               btrfs_err(fs_info,
                "zoned: unexpected conventional zone %llu on device %s (devid %llu)",
                        zone.start << SECTOR_SHIFT, rcu_str_deref(device->name),
                        device->devid);
@@ -1359,7 +1359,7 @@ static int btrfs_load_zone_info(struct btrfs_fs_info *fs_info, int zone_idx,
        switch (zone.cond) {
        case BLK_ZONE_COND_OFFLINE:
        case BLK_ZONE_COND_READONLY:
-               btrfs_err_in_rcu(fs_info,
+               btrfs_err(fs_info,
                "zoned: offline/readonly zone %llu on device %s (devid %llu)",
                          (info->physical >> device->zone_info->zone_size_shift),
                          rcu_str_deref(device->name), device->devid);