Commit 60999ca4 authored by David Sterba's avatar David Sterba Committed by Chris Mason

btrfs: make device scan less noisy

Print the message only when the device is seen for the first time.
Signed-off-by: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent ed55b6ac
...@@ -448,6 +448,14 @@ static void pending_bios_fn(struct btrfs_work *work) ...@@ -448,6 +448,14 @@ static void pending_bios_fn(struct btrfs_work *work)
run_scheduled_bios(device); run_scheduled_bios(device);
} }
/*
* Add new device to list of registered devices
*
* Returns:
* 1 - first time device is seen
* 0 - device already known
* < 0 - error
*/
static noinline int device_list_add(const char *path, static noinline int device_list_add(const char *path,
struct btrfs_super_block *disk_super, struct btrfs_super_block *disk_super,
u64 devid, struct btrfs_fs_devices **fs_devices_ret) u64 devid, struct btrfs_fs_devices **fs_devices_ret)
...@@ -455,6 +463,7 @@ static noinline int device_list_add(const char *path, ...@@ -455,6 +463,7 @@ static noinline int device_list_add(const char *path,
struct btrfs_device *device; struct btrfs_device *device;
struct btrfs_fs_devices *fs_devices; struct btrfs_fs_devices *fs_devices;
struct rcu_string *name; struct rcu_string *name;
int ret = 0;
u64 found_transid = btrfs_super_generation(disk_super); u64 found_transid = btrfs_super_generation(disk_super);
fs_devices = find_fsid(disk_super->fsid); fs_devices = find_fsid(disk_super->fsid);
...@@ -495,6 +504,7 @@ static noinline int device_list_add(const char *path, ...@@ -495,6 +504,7 @@ static noinline int device_list_add(const char *path,
fs_devices->num_devices++; fs_devices->num_devices++;
mutex_unlock(&fs_devices->device_list_mutex); mutex_unlock(&fs_devices->device_list_mutex);
ret = 1;
device->fs_devices = fs_devices; device->fs_devices = fs_devices;
} else if (!device->name || strcmp(device->name->str, path)) { } else if (!device->name || strcmp(device->name->str, path)) {
name = rcu_string_strdup(path, GFP_NOFS); name = rcu_string_strdup(path, GFP_NOFS);
...@@ -513,7 +523,8 @@ static noinline int device_list_add(const char *path, ...@@ -513,7 +523,8 @@ static noinline int device_list_add(const char *path,
fs_devices->latest_trans = found_transid; fs_devices->latest_trans = found_transid;
} }
*fs_devices_ret = fs_devices; *fs_devices_ret = fs_devices;
return 0;
return ret;
} }
static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig) static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig)
...@@ -910,6 +921,8 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder, ...@@ -910,6 +921,8 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
transid = btrfs_super_generation(disk_super); transid = btrfs_super_generation(disk_super);
total_devices = btrfs_super_num_devices(disk_super); total_devices = btrfs_super_num_devices(disk_super);
ret = device_list_add(path, disk_super, devid, fs_devices_ret);
if (ret > 0) {
if (disk_super->label[0]) { if (disk_super->label[0]) {
if (disk_super->label[BTRFS_LABEL_SIZE - 1]) if (disk_super->label[BTRFS_LABEL_SIZE - 1])
disk_super->label[BTRFS_LABEL_SIZE - 1] = '\0'; disk_super->label[BTRFS_LABEL_SIZE - 1] = '\0';
...@@ -919,8 +932,8 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder, ...@@ -919,8 +932,8 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
} }
printk(KERN_CONT "devid %llu transid %llu %s\n", devid, transid, path); printk(KERN_CONT "devid %llu transid %llu %s\n", devid, transid, path);
ret = 0;
ret = device_list_add(path, disk_super, devid, fs_devices_ret); }
if (!ret && fs_devices_ret) if (!ret && fs_devices_ret)
(*fs_devices_ret)->total_devices = total_devices; (*fs_devices_ret)->total_devices = total_devices;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment