mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-10-31 08:44:41 +00:00 
			
		
		
		
	bcachefs: better __bch2_snapshot_is_ancestor() assert
Previously, we weren't checking the result of the skiplist walk, just the is_ancestor bitmap. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
		
							parent
							
								
									425da82c63
								
							
						
					
					
						commit
						f2ed089273
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		|  | @ -135,7 +135,9 @@ static bool test_ancestor_bitmap(struct snapshot_table *t, u32 id, u32 ancestor) | |||
| 
 | ||||
| bool __bch2_snapshot_is_ancestor(struct bch_fs *c, u32 id, u32 ancestor) | ||||
| { | ||||
| 	bool ret; | ||||
| #ifdef CONFIG_BCACHEFS_DEBUG | ||||
| 	u32 orig_id = id; | ||||
| #endif | ||||
| 
 | ||||
| 	guard(rcu)(); | ||||
| 	struct snapshot_table *t = rcu_dereference(c->snapshots); | ||||
|  | @ -147,11 +149,11 @@ bool __bch2_snapshot_is_ancestor(struct bch_fs *c, u32 id, u32 ancestor) | |||
| 		while (id && id < ancestor - IS_ANCESTOR_BITMAP) | ||||
| 			id = get_ancestor_below(t, id, ancestor); | ||||
| 
 | ||||
| 	ret = id && id < ancestor | ||||
| 	bool ret = id && id < ancestor | ||||
| 		? test_ancestor_bitmap(t, id, ancestor) | ||||
| 		: id == ancestor; | ||||
| 
 | ||||
| 	EBUG_ON(ret != __bch2_snapshot_is_ancestor_early(t, id, ancestor)); | ||||
| 	EBUG_ON(ret != __bch2_snapshot_is_ancestor_early(t, orig_id, ancestor)); | ||||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Kent Overstreet
						Kent Overstreet