mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	ext4: don't call update_backups() multiple times for the same bg
When performing an online resize, we add a bunch of groups at one time in ext4_flex_group_add, so in most cases a lot of group descriptors will be in the same group block. But in the end of this function, update_backups will be called for every group descriptor and the same block will be copied and journalled again and again. It is really a waste. Fix things so we only update a particular bg descriptor block once and skip subsequent updates of the same block. Signed-off-by: Tao Ma <boyu.mt@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
		
							parent
							
								
									7f1468d1d5
								
							
						
					
					
						commit
						0acdb8876f
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -1460,6 +1460,7 @@ static int ext4_flex_group_add(struct super_block *sb,
 | 
			
		|||
				   EXT4_DESC_PER_BLOCK(sb));
 | 
			
		||||
		int meta_bg = EXT4_HAS_INCOMPAT_FEATURE(sb,
 | 
			
		||||
				EXT4_FEATURE_INCOMPAT_META_BG);
 | 
			
		||||
		sector_t old_gdb = 0;
 | 
			
		||||
 | 
			
		||||
		update_backups(sb, sbi->s_sbh->b_blocknr, (char *)es,
 | 
			
		||||
			       sizeof(struct ext4_super_block), 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -1467,8 +1468,11 @@ static int ext4_flex_group_add(struct super_block *sb,
 | 
			
		|||
			struct buffer_head *gdb_bh;
 | 
			
		||||
 | 
			
		||||
			gdb_bh = sbi->s_group_desc[gdb_num];
 | 
			
		||||
			if (old_gdb == gdb_bh->b_blocknr)
 | 
			
		||||
				continue;
 | 
			
		||||
			update_backups(sb, gdb_bh->b_blocknr, gdb_bh->b_data,
 | 
			
		||||
				       gdb_bh->b_size, meta_bg);
 | 
			
		||||
			old_gdb = gdb_bh->b_blocknr;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
exit:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue