On Fri, Jun 23, 2017 at 10:28:31PM -0600, Liu Bo wrote: > From: Liu Bo <boliu@localhost.localdomain> > > %search_start is calculated in a wrong way, and if %ins is a cross-stripe > one, it'll search the same block group forever.
That's a bit terse description, so please check if my understanding is right: search_start advances by at least one stripe len, but the math would be wrong as using bg_offset would not move us to the next stripe. bg_cache->key.objectid is the full length so this will reach the next stripe and will not loop forever. Do you happen to have a test for that? > Signed-off-by: Liu Bo <bo.li....@oracle.com> > --- > extent-tree.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/extent-tree.c b/extent-tree.c > index b12ee29..5e09274 100644 > --- a/extent-tree.c > +++ b/extent-tree.c > @@ -2614,8 +2614,9 @@ check_failed: > goto no_bg_cache; > bg_offset = ins->objectid - bg_cache->key.objectid; > > - search_start = round_up(bg_offset + num_bytes, > - BTRFS_STRIPE_LEN) + bg_offset; > + search_start = round_up( > + bg_offset + num_bytes, BTRFS_STRIPE_LEN) + > + bg_cache->key.object; extent-tree.c: In function ‘find_free_extent’: extent-tree.c:2617:18: error: ‘struct btrfs_key’ has no member named ‘object’; did you mean ‘objectid’? bg_cache->key.object; ^ -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html