Skip to content

Commit 0782303

Browse files
asjkdave
authored andcommitted
btrfs: include device major and minor numbers in the device scan notice
To better debug issues surrounding device scans, include the device's major and minor numbers in the device scan notice for btrfs. Reviewed-by: Filipe Manana <[email protected]> Reviewed-by: Sweet Tea Dorminy <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Anand Jain <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 7ec28f8 commit 0782303

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

fs/btrfs/volumes.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,9 @@ static noinline struct btrfs_device *device_list_add(const char *path,
767767
if (same_fsid_diff_dev) {
768768
generate_random_uuid(fs_devices->fsid);
769769
fs_devices->temp_fsid = true;
770-
pr_info("BTRFS: device %s using temp-fsid %pU\n",
771-
path, fs_devices->fsid);
770+
pr_info("BTRFS: device %s (%d:%d) using temp-fsid %pU\n",
771+
path, MAJOR(path_devt), MINOR(path_devt),
772+
fs_devices->fsid);
772773
}
773774

774775
mutex_lock(&fs_devices->device_list_mutex);
@@ -797,8 +798,9 @@ static noinline struct btrfs_device *device_list_add(const char *path,
797798

798799
if (fs_devices->opened) {
799800
btrfs_err(NULL,
800-
"device %s belongs to fsid %pU, and the fs is already mounted, scanned by %s (%d)",
801-
path, fs_devices->fsid, current->comm,
801+
"device %s (%d:%d) belongs to fsid %pU, and the fs is already mounted, scanned by %s (%d)",
802+
path, MAJOR(path_devt), MINOR(path_devt),
803+
fs_devices->fsid, current->comm,
802804
task_pid_nr(current));
803805
mutex_unlock(&fs_devices->device_list_mutex);
804806
return ERR_PTR(-EBUSY);
@@ -824,13 +826,15 @@ static noinline struct btrfs_device *device_list_add(const char *path,
824826

825827
if (disk_super->label[0])
826828
pr_info(
827-
"BTRFS: device label %s devid %llu transid %llu %s scanned by %s (%d)\n",
829+
"BTRFS: device label %s devid %llu transid %llu %s (%d:%d) scanned by %s (%d)\n",
828830
disk_super->label, devid, found_transid, path,
831+
MAJOR(path_devt), MINOR(path_devt),
829832
current->comm, task_pid_nr(current));
830833
else
831834
pr_info(
832-
"BTRFS: device fsid %pU devid %llu transid %llu %s scanned by %s (%d)\n",
835+
"BTRFS: device fsid %pU devid %llu transid %llu %s (%d:%d) scanned by %s (%d)\n",
833836
disk_super->fsid, devid, found_transid, path,
837+
MAJOR(path_devt), MINOR(path_devt),
834838
current->comm, task_pid_nr(current));
835839

836840
} else if (!device->name || strcmp(device->name->str, path)) {
@@ -1366,7 +1370,8 @@ struct btrfs_device *btrfs_scan_one_device(const char *path, blk_mode_t flags,
13661370
else
13671371
btrfs_free_stale_devices(devt, NULL);
13681372

1369-
pr_debug("BTRFS: skip registering single non-seed device %s\n", path);
1373+
pr_debug("BTRFS: skip registering single non-seed device %s (%d:%d)\n",
1374+
path, MAJOR(devt), MINOR(devt));
13701375
device = NULL;
13711376
goto free_disk_super;
13721377
}

0 commit comments

Comments
 (0)