btrfs: log error codes during failures when writing super blocks
authorFilipe Manana <fdmanana@suse.com>
Sun, 11 May 2025 13:50:08 +0000 (14:50 +0100)
committerDavid Sterba <dsterba@suse.com>
Thu, 15 May 2025 12:30:57 +0000 (14:30 +0200)
When writing super blocks, at write_dev_supers(), we log an error message
when we get some error but we don't show which error we got and we have
that information. So enhance the error messages with the error codes.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c

index 5bcf112..1beb945 100644 (file)
@@ -3752,8 +3752,8 @@ static int write_dev_supers(struct btrfs_device *device,
                        continue;
                } else if (ret < 0) {
                        btrfs_err(device->fs_info,
-                               "couldn't get super block location for mirror %d",
-                               i);
+                         "couldn't get super block location for mirror %d error %d",
+                         i, ret);
                        atomic_inc(&device->sb_write_errors);
                        continue;
                }
@@ -3772,8 +3772,8 @@ static int write_dev_supers(struct btrfs_device *device,
                                            GFP_NOFS);
                if (IS_ERR(folio)) {
                        btrfs_err(device->fs_info,
-                           "couldn't get super block page for bytenr %llu",
-                           bytenr);
+                         "couldn't get super block page for bytenr %llu error %ld",
+                         bytenr, PTR_ERR(folio));
                        atomic_inc(&device->sb_write_errors);
                        continue;
                }