mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 16:12:59 +02:00
bcachefs: Fix accidental O(n^2) in fiemap
Since bch2_seek_pagecache_data() searches for dirty data, we only want to call it for holes in the extents btree - otherwise we have an accidental O(n^2), as we repeatedly search the same range. Reported-by: Marcin Mirosław <marcin@mejor.pl> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
43b9fece2d
commit
a12cb6f758
|
|
@ -1429,7 +1429,9 @@ static int bch2_next_fiemap_extent(struct btree_trans *trans,
|
|||
if (ret)
|
||||
goto err;
|
||||
|
||||
ret = bch2_next_fiemap_pagecache_extent(trans, inode, start, end, cur);
|
||||
u64 pagecache_end = k.k ? max(start, bkey_start_offset(k.k)) : end;
|
||||
|
||||
ret = bch2_next_fiemap_pagecache_extent(trans, inode, start, pagecache_end, cur);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user