mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	btrfs: cleanup device states define BTRFS_DEV_STATE_FLUSH_SENT
Currently device state is being managed by each individual int variable such as struct btrfs_device::is_tgtdev_for_dev_replace. Instead of that declare btrfs_device::dev_state BTRFS_DEV_STATE_FLUSH_SENT and use the bit operations. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
		
							parent
							
								
									401e29c124
								
							
						
					
					
						commit
						1c3063b6db
					
				
					 2 changed files with 4 additions and 3 deletions
				
			
		| 
						 | 
					@ -3348,7 +3348,7 @@ static void write_dev_flush(struct btrfs_device *device)
 | 
				
			||||||
	bio->bi_private = &device->flush_wait;
 | 
						bio->bi_private = &device->flush_wait;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	btrfsic_submit_bio(bio);
 | 
						btrfsic_submit_bio(bio);
 | 
				
			||||||
	device->flush_bio_sent = 1;
 | 
						set_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -3358,10 +3358,10 @@ static blk_status_t wait_dev_flush(struct btrfs_device *device)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct bio *bio = device->flush_bio;
 | 
						struct bio *bio = device->flush_bio;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!device->flush_bio_sent)
 | 
						if (!test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state))
 | 
				
			||||||
		return BLK_STS_OK;
 | 
							return BLK_STS_OK;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	device->flush_bio_sent = 0;
 | 
						clear_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state);
 | 
				
			||||||
	wait_for_completion_io(&device->flush_wait);
 | 
						wait_for_completion_io(&device->flush_wait);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return bio->bi_status;
 | 
						return bio->bi_status;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -51,6 +51,7 @@ struct btrfs_pending_bios {
 | 
				
			||||||
#define BTRFS_DEV_STATE_IN_FS_METADATA	(1)
 | 
					#define BTRFS_DEV_STATE_IN_FS_METADATA	(1)
 | 
				
			||||||
#define BTRFS_DEV_STATE_MISSING		(2)
 | 
					#define BTRFS_DEV_STATE_MISSING		(2)
 | 
				
			||||||
#define BTRFS_DEV_STATE_REPLACE_TGT	(3)
 | 
					#define BTRFS_DEV_STATE_REPLACE_TGT	(3)
 | 
				
			||||||
 | 
					#define BTRFS_DEV_STATE_FLUSH_SENT	(4)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct btrfs_device {
 | 
					struct btrfs_device {
 | 
				
			||||||
	struct list_head dev_list;
 | 
						struct list_head dev_list;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue