aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2014-03-26 13:26:36 -0400
committerChris Mason <clm@fb.com>2014-04-07 12:08:41 -0400
commit60999ca4b4033ee199702a4ceb9f5b801f7962b9 (patch)
tree5004bfff4cb8a08456e081688c4426c8844b2446 /fs/btrfs/volumes.c
parented55b6ac077fe7f9c6490ff55172c4b563562d7c (diff)
btrfs: make device scan less noisy
Print the message only when the device is seen for the first time. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index b4660c413c73..558f46c6bd6f 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -448,6 +448,14 @@ static void pending_bios_fn(struct btrfs_work *work)
448 run_scheduled_bios(device); 448 run_scheduled_bios(device);
449} 449}
450 450
451/*
452 * Add new device to list of registered devices
453 *
454 * Returns:
455 * 1 - first time device is seen
456 * 0 - device already known
457 * < 0 - error
458 */
451static noinline int device_list_add(const char *path, 459static noinline int device_list_add(const char *path,
452 struct btrfs_super_block *disk_super, 460 struct btrfs_super_block *disk_super,
453 u64 devid, struct btrfs_fs_devices **fs_devices_ret) 461 u64 devid, struct btrfs_fs_devices **fs_devices_ret)
@@ -455,6 +463,7 @@ static noinline int device_list_add(const char *path,
455 struct btrfs_device *device; 463 struct btrfs_device *device;
456 struct btrfs_fs_devices *fs_devices; 464 struct btrfs_fs_devices *fs_devices;
457 struct rcu_string *name; 465 struct rcu_string *name;
466 int ret = 0;
458 u64 found_transid = btrfs_super_generation(disk_super); 467 u64 found_transid = btrfs_super_generation(disk_super);
459 468
460 fs_devices = find_fsid(disk_super->fsid); 469 fs_devices = find_fsid(disk_super->fsid);
@@ -495,6 +504,7 @@ static noinline int device_list_add(const char *path,
495 fs_devices->num_devices++; 504 fs_devices->num_devices++;
496 mutex_unlock(&fs_devices->device_list_mutex); 505 mutex_unlock(&fs_devices->device_list_mutex);
497 506
507 ret = 1;
498 device->fs_devices = fs_devices; 508 device->fs_devices = fs_devices;
499 } else if (!device->name || strcmp(device->name->str, path)) { 509 } else if (!device->name || strcmp(device->name->str, path)) {
500 name = rcu_string_strdup(path, GFP_NOFS); 510 name = rcu_string_strdup(path, GFP_NOFS);
@@ -513,7 +523,8 @@ static noinline int device_list_add(const char *path,
513 fs_devices->latest_trans = found_transid; 523 fs_devices->latest_trans = found_transid;
514 } 524 }
515 *fs_devices_ret = fs_devices; 525 *fs_devices_ret = fs_devices;
516 return 0; 526
527 return ret;
517} 528}
518 529
519static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig) 530static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig)
@@ -910,17 +921,19 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
910 transid = btrfs_super_generation(disk_super); 921 transid = btrfs_super_generation(disk_super);
911 total_devices = btrfs_super_num_devices(disk_super); 922 total_devices = btrfs_super_num_devices(disk_super);
912 923
913 if (disk_super->label[0]) {
914 if (disk_super->label[BTRFS_LABEL_SIZE - 1])
915 disk_super->label[BTRFS_LABEL_SIZE - 1] = '\0';
916 printk(KERN_INFO "BTRFS: device label %s ", disk_super->label);
917 } else {
918 printk(KERN_INFO "BTRFS: device fsid %pU ", disk_super->fsid);
919 }
920
921 printk(KERN_CONT "devid %llu transid %llu %s\n", devid, transid, path);
922
923 ret = device_list_add(path, disk_super, devid, fs_devices_ret); 924 ret = device_list_add(path, disk_super, devid, fs_devices_ret);
925 if (ret > 0) {
926 if (disk_super->label[0]) {
927 if (disk_super->label[BTRFS_LABEL_SIZE - 1])
928 disk_super->label[BTRFS_LABEL_SIZE - 1] = '\0';
929 printk(KERN_INFO "BTRFS: device label %s ", disk_super->label);
930 } else {
931 printk(KERN_INFO "BTRFS: device fsid %pU ", disk_super->fsid);
932 }
933
934 printk(KERN_CONT "devid %llu transid %llu %s\n", devid, transid, path);
935 ret = 0;
936 }
924 if (!ret && fs_devices_ret) 937 if (!ret && fs_devices_ret)
925 (*fs_devices_ret)->total_devices = total_devices; 938 (*fs_devices_ret)->total_devices = total_devices;
926 939