bio: add a helper calculating nr segments to alloc