mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	btrfs: remove unused argument seed from btrfs_find_device
Commit 343694eee8d8 ("btrfs: switch seed device to list api"), missed to
check if the parameter seed is true in the function btrfs_find_device().
This tells it whether to traverse the seed device list or not.
After this commit, the argument is unused and can be removed.
In device_list_add() it's not necessary because fs_devices always points
to the device's fs_devices. So with the devid+uuid matching, it will
find the right device and return, thus not needing to traverse seed
devices.
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
			
			
This commit is contained in:
		
							parent
							
								
									3a160a9331
								
							
						
					
					
						commit
						b2598edf8b
					
				
					 5 changed files with 19 additions and 21 deletions
				
			
		| 
						 | 
					@ -96,7 +96,7 @@ int btrfs_init_dev_replace(struct btrfs_fs_info *fs_info)
 | 
				
			||||||
		 * a replace target, fail the mount.
 | 
							 * a replace target, fail the mount.
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		if (btrfs_find_device(fs_info->fs_devices,
 | 
							if (btrfs_find_device(fs_info->fs_devices,
 | 
				
			||||||
				      BTRFS_DEV_REPLACE_DEVID, NULL, NULL, false)) {
 | 
									      BTRFS_DEV_REPLACE_DEVID, NULL, NULL)) {
 | 
				
			||||||
			btrfs_err(fs_info,
 | 
								btrfs_err(fs_info,
 | 
				
			||||||
			"found replace target device without a valid replace item");
 | 
								"found replace target device without a valid replace item");
 | 
				
			||||||
			ret = -EUCLEAN;
 | 
								ret = -EUCLEAN;
 | 
				
			||||||
| 
						 | 
					@ -159,7 +159,7 @@ int btrfs_init_dev_replace(struct btrfs_fs_info *fs_info)
 | 
				
			||||||
		 * replace target, fail the mount.
 | 
							 * replace target, fail the mount.
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		if (btrfs_find_device(fs_info->fs_devices,
 | 
							if (btrfs_find_device(fs_info->fs_devices,
 | 
				
			||||||
				      BTRFS_DEV_REPLACE_DEVID, NULL, NULL, false)) {
 | 
									      BTRFS_DEV_REPLACE_DEVID, NULL, NULL)) {
 | 
				
			||||||
			btrfs_err(fs_info,
 | 
								btrfs_err(fs_info,
 | 
				
			||||||
			"replace devid present without an active replace item");
 | 
								"replace devid present without an active replace item");
 | 
				
			||||||
			ret = -EUCLEAN;
 | 
								ret = -EUCLEAN;
 | 
				
			||||||
| 
						 | 
					@ -171,10 +171,10 @@ int btrfs_init_dev_replace(struct btrfs_fs_info *fs_info)
 | 
				
			||||||
	case BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED:
 | 
						case BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED:
 | 
				
			||||||
	case BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED:
 | 
						case BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED:
 | 
				
			||||||
		dev_replace->srcdev = btrfs_find_device(fs_info->fs_devices,
 | 
							dev_replace->srcdev = btrfs_find_device(fs_info->fs_devices,
 | 
				
			||||||
						src_devid, NULL, NULL, true);
 | 
											src_devid, NULL, NULL);
 | 
				
			||||||
		dev_replace->tgtdev = btrfs_find_device(fs_info->fs_devices,
 | 
							dev_replace->tgtdev = btrfs_find_device(fs_info->fs_devices,
 | 
				
			||||||
							BTRFS_DEV_REPLACE_DEVID,
 | 
												BTRFS_DEV_REPLACE_DEVID,
 | 
				
			||||||
							NULL, NULL, true);
 | 
												NULL, NULL);
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * allow 'btrfs dev replace_cancel' if src/tgt device is
 | 
							 * allow 'btrfs dev replace_cancel' if src/tgt device is
 | 
				
			||||||
		 * missing
 | 
							 * missing
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1717,7 +1717,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
 | 
				
			||||||
		btrfs_info(fs_info, "resizing devid %llu", devid);
 | 
							btrfs_info(fs_info, "resizing devid %llu", devid);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	device = btrfs_find_device(fs_info->fs_devices, devid, NULL, NULL, true);
 | 
						device = btrfs_find_device(fs_info->fs_devices, devid, NULL, NULL);
 | 
				
			||||||
	if (!device) {
 | 
						if (!device) {
 | 
				
			||||||
		btrfs_info(fs_info, "resizer unable to find device %llu",
 | 
							btrfs_info(fs_info, "resizer unable to find device %llu",
 | 
				
			||||||
			   devid);
 | 
								   devid);
 | 
				
			||||||
| 
						 | 
					@ -3360,7 +3360,7 @@ static long btrfs_ioctl_dev_info(struct btrfs_fs_info *fs_info,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rcu_read_lock();
 | 
						rcu_read_lock();
 | 
				
			||||||
	dev = btrfs_find_device(fs_info->fs_devices, di_args->devid, s_uuid,
 | 
						dev = btrfs_find_device(fs_info->fs_devices, di_args->devid, s_uuid,
 | 
				
			||||||
				NULL, true);
 | 
									NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!dev) {
 | 
						if (!dev) {
 | 
				
			||||||
		ret = -ENODEV;
 | 
							ret = -ENODEV;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3885,7 +3885,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
 | 
				
			||||||
		goto out_free_ctx;
 | 
							goto out_free_ctx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mutex_lock(&fs_info->fs_devices->device_list_mutex);
 | 
						mutex_lock(&fs_info->fs_devices->device_list_mutex);
 | 
				
			||||||
	dev = btrfs_find_device(fs_info->fs_devices, devid, NULL, NULL, true);
 | 
						dev = btrfs_find_device(fs_info->fs_devices, devid, NULL, NULL);
 | 
				
			||||||
	if (!dev || (test_bit(BTRFS_DEV_STATE_MISSING, &dev->dev_state) &&
 | 
						if (!dev || (test_bit(BTRFS_DEV_STATE_MISSING, &dev->dev_state) &&
 | 
				
			||||||
		     !is_dev_replace)) {
 | 
							     !is_dev_replace)) {
 | 
				
			||||||
		mutex_unlock(&fs_info->fs_devices->device_list_mutex);
 | 
							mutex_unlock(&fs_info->fs_devices->device_list_mutex);
 | 
				
			||||||
| 
						 | 
					@ -4062,7 +4062,7 @@ int btrfs_scrub_progress(struct btrfs_fs_info *fs_info, u64 devid,
 | 
				
			||||||
	struct scrub_ctx *sctx = NULL;
 | 
						struct scrub_ctx *sctx = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mutex_lock(&fs_info->fs_devices->device_list_mutex);
 | 
						mutex_lock(&fs_info->fs_devices->device_list_mutex);
 | 
				
			||||||
	dev = btrfs_find_device(fs_info->fs_devices, devid, NULL, NULL, true);
 | 
						dev = btrfs_find_device(fs_info->fs_devices, devid, NULL, NULL);
 | 
				
			||||||
	if (dev)
 | 
						if (dev)
 | 
				
			||||||
		sctx = dev->scrub_ctx;
 | 
							sctx = dev->scrub_ctx;
 | 
				
			||||||
	if (sctx)
 | 
						if (sctx)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -822,7 +822,7 @@ static noinline struct btrfs_device *device_list_add(const char *path,
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		mutex_lock(&fs_devices->device_list_mutex);
 | 
							mutex_lock(&fs_devices->device_list_mutex);
 | 
				
			||||||
		device = btrfs_find_device(fs_devices, devid,
 | 
							device = btrfs_find_device(fs_devices, devid,
 | 
				
			||||||
				disk_super->dev_item.uuid, NULL, false);
 | 
									disk_super->dev_item.uuid, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * If this disk has been pulled into an fs devices created by
 | 
							 * If this disk has been pulled into an fs devices created by
 | 
				
			||||||
| 
						 | 
					@ -2294,10 +2294,10 @@ static struct btrfs_device *btrfs_find_device_by_path(
 | 
				
			||||||
	dev_uuid = disk_super->dev_item.uuid;
 | 
						dev_uuid = disk_super->dev_item.uuid;
 | 
				
			||||||
	if (btrfs_fs_incompat(fs_info, METADATA_UUID))
 | 
						if (btrfs_fs_incompat(fs_info, METADATA_UUID))
 | 
				
			||||||
		device = btrfs_find_device(fs_info->fs_devices, devid, dev_uuid,
 | 
							device = btrfs_find_device(fs_info->fs_devices, devid, dev_uuid,
 | 
				
			||||||
					   disk_super->metadata_uuid, true);
 | 
										   disk_super->metadata_uuid);
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		device = btrfs_find_device(fs_info->fs_devices, devid, dev_uuid,
 | 
							device = btrfs_find_device(fs_info->fs_devices, devid, dev_uuid,
 | 
				
			||||||
					   disk_super->fsid, true);
 | 
										   disk_super->fsid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	btrfs_release_disk_super(disk_super);
 | 
						btrfs_release_disk_super(disk_super);
 | 
				
			||||||
	if (!device)
 | 
						if (!device)
 | 
				
			||||||
| 
						 | 
					@ -2317,7 +2317,7 @@ struct btrfs_device *btrfs_find_device_by_devspec(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (devid) {
 | 
						if (devid) {
 | 
				
			||||||
		device = btrfs_find_device(fs_info->fs_devices, devid, NULL,
 | 
							device = btrfs_find_device(fs_info->fs_devices, devid, NULL,
 | 
				
			||||||
					   NULL, true);
 | 
										   NULL);
 | 
				
			||||||
		if (!device)
 | 
							if (!device)
 | 
				
			||||||
			return ERR_PTR(-ENOENT);
 | 
								return ERR_PTR(-ENOENT);
 | 
				
			||||||
		return device;
 | 
							return device;
 | 
				
			||||||
| 
						 | 
					@ -2466,7 +2466,7 @@ static int btrfs_finish_sprout(struct btrfs_trans_handle *trans)
 | 
				
			||||||
		read_extent_buffer(leaf, fs_uuid, btrfs_device_fsid(dev_item),
 | 
							read_extent_buffer(leaf, fs_uuid, btrfs_device_fsid(dev_item),
 | 
				
			||||||
				   BTRFS_FSID_SIZE);
 | 
									   BTRFS_FSID_SIZE);
 | 
				
			||||||
		device = btrfs_find_device(fs_info->fs_devices, devid, dev_uuid,
 | 
							device = btrfs_find_device(fs_info->fs_devices, devid, dev_uuid,
 | 
				
			||||||
					   fs_uuid, true);
 | 
										   fs_uuid);
 | 
				
			||||||
		BUG_ON(!device); /* Logic error */
 | 
							BUG_ON(!device); /* Logic error */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (device->fs_devices->seeding) {
 | 
							if (device->fs_devices->seeding) {
 | 
				
			||||||
| 
						 | 
					@ -6459,8 +6459,7 @@ blk_status_t btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
 | 
				
			||||||
 * If @seed is true, traverse through the seed devices.
 | 
					 * If @seed is true, traverse through the seed devices.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct btrfs_device *btrfs_find_device(struct btrfs_fs_devices *fs_devices,
 | 
					struct btrfs_device *btrfs_find_device(struct btrfs_fs_devices *fs_devices,
 | 
				
			||||||
				       u64 devid, u8 *uuid, u8 *fsid,
 | 
									       u64 devid, u8 *uuid, u8 *fsid)
 | 
				
			||||||
				       bool seed)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct btrfs_device *device;
 | 
						struct btrfs_device *device;
 | 
				
			||||||
	struct btrfs_fs_devices *seed_devs;
 | 
						struct btrfs_fs_devices *seed_devs;
 | 
				
			||||||
| 
						 | 
					@ -6667,7 +6666,7 @@ static int read_one_chunk(struct btrfs_key *key, struct extent_buffer *leaf,
 | 
				
			||||||
				   btrfs_stripe_dev_uuid_nr(chunk, i),
 | 
									   btrfs_stripe_dev_uuid_nr(chunk, i),
 | 
				
			||||||
				   BTRFS_UUID_SIZE);
 | 
									   BTRFS_UUID_SIZE);
 | 
				
			||||||
		map->stripes[i].dev = btrfs_find_device(fs_info->fs_devices,
 | 
							map->stripes[i].dev = btrfs_find_device(fs_info->fs_devices,
 | 
				
			||||||
							devid, uuid, NULL, true);
 | 
												devid, uuid, NULL);
 | 
				
			||||||
		if (!map->stripes[i].dev &&
 | 
							if (!map->stripes[i].dev &&
 | 
				
			||||||
		    !btrfs_test_opt(fs_info, DEGRADED)) {
 | 
							    !btrfs_test_opt(fs_info, DEGRADED)) {
 | 
				
			||||||
			free_extent_map(em);
 | 
								free_extent_map(em);
 | 
				
			||||||
| 
						 | 
					@ -6806,7 +6805,7 @@ static int read_one_dev(struct extent_buffer *leaf,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	device = btrfs_find_device(fs_info->fs_devices, devid, dev_uuid,
 | 
						device = btrfs_find_device(fs_info->fs_devices, devid, dev_uuid,
 | 
				
			||||||
				   fs_uuid, true);
 | 
									   fs_uuid);
 | 
				
			||||||
	if (!device) {
 | 
						if (!device) {
 | 
				
			||||||
		if (!btrfs_test_opt(fs_info, DEGRADED)) {
 | 
							if (!btrfs_test_opt(fs_info, DEGRADED)) {
 | 
				
			||||||
			btrfs_report_missing_device(fs_info, devid,
 | 
								btrfs_report_missing_device(fs_info, devid,
 | 
				
			||||||
| 
						 | 
					@ -7469,8 +7468,7 @@ int btrfs_get_dev_stats(struct btrfs_fs_info *fs_info,
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mutex_lock(&fs_devices->device_list_mutex);
 | 
						mutex_lock(&fs_devices->device_list_mutex);
 | 
				
			||||||
	dev = btrfs_find_device(fs_info->fs_devices, stats->devid, NULL, NULL,
 | 
						dev = btrfs_find_device(fs_info->fs_devices, stats->devid, NULL, NULL);
 | 
				
			||||||
				true);
 | 
					 | 
				
			||||||
	mutex_unlock(&fs_devices->device_list_mutex);
 | 
						mutex_unlock(&fs_devices->device_list_mutex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!dev) {
 | 
						if (!dev) {
 | 
				
			||||||
| 
						 | 
					@ -7601,7 +7599,7 @@ static int verify_one_dev_extent(struct btrfs_fs_info *fs_info,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Make sure no dev extent is beyond device bondary */
 | 
						/* Make sure no dev extent is beyond device bondary */
 | 
				
			||||||
	dev = btrfs_find_device(fs_info->fs_devices, devid, NULL, NULL, true);
 | 
						dev = btrfs_find_device(fs_info->fs_devices, devid, NULL, NULL);
 | 
				
			||||||
	if (!dev) {
 | 
						if (!dev) {
 | 
				
			||||||
		btrfs_err(fs_info, "failed to find devid %llu", devid);
 | 
							btrfs_err(fs_info, "failed to find devid %llu", devid);
 | 
				
			||||||
		ret = -EUCLEAN;
 | 
							ret = -EUCLEAN;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -466,7 +466,7 @@ int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len);
 | 
				
			||||||
int btrfs_grow_device(struct btrfs_trans_handle *trans,
 | 
					int btrfs_grow_device(struct btrfs_trans_handle *trans,
 | 
				
			||||||
		      struct btrfs_device *device, u64 new_size);
 | 
							      struct btrfs_device *device, u64 new_size);
 | 
				
			||||||
struct btrfs_device *btrfs_find_device(struct btrfs_fs_devices *fs_devices,
 | 
					struct btrfs_device *btrfs_find_device(struct btrfs_fs_devices *fs_devices,
 | 
				
			||||||
				       u64 devid, u8 *uuid, u8 *fsid, bool seed);
 | 
									       u64 devid, u8 *uuid, u8 *fsid);
 | 
				
			||||||
int btrfs_shrink_device(struct btrfs_device *device, u64 new_size);
 | 
					int btrfs_shrink_device(struct btrfs_device *device, u64 new_size);
 | 
				
			||||||
int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *path);
 | 
					int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *path);
 | 
				
			||||||
int btrfs_balance(struct btrfs_fs_info *fs_info,
 | 
					int btrfs_balance(struct btrfs_fs_info *fs_info,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue