mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	bcachefs: bs > ps support
bcachefs removed most PAGE_SIZE references long ago, so this is easy; only readpage_bio_extend() has to be tweaked to respect the minimum order. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
		
							parent
							
								
									1a2b74d0a2
								
							
						
					
					
						commit
						be212d86b1
					
				
					 3 changed files with 13 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -110,11 +110,21 @@ static int readpage_bio_extend(struct btree_trans *trans,
 | 
			
		|||
			if (!get_more)
 | 
			
		||||
				break;
 | 
			
		||||
 | 
			
		||||
			unsigned sectors_remaining = sectors_this_extent - bio_sectors(bio);
 | 
			
		||||
 | 
			
		||||
			if (sectors_remaining < PAGE_SECTORS << mapping_min_folio_order(iter->mapping))
 | 
			
		||||
				break;
 | 
			
		||||
 | 
			
		||||
			unsigned order = ilog2(rounddown_pow_of_two(sectors_remaining) / PAGE_SECTORS);
 | 
			
		||||
 | 
			
		||||
			/* ensure proper alignment */
 | 
			
		||||
			order = min(order, __ffs(folio_offset|BIT(31)));
 | 
			
		||||
 | 
			
		||||
			folio = xa_load(&iter->mapping->i_pages, folio_offset);
 | 
			
		||||
			if (folio && !xa_is_value(folio))
 | 
			
		||||
				break;
 | 
			
		||||
 | 
			
		||||
			folio = filemap_alloc_folio(readahead_gfp_mask(iter->mapping), 0);
 | 
			
		||||
			folio = filemap_alloc_folio(readahead_gfp_mask(iter->mapping), order);
 | 
			
		||||
			if (!folio)
 | 
			
		||||
				break;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1802,7 +1802,8 @@ static void bch2_vfs_inode_init(struct btree_trans *trans,
 | 
			
		|||
		break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	mapping_set_large_folios(inode->v.i_mapping);
 | 
			
		||||
	mapping_set_folio_min_order(inode->v.i_mapping,
 | 
			
		||||
				    get_order(trans->c->opts.block_size));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void bch2_free_inode(struct inode *vinode)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -372,7 +372,6 @@ static int bch2_sb_validate(struct bch_sb_handle *disk_sb,
 | 
			
		|||
	struct bch_sb *sb = disk_sb->sb;
 | 
			
		||||
	struct bch_sb_field_members_v1 *mi;
 | 
			
		||||
	enum bch_opt_id opt_id;
 | 
			
		||||
	u16 block_size;
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	ret = bch2_sb_compatible(sb, out);
 | 
			
		||||
| 
						 | 
				
			
			@ -391,14 +390,6 @@ static int bch2_sb_validate(struct bch_sb_handle *disk_sb,
 | 
			
		|||
		return -BCH_ERR_invalid_sb_features;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	block_size = le16_to_cpu(sb->block_size);
 | 
			
		||||
 | 
			
		||||
	if (block_size > PAGE_SECTORS) {
 | 
			
		||||
		prt_printf(out, "Block size too big (got %u, max %u)",
 | 
			
		||||
		       block_size, PAGE_SECTORS);
 | 
			
		||||
		return -BCH_ERR_invalid_sb_block_size;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (bch2_is_zero(sb->user_uuid.b, sizeof(sb->user_uuid))) {
 | 
			
		||||
		prt_printf(out, "Bad user UUID (got zeroes)");
 | 
			
		||||
		return -BCH_ERR_invalid_sb_uuid;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue