mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	btrfs: raid56: handle endio in rmw_rbio
Both callers of rmv_rbio call rbio_orig_end_io right after it, so move the call into the shared function. Reviewed-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
		
							parent
							
								
									52f0c19864
								
							
						
					
					
						commit
						1d0ef1ca11
					
				
					 1 changed files with 10 additions and 20 deletions
				
			
		|  | @ -2235,7 +2235,7 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio) | ||||||
| 	return false; | 	return false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int rmw_rbio(struct btrfs_raid_bio *rbio) | static void rmw_rbio(struct btrfs_raid_bio *rbio) | ||||||
| { | { | ||||||
| 	struct bio_list bio_list; | 	struct bio_list bio_list; | ||||||
| 	int sectornr; | 	int sectornr; | ||||||
|  | @ -2247,7 +2247,7 @@ static int rmw_rbio(struct btrfs_raid_bio *rbio) | ||||||
| 	 */ | 	 */ | ||||||
| 	ret = alloc_rbio_parity_pages(rbio); | 	ret = alloc_rbio_parity_pages(rbio); | ||||||
| 	if (ret < 0) | 	if (ret < 0) | ||||||
| 		return ret; | 		goto out; | ||||||
| 
 | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
| 	 * Either full stripe write, or we have every data sector already | 	 * Either full stripe write, or we have every data sector already | ||||||
|  | @ -2260,13 +2260,13 @@ static int rmw_rbio(struct btrfs_raid_bio *rbio) | ||||||
| 		 */ | 		 */ | ||||||
| 		ret = alloc_rbio_data_pages(rbio); | 		ret = alloc_rbio_data_pages(rbio); | ||||||
| 		if (ret < 0) | 		if (ret < 0) | ||||||
| 			return ret; | 			goto out; | ||||||
| 
 | 
 | ||||||
| 		index_rbio_pages(rbio); | 		index_rbio_pages(rbio); | ||||||
| 
 | 
 | ||||||
| 		ret = rmw_read_wait_recover(rbio); | 		ret = rmw_read_wait_recover(rbio); | ||||||
| 		if (ret < 0) | 		if (ret < 0) | ||||||
| 			return ret; | 			goto out; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
|  | @ -2299,7 +2299,7 @@ static int rmw_rbio(struct btrfs_raid_bio *rbio) | ||||||
| 	bio_list_init(&bio_list); | 	bio_list_init(&bio_list); | ||||||
| 	ret = rmw_assemble_write_bios(rbio, &bio_list); | 	ret = rmw_assemble_write_bios(rbio, &bio_list); | ||||||
| 	if (ret < 0) | 	if (ret < 0) | ||||||
| 		return ret; | 		goto out; | ||||||
| 
 | 
 | ||||||
| 	/* We should have at least one bio assembled. */ | 	/* We should have at least one bio assembled. */ | ||||||
| 	ASSERT(bio_list_size(&bio_list)); | 	ASSERT(bio_list_size(&bio_list)); | ||||||
|  | @ -2316,32 +2316,22 @@ static int rmw_rbio(struct btrfs_raid_bio *rbio) | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	return ret; | out: | ||||||
|  | 	rbio_orig_end_io(rbio, errno_to_blk_status(ret)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void rmw_rbio_work(struct work_struct *work) | static void rmw_rbio_work(struct work_struct *work) | ||||||
| { | { | ||||||
| 	struct btrfs_raid_bio *rbio; | 	struct btrfs_raid_bio *rbio; | ||||||
| 	int ret; |  | ||||||
| 
 | 
 | ||||||
| 	rbio = container_of(work, struct btrfs_raid_bio, work); | 	rbio = container_of(work, struct btrfs_raid_bio, work); | ||||||
| 
 | 	if (lock_stripe_add(rbio) == 0) | ||||||
| 	ret = lock_stripe_add(rbio); | 		rmw_rbio(rbio); | ||||||
| 	if (ret == 0) { |  | ||||||
| 		ret = rmw_rbio(rbio); |  | ||||||
| 		rbio_orig_end_io(rbio, errno_to_blk_status(ret)); |  | ||||||
| 	} |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void rmw_rbio_work_locked(struct work_struct *work) | static void rmw_rbio_work_locked(struct work_struct *work) | ||||||
| { | { | ||||||
| 	struct btrfs_raid_bio *rbio; | 	rmw_rbio(container_of(work, struct btrfs_raid_bio, work)); | ||||||
| 	int ret; |  | ||||||
| 
 |  | ||||||
| 	rbio = container_of(work, struct btrfs_raid_bio, work); |  | ||||||
| 
 |  | ||||||
| 	ret = rmw_rbio(rbio); |  | ||||||
| 	rbio_orig_end_io(rbio, errno_to_blk_status(ret)); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Christoph Hellwig
						Christoph Hellwig