factor out needs_queue_seg function. delete relevant variable

Signed-off-by: Akira Hayakawa <ruby.wktk@gmail.com>