Ryusuke Konishi 374e2e06e6 lscp: accelerate backward checkpoint listing
If the minimum checkpoint number of valid checkpoints is large to some
extent, "lscp -r" command takes very long time:

 $ lscp -r
                 CNO        DATE     TIME  MODE  FLG      BLKCNT       ICNT
             6541269  2015-02-11 18:38:30   cp    -          435          2
             6541268  2015-02-11 18:38:25   cp    -          484         51
  <the command looks to enter a busy loop>

This is because it tries to find younger checkpoints tracking back the
checkpoint list in a constant step size.

This fixes the issue by lengthening or shortening the step size
depending on whether the backward search found a younger checkpoint or
not.

This patch also inserts a dummy nilfs_get_cpinfo() call before
starting the backward search to make successive nilfs_get_cpinfo()
calls much faster.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2015-02-15 00:39:19 +09:00
..